]> git.baikalelectronics.ru Git - kernel.git/commit
NFSv4: Handle case where the lookup of a directory fails
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 6 Jan 2022 23:24:02 +0000 (18:24 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 7 Jan 2022 16:59:31 +0000 (11:59 -0500)
commitdbcea7db5e8ac7e484dd42a7ef8b3997e2da88b5
treee3f3ebeabbebc61c82aaa9d6bdc23832b7b75bc4
parent033e33661e10b55c1b55fa2fb44907ffafbfe3c7
NFSv4: Handle case where the lookup of a directory fails

If the application sets the O_DIRECTORY flag, and tries to open a
regular file, nfs_atomic_open() will punt to doing a regular lookup.
If the server then returns a regular file, we will happily return a
file descriptor with uninitialised open state.

The fix is to return the expected ENOTDIR error in these cases.

Reported-by: Lyu Tao <tao.lyu@epfl.ch>
Fixes: 0a6e2845fab2 ("nfs: implement i_op->atomic_open()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/dir.c