[PATCH 2/6] Don't assume UID 0 attach

From: Eric Van Hensbergen
Date: Sat Dec 17 2022 - 14:19:05 EST


The writeback_fid fallback code assumes a root uid fallback which
breaks many server configurations (which don't run as root). This
patch switches to generic lookup which will follow argument
guidence on access modes and default ids to use on failure.

There is a deeper underlying problem with writeback_fids in that
this fallback is too standard and not an exception due to the way
writeback mode works in the current implementation. Subsequent
patches will try to associate writeback fids from the original user
either by flushing on close or by holding onto fid until writeback
completes.

Signed-off-by: Eric Van Hensbergen <evanhensbergen@xxxxxxxxxx>
---
fs/9p/fid.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 805151114e96..1fbd12d581bb 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -304,7 +304,9 @@ struct p9_fid *v9fs_writeback_fid(struct dentry *dentry)
int err;
struct p9_fid *fid, *ofid;

- ofid = v9fs_fid_lookup_with_uid(dentry, GLOBAL_ROOT_UID, 0);
+ /* pull default uid from dfltuid */
+
+ ofid = v9fs_fid_lookup(dentry);
fid = clone_fid(ofid);
if (IS_ERR(fid))
goto error_out;
--
2.37.2