]> git.baikalelectronics.ru Git - kernel.git/commit
link_path_walk(): be careful when failing with ENOTDIR
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 1 Aug 2015 23:59:28 +0000 (19:59 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 2 Aug 2015 00:18:38 +0000 (20:18 -0400)
commit79c8f067509258195416b195cfb73b671fd83760
tree5cb822a4df9340f2b51a12a66d1653b0a6a1826e
parented5bcb8aebc0174d7396d6222e17a9773f9bdb9a
link_path_walk(): be careful when failing with ENOTDIR

In RCU mode we might end up with dentry evicted just we check
that it's a directory.  In such case we should return ECHILD
rather than ENOTDIR, so that pathwalk would be retries in non-RCU
mode.

Breakage had been introduced in commit 0eb13d7 - prior to that
we were looking at nd->inode, which had been fetched before
verifying that ->d_seq was still valid.  That form of check
would only be satisfied if at some point the pathname prefix
would indeed have resolved to a non-directory.  The fix consists
of checking ->d_seq after we'd run into a non-directory dentry,
and failing with ECHILD in case of mismatch.

Note that all branches since 3.12 have that problem...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c