linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dai.ngo@oracle.com
To: Trond Myklebust <trondmy@hammerspace.com>,
	"anna@kernel.org" <anna@kernel.org>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v2 1/1] nfs42: client needs to update file mode after ALLOCATE op
Date: Thu, 24 Aug 2023 09:12:14 -0700	[thread overview]
Message-ID: <067a68e1-cd7a-55c5-619b-d64266b5ada9@oracle.com> (raw)
In-Reply-To: <c02190c39f123a16aeae70fd65a68fba4aa70b6f.camel@hammerspace.com>


On 8/24/23 9:01 AM, Trond Myklebust wrote:
> On Thu, 2023-08-24 at 08:53 -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 | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
>> index 63802d195556..d3d050171822 100644
>> --- a/fs/nfs/nfs42proc.c
>> +++ b/fs/nfs/nfs42proc.c
>> @@ -70,7 +70,7 @@ static int _nfs42_proc_fallocate(struct rpc_message
>> *msg, struct file *filep,
>>          }
>>   
>>          nfs4_bitmask_set(bitmask, server->cache_consistency_bitmask,
>> inode,
>> -                        NFS_INO_INVALID_BLOCKS);
>> +                       NFS_INO_INVALID_BLOCKS |
>> NFS_INO_INVALID_MODE);
>>   
>>          res.falloc_fattr = nfs_alloc_fattr();
>>          if (!res.falloc_fattr)
> Actually... Wait... Why isn't the existing code sufficient?
>
>          status = nfs4_call_sync(server->client, server, msg,
>                                  &args.seq_args, &res.seq_res, 0);
>          if (status == 0) {
>                  if (nfs_should_remove_suid(inode)) {
>                          spin_lock(&inode->i_lock);
>                          nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE);
>                          spin_unlock(&inode->i_lock);
>                  }
>                  status = nfs_post_op_update_inode_force_wcc(inode,
>                                                              res.falloc_fattr);
>          }
>
> We explicitly check for SUID bits, and invalidate the mode if they are
> set.

nfs_set_cache_invalid checks for delegation and clears the NFS_INO_INVALID_MODE.

-Dai

>

  reply	other threads:[~2023-08-24 16:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 15:53 [PATCH v2 1/1] nfs42: client needs to update file mode after ALLOCATE op Dai Ngo
2023-08-24 16:01 ` Trond Myklebust
2023-08-24 16:12   ` dai.ngo [this message]
2023-08-24 16:34     ` Trond Myklebust
2023-08-24 16:38       ` dai.ngo
2023-08-24 18:42         ` dai.ngo
2023-08-24 19:01           ` Trond Myklebust
2023-08-24 20:05             ` Dai Ngo
2023-08-24 22:26               ` dai.ngo
2023-08-24 23:01                 ` dai.ngo

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=067a68e1-cd7a-55c5-619b-d64266b5ada9@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).