* [PATCH 1/1] nfs42: client needs to update file mode after ALLOCATE op
@ 2023-08-24 15:18 Dai Ngo
2023-08-24 15:38 ` Trond Myklebust
0 siblings, 1 reply; 2+ messages in thread
From: Dai Ngo @ 2023-08-24 15:18 UTC (permalink / raw)
To: trondmy, anna; +Cc: linux-nfs
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] nfs42: client needs to update file mode after ALLOCATE op
2023-08-24 15:18 [PATCH 1/1] nfs42: client needs to update file mode after ALLOCATE op Dai Ngo
@ 2023-08-24 15:38 ` Trond Myklebust
0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2023-08-24 15:38 UTC (permalink / raw)
To: anna@kernel.org, dai.ngo@oracle.com; +Cc: linux-nfs@vger.kernel.org
On Thu, 2023-08-24 at 08:18 -0700, Dai Ngo wrote:
> 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() will take care of masking out bits that are not
supported, so the condition above is redundant.
> nfs4_bitmask_set(bitmask, server->cache_consistency_bitmask,
> inode,
> - NFS_INO_INVALID_BLOCKS);
> + mask);
>
> res.falloc_fattr = nfs_alloc_fattr();
> if (!res.falloc_fattr)
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-24 15:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 15:18 [PATCH 1/1] nfs42: client needs to update file mode after ALLOCATE op Dai Ngo
2023-08-24 15:38 ` Trond Myklebust
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).