Skip to content

Commit 671f733

Browse files
foxhlchenJonathan Corbet
authored andcommitted
docs: path-lookup: update i_op->put_link and cookie description
No inode->put_link operation anymore. We use delayed_call to deal with link destruction. Cookie has been replaced with struct delayed_call. Related commit: commit fceef39 ("switch ->get_link() to delayed_call, kill ->put_link()") Signed-off-by: Fox Chen <foxhlchen@gmail.com> Reviewed-by: NeilBrown <neilb@suse.de> Link: https://lore.kernel.org/r/20210527091618.287093-9-foxhlchen@gmail.com Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 4a00e4b commit 671f733

1 file changed

Lines changed: 8 additions & 22 deletions

File tree

Documentation/filesystems/path-lookup.rst

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,34 +1066,20 @@ method. This is called both in RCU-walk and REF-walk. In RCU-walk the
10661066
RCU-walk. Much like the ``i_op->permission()`` method we
10671067
looked at previously, ``->get_link()`` would need to be careful that
10681068
all the data structures it references are safe to be accessed while
1069-
holding no counted reference, only the RCU lock. Though getting a
1070-
reference with ``->follow_link()`` is not yet done in RCU-walk mode, the
1071-
code is ready to release the reference when that does happen.
1072-
1073-
This need to drop the reference to a symlink adds significant
1074-
complexity. It requires a reference to the inode so that the
1075-
``i_op->put_link()`` inode operation can be called. In REF-walk, that
1076-
reference is kept implicitly through a reference to the dentry, so
1077-
keeping the ``struct path`` of the symlink is easiest. For RCU-walk,
1078-
the pointer to the inode is kept separately. To allow switching from
1079-
RCU-walk back to REF-walk in the middle of processing nested symlinks
1080-
we also need the seq number for the dentry so we can confirm that
1081-
switching back was safe.
1082-
1083-
Finally, when providing a reference to a symlink, the filesystem also
1084-
provides an opaque "cookie" that must be passed to ``->put_link()`` so that it
1085-
knows what to free. This might be the allocated memory area, or a
1086-
pointer to the ``struct page`` in the page cache, or something else
1087-
completely. Only the filesystem knows what it is.
1069+
holding no counted reference, only the RCU lock. A callback
1070+
``struct delayed_called`` will be passed to ``->get_link()``:
1071+
file systems can set their own put_link function and argument through
1072+
``set_delayed_call()``. Later on, when VFS wants to put link, it will call
1073+
``do_delayed_call()`` to invoke that callback function with the argument.
10881074

10891075
In order for the reference to each symlink to be dropped when the walk completes,
10901076
whether in RCU-walk or REF-walk, the symlink stack needs to contain,
10911077
along with the path remnants:
10921078

1093-
- the ``struct path`` to provide a reference to the inode in REF-walk
1094-
- the ``struct inode *`` to provide a reference to the inode in RCU-walk
1079+
- the ``struct path`` to provide a reference to the previous path
1080+
- the ``const char *`` to provide a reference to the to previous name
10951081
- the ``seq`` to allow the path to be safely switched from RCU-walk to REF-walk
1096-
- the ``cookie`` that tells ``->put_path()`` what to put.
1082+
- the ``struct delayed_call`` for later invocation.
10971083

10981084
This means that each entry in the symlink stack needs to hold five
10991085
pointers and an integer instead of just one pointer (the path

0 commit comments

Comments
 (0)