@@ -450,13 +450,13 @@ If that doesn't get a good result, it calls "``lookup_slow()``" which
450450takes ``i_rwsem ``, rechecks the cache, and then asks the filesystem
451451to find a definitive answer.
452452
453- As the last step of `` walk_component() ``, `` step_into() `` will be called either
453+ As the last step of walk_component(), step_into() will be called either
454454directly from walk_component() or from handle_dots(). It calls
455- `` handle_mounts() `` , to check and handle mount points, in which a new
455+ handle_mounts(), to check and handle mount points, in which a new
456456``struct path `` is created containing a counted reference to the new dentry and
457457a reference to the new ``vfsmount `` which is only counted if it is
458458different from the previous ``vfsmount ``. Then if there is
459- a symbolic link, `` step_into() `` calls `` pick_link() `` to deal with it,
459+ a symbolic link, step_into() calls pick_link() to deal with it,
460460otherwise it installs the new ``struct path `` in the ``struct nameidata ``, and
461461drops the unneeded references.
462462
@@ -472,8 +472,8 @@ Handling the final component
472472``nd->last_type `` to refer to the final component of the path. It does
473473not call ``walk_component() `` that last time. Handling that final
474474component remains for the caller to sort out. Those callers are
475- `` path_lookupat() ``, `` path_parentat() `` and
476- `` path_openat() `` each of which handles the differing requirements of
475+ path_lookupat(), path_parentat() and
476+ path_openat() each of which handles the differing requirements of
477477different system calls.
478478
479479``path_parentat() `` is clearly the simplest - it just wraps a little bit
@@ -489,17 +489,17 @@ object is wanted such as by ``stat()`` or ``chmod()``. It essentially just
489489calls ``walk_component() `` on the final component through a call to
490490``lookup_last() ``. ``path_lookupat() `` returns just the final dentry.
491491It is worth noting that when flag ``LOOKUP_MOUNTPOINT `` is set,
492- `` path_lookupat() `` will unset LOOKUP_JUMPED in nameidata so that in the
493- subsequent path traversal `` d_weak_revalidate() `` won't be called.
492+ path_lookupat() will unset LOOKUP_JUMPED in nameidata so that in the
493+ subsequent path traversal d_weak_revalidate() won't be called.
494494This is important when unmounting a filesystem that is inaccessible, such as
495495one provided by a dead NFS server.
496496
497497Finally ``path_openat() `` is used for the ``open() `` system call; it
498- contains, in support functions starting with "`` open_last_lookups() `` ", all the
498+ contains, in support functions starting with "open_last_lookups()", all the
499499complexity needed to handle the different subtleties of O_CREAT (with
500500or without O_EXCL), final "``/ ``" characters, and trailing symbolic
501501links. We will revisit this in the final part of this series, which
502- focuses on those symbolic links. "`` open_last_lookups() `` " will sometimes, but
502+ focuses on those symbolic links. "open_last_lookups()" will sometimes, but
503503not always, take ``i_rwsem ``, depending on what it finds.
504504
505505Each of these, or the functions which call them, need to be alert to
@@ -651,9 +651,9 @@ RCU-walk finds it cannot stop gracefully, it simply gives up and
651651restarts from the top with REF-walk.
652652
653653This pattern of "try RCU-walk, if that fails try REF-walk" can be
654- clearly seen in functions like `` filename_lookup() `` ,
655- `` filename_parentat() `` ,
656- `` do_filp_open() `` , and `` do_file_open_root() `` . These four
654+ clearly seen in functions like filename_lookup(),
655+ filename_parentat(),
656+ do_filp_open(), and do_file_open_root(). These four
657657correspond roughly to the three ``path_*() `` functions we met earlier,
658658each of which calls ``link_path_walk() ``. The ``path_*() `` functions are
659659called using different mode flags until a mode is found which works.
@@ -1069,8 +1069,8 @@ all the data structures it references are safe to be accessed while
10691069holding no counted reference, only the RCU lock. A callback
10701070``struct delayed_called `` will be passed to ``->get_link() ``:
10711071file 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.
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.
10741074
10751075In order for the reference to each symlink to be dropped when the walk completes,
10761076whether in RCU-walk or REF-walk, the symlink stack needs to contain,
@@ -1103,7 +1103,7 @@ doesn't need to notice. Getting this ``name`` variable on and off the
11031103stack is very straightforward; pushing and popping the references is
11041104a little more complex.
11051105
1106- When a symlink is found, `` walk_component() `` calls `` pick_link() `` via `` step_into() ``
1106+ When a symlink is found, walk_component() calls pick_link() via step_into()
11071107which returns the link from the filesystem.
11081108Providing that operation is successful, the old path ``name `` is placed on the
11091109stack, and the new value is used as the ``name `` for a while. When the end of
@@ -1136,10 +1136,10 @@ Symlinks with no final component
11361136
11371137A pair of special-case symlinks deserve a little further explanation.
11381138Both result in a new ``struct path `` (with mount and dentry) being set
1139- up in the ``nameidata ``, and result in `` pick_link() `` returning ``NULL ``.
1139+ up in the ``nameidata ``, and result in pick_link() returning ``NULL ``.
11401140
11411141The more obvious case is a symlink to "``/ ``". All symlinks starting
1142- with "``/ ``" are detected in `` pick_link() `` which resets the ``nameidata ``
1142+ with "``/ ``" are detected in pick_link() which resets the ``nameidata ``
11431143to point to the effective filesystem root. If the symlink only
11441144contains "``/ ``" then there is nothing more to do, no components at all,
11451145so ``NULL `` is returned to indicate that the symlink can be released and
@@ -1157,9 +1157,9 @@ target file, not just the name of it. When you ``readlink`` these
11571157objects you get a name that might refer to the same file - unless it
11581158has been unlinked or mounted over. When ``walk_component() `` follows
11591159one of these, the ``->get_link() `` method in "procfs" doesn't return
1160- a string name, but instead calls `` nd_jump_link() `` which updates the
1160+ a string name, but instead calls nd_jump_link() which updates the
11611161``nameidata `` in place to point to that target. ``->get_link() `` then
1162- returns ``NULL ``. Again there is no final component and `` pick_link() ``
1162+ returns ``NULL ``. Again there is no final component and pick_link()
11631163returns ``NULL ``.
11641164
11651165Following the symlink in the final component
@@ -1177,35 +1177,35 @@ potentially need to call ``link_path_walk()`` again and again on
11771177successive symlinks until one is found that doesn't point to another
11781178symlink.
11791179
1180- This case is handled by relevant callers of `` link_path_walk() `` , such as
1181- `` path_lookupat() ``, `` path_openat() `` using a loop that calls `` link_path_walk() `` ,
1182- and then handles the final component by calling `` open_last_lookups() `` or
1183- `` lookup_last() `` . If it is a symlink that needs to be followed,
1184- `` open_last_lookups() `` or `` lookup_last() `` will set things up properly and
1180+ This case is handled by relevant callers of link_path_walk(), such as
1181+ path_lookupat(), path_openat() using a loop that calls link_path_walk(),
1182+ and then handles the final component by calling open_last_lookups() or
1183+ lookup_last(). If it is a symlink that needs to be followed,
1184+ open_last_lookups() or lookup_last() will set things up properly and
11851185return the path so that the loop repeats, calling
1186- `` link_path_walk() `` again. This could loop as many as 40 times if the last
1186+ link_path_walk() again. This could loop as many as 40 times if the last
11871187component of each symlink is another symlink.
11881188
11891189Of the various functions that examine the final component,
1190- `` open_last_lookups() `` is the most interesting as it works in tandem
1191- with `` do_open() `` for opening a file. Part of `` open_last_lookups() `` runs
1192- with ``i_rwsem `` held and this part is in a separate function: `` lookup_open() `` .
1190+ open_last_lookups() is the most interesting as it works in tandem
1191+ with do_open() for opening a file. Part of open_last_lookups() runs
1192+ with ``i_rwsem `` held and this part is in a separate function: lookup_open().
11931193
1194- Explaining `` open_last_lookups() `` and `` do_open() `` completely is beyond the scope
1194+ Explaining open_last_lookups() and do_open() completely is beyond the scope
11951195of this article, but a few highlights should help those interested in exploring
11961196the code.
11971197
1198- 1. Rather than just finding the target file, `` do_open() `` is used after
1199- `` open_last_lookup() `` to open
1198+ 1. Rather than just finding the target file, do_open() is used after
1199+ open_last_lookup() to open
12001200 it. If the file was found in the dcache, then ``vfs_open() `` is used for
12011201 this. If not, then ``lookup_open() `` will either call ``atomic_open() `` (if
12021202 the filesystem provides it) to combine the final lookup with the open, or
12031203 will perform the separate ``i_op->lookup() `` and ``i_op->create() `` steps
12041204 directly. In the later case the actual "open" of this newly found or
1205- created file will be performed by `` vfs_open() `` , just as if the name
1205+ created file will be performed by vfs_open(), just as if the name
12061206 were found in the dcache.
12071207
1208- 2. `` vfs_open() `` can fail with ``-EOPENSTALE `` if the cached information
1208+ 2. vfs_open() can fail with ``-EOPENSTALE `` if the cached information
12091209 wasn't quite current enough. If it's in RCU-walk ``-ECHILD `` will be returned
12101210 otherwise ``-ESTALE `` is returned. When ``-ESTALE `` is returned, the caller may
12111211 retry with ``LOOKUP_REVAL `` flag set.
@@ -1218,8 +1218,8 @@ the code.
12181218
12191219 will create a file called ``/tmp/bar ``. This is not permitted if
12201220 ``O_EXCL `` is set but otherwise is handled for an O_CREAT open much
1221- like for a non-creating open: `` lookup_last() `` or `` open_last_lookup() ``
1222- returns a non ``NULL `` value, and `` link_path_walk() `` gets called and the
1221+ like for a non-creating open: lookup_last() or open_last_lookup()
1222+ returns a non ``NULL `` value, and link_path_walk() gets called and the
12231223 open process continues on the symlink that was found.
12241224
12251225Updating the access time
0 commit comments