linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dai Ngo <dai.ngo@oracle.com>
To: trondmy@hammerspace.com, anna@kernel.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/1] nfs42: client needs to update file mode after ALLOCATE op
Date: Thu, 24 Aug 2023 08:18:10 -0700	[thread overview]
Message-ID: <1692890290-2772-1-git-send-email-dai.ngo@oracle.com> (raw)

The Linux NFS server strips the SUID and SGID from the file mode
on ALLOCATE op. The GETATTR op in the ALLOCATE compound needs to
request the file mode from the server to update its file mode in
case the SUID/SGUI bit were stripped.

Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
---
 fs/nfs/nfs42proc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 63802d195556..ba2b83bfb37c 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -57,6 +57,9 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
 		.falloc_server	= server,
 	};
 	int status;
+	struct super_block *sb = inode->i_sb;
+	u64 fattr_supported = NFS_SB(sb)->fattr_valid;
+	unsigned long mask = NFS_INO_INVALID_BLOCKS;
 
 	msg->rpc_argp = &args;
 	msg->rpc_resp = &res;
@@ -69,8 +72,10 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
 		return status;
 	}
 
+	if (fattr_supported & NFS_ATTR_FATTR_MODE)
+		mask |= NFS_INO_INVALID_MODE;
 	nfs4_bitmask_set(bitmask, server->cache_consistency_bitmask, inode,
-			 NFS_INO_INVALID_BLOCKS);
+				mask);
 
 	res.falloc_fattr = nfs_alloc_fattr();
 	if (!res.falloc_fattr)
-- 
2.39.3


             reply	other threads:[~2023-08-24 15:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 15:18 Dai Ngo [this message]
2023-08-24 15:38 ` [PATCH 1/1] nfs42: client needs to update file mode after ALLOCATE op Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1692890290-2772-1-git-send-email-dai.ngo@oracle.com \
    --to=dai.ngo@oracle.com \
    --cc=anna@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).