linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Yanchuan Nian <ycnian@gmail.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfsd: Correct read access checking
Date: Tue, 5 Mar 2013 16:10:59 -0500	[thread overview]
Message-ID: <20130305211059.GC15816@fieldses.org> (raw)
In-Reply-To: <20130303090211.GA29550@localhost.localdomain>

On Sun, Mar 03, 2013 at 05:02:11PM +0800, Yanchuan Nian wrote:
> NFS4_SHARE_ACCESS_WRITE should not be tested in access_permit_read() for this
> function just tests read permission, so remove it.
> 
> Signed-off-by: Yanchuan Nian <ycnian@gmail.com>
> ---
>  fs/nfsd/nfs4state.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 16d39c6..75c873d 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -3322,8 +3322,7 @@ static inline int
>  access_permit_read(struct nfs4_ol_stateid *stp)
>  {
>  	return test_access(NFS4_SHARE_ACCESS_READ, stp) ||
> -		test_access(NFS4_SHARE_ACCESS_BOTH, stp) ||
> -		test_access(NFS4_SHARE_ACCESS_WRITE, stp);
> +		test_access(NFS4_SHARE_ACCESS_BOTH, stp);
>  }

This was introduced by a patch from 2005:

    [PATCH] nfsd4: allow read on open for write
    
    The rfc recommends allowing read using stateid's from opens that only
    requested write access, as clients may in some cases be unable to write
    without doing reads.

So I think it's correct.

That said, I don't understand why we still have this function at all:
can it ever return anything other than true?

--b.

      reply	other threads:[~2013-03-05 21:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-03  9:02 [PATCH] nfsd: Correct read access checking Yanchuan Nian
2013-03-05 21:10 ` J. Bruce Fields [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=20130305211059.GC15816@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=ycnian@gmail.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).