linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@poochiereds.net>
To: trond.myklebust@primarydata.com
Cc: linux-nfs@vger.kernel.org, Anna Schumaker <Anna.Schumaker@netapp.com>
Subject: Re: [PATCH] nfs: don't match flexfiles mirrors that have different creds
Date: Fri, 29 Apr 2016 06:52:04 -0400	[thread overview]
Message-ID: <1461927124.32715.4.camel@poochiereds.net> (raw)
In-Reply-To: <1460210433-20435-1-git-send-email-jeff.layton@primarydata.com>

On Sat, 2016-04-09 at 10:00 -0400, Jeff Layton wrote:
> When we're comparing mirrors to avoid adding duplicates to the to the
> list, we must also consider the creds when comparing them. Otherwise,
> mirrors that differ only by the credential will be improperly merged.
> 
> This is a problem if the client does a LAYOUTGET for a READ layout
> first and then one for a RW, and the server sends a layout with a
> non-usable uid for the READ layout. The RW mirror entry will get
> dropped on the second layoutget as the client thinks the mirror is
> identical to the one from the first. Then, when it goes to do a
> WRITE, it ends up using the creds from the READ layout and the write
> fails with EACCES.
> 
> Another possibility is to allow the RW segment to supersede the READ
> one. The problem there is that the RW layout is returned, then the
> client will still end up using the creds in the RW layout, which may
> not be correct.
> 
> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
> ---
>  fs/nfs/flexfilelayout/flexfilelayout.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
> index 0cb1abd535e3..5d0789a41bc2 100644
> --- a/fs/nfs/flexfilelayout/flexfilelayout.c
> +++ b/fs/nfs/flexfilelayout/flexfilelayout.c
> @@ -172,6 +172,8 @@ ff_layout_add_mirror(struct pnfs_layout_hdr *lo,
>  			continue;
>  		if (!ff_mirror_match_fh(mirror, pos))
>  			continue;
> +		if (mirror->uid != pos->uid || mirror->gid != pos->gid)
> +			continue;
>  		if (atomic_inc_not_zero(&pos->ref)) {
>  			spin_unlock(&inode->i_lock);
>  			return pos;

Self-NAK on this patch. As Trond pointed out to me in a private
conversation, we rely on this merging to handle layout stats correctly.
The patchset I sent with the cover letter below should supersede this
patch.

	[PATCH v2 0/7] nfs/sunrpc: fix flexfiles credential handling

Thanks!
-- 
Jeff Layton <jlayton@poochiereds.net>

      reply	other threads:[~2016-04-29 10:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-09 14:00 [PATCH] nfs: don't match flexfiles mirrors that have different creds Jeff Layton
2016-04-29 10:52 ` Jeff Layton [this message]

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=1461927124.32715.4.camel@poochiereds.net \
    --to=jlayton@poochiereds.net \
    --cc=Anna.Schumaker@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.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).