Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
2
-
2974
Description
One osd-ldiskfs issue not fixed in ORI-577 is that link counts of new directories are not initialized by the reference addition and deletion interface, but by the index insertion interface. Callers should still add references for "." and ".." on new directories, but must do so _before_ inserting the "." and "..".
We could possibly implement a fix like this:
- dio_insert and dio_delete never update link counts, not even
for "." and "..".
* Revise ldiskfs_add_dot_dotdot() to be able to add "." and
".." separately, without changing link counts. (Maybe we
don't need a special function here; the generic
ldiskfs_add_entry() works for "." and ".."?)
* Revise ldiskfs_create_inode() to initial i_fop, i_op, etc.,
for directory inodes. This is currently done by
ldiskfs_add_dot_dotdot(). (We may also set i_nlink to zero
here, as the API between LDiskFS and Lustre is being
changed anyway.)
- do_ref_add and do_ref_del always work as expected for
directories.
* A flag should be set for new directory in-memory objects,
indicating it's not yet initialized with "." and "..".
* do_ref_add clears the flag if it is set and the link count
is going from one to two.
* The DIR_NLINK stuff in do_ref_add and do_ref_del works only
when the flag is absent.
* This scheme assumes that the creation of a directory object
and its initialization (i.e., link count, ".", and "..")
happen in one transaction, which I think is quite
reasonable.