On Tue, 2024-03-19 at 18:47 +0800, Chen Hanxiao wrote: > As write_filehandle can't accept zero-bytes writting, > remove read permission of /proc/fs/nfsd/filehandle > > Signed-off-by: Chen Hanxiao <chenhx.fnst@xxxxxxxxxxx> > --- > fs/nfsd/nfsctl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c > index ecd18bffeebc..da1387f1e30a 100644 > --- a/fs/nfsd/nfsctl.c > +++ b/fs/nfsd/nfsctl.c > @@ -1346,7 +1346,7 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc) > &transaction_ops, S_IWUSR|S_IRUSR}, > [NFSD_FO_UnlockFS] = {"unlock_filesystem", > &transaction_ops, S_IWUSR|S_IRUSR}, > - [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, > + [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR}, > [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, > [NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR}, > [NFSD_Pool_Stats] = {"pool_stats", &pool_stats_operations, S_IRUGO}, I don't think we can do this. mountd does this to get the rootfh for an exported fs and it'll probably start failing if it can't open that file for read: f = open("/proc/fs/nfsd/filehandle", O_RDWR); That write_filehandle interface sure is weird though. Could we get rid of it by teaching cache_get_filehandle how to use name_to_handle_at instead? That would be a lot cleaner and would get rid of yet another dependency on /proc/fs/nfsd. -- Jeff Layton <jlayton@xxxxxxxxxx>