linux-stable/fs/9p
Dominique Martinet b9e9f848c8 Revert "fs/9p: search open fids first"
commit 22e424feb6 upstream.

This reverts commit 478ba09edc.

That commit was meant as a fix for setattrs with by fd (e.g. ftruncate)
to use an open fid instead of the first fid it found on lookup.
The proper fix for that is to use the fid associated with the open file
struct, available in iattr->ia_file for such operations, and was
actually done just before in 6624664160 ("9p: retrieve fid from file
when file instance exist.")
As such, this commit is no longer required.

Furthermore, changing lookup to return open fids first had unwanted side
effects, as it turns out the protocol forbids the use of open fids for
further walks (e.g. clone_fid) and we broke mounts for some servers
enforcing this rule.

Note this only reverts to the old working behaviour, but it's still
possible for lookup to return open fids if dentry->d_fsdata is not set,
so more work is needed to make sure we respect this rule in the future,
for example by adding a flag to the lookup functions to only match
certain fid open modes depending on caller requirements.

Link: https://lkml.kernel.org/r/20220130130651.712293-1-asmadeus@codewreck.org
Fixes: 478ba09edc ("fs/9p: search open fids first")
Cc: stable@vger.kernel.org # v5.11+
Reported-by: ron minnich <rminnich@gmail.com>
Reported-by: ng@0x80.stream
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-08 18:34:04 +01:00
..
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
acl.h vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
cache.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
cache.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 188 2019-05-30 11:29:21 -07:00
fid.c Revert "fs/9p: search open fids first" 2022-02-08 18:34:04 +01:00
fid.h 9p: apply review requests for fid refcounting 2020-11-19 17:21:34 +01:00
Kconfig 9p: Fix Kconfig indentation 2020-03-27 09:29:56 +00:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
v9fs.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
v9fs.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
v9fs_vfs.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
vfs_addr.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
vfs_dentry.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
vfs_dir.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
vfs_file.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
vfs_inode.c 9p: Fix a bunch of kerneldoc warnings shown up by W=1 2021-10-04 22:07:46 +01:00
vfs_inode_dotl.c 9p: only copy valid iattrs in 9P2000.L setattr implementation 2022-01-20 09:13:14 +01:00
vfs_super.c 9p: add refcount to p9_fid struct 2020-11-19 17:20:39 +01:00
xattr.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr.h 9p: xattr simplifications 2015-11-13 20:34:33 -05:00