All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: NFS list <linux-nfs@vger.kernel.org>
Subject: Re: writeable file with no mnt_want_write()
Date: Tue, 08 Jul 2008 11:40:52 +0300	[thread overview]
Message-ID: <48732814.2050004@panasas.com> (raw)
In-Reply-To: <20080707190517.GF14291@fieldses.org>

On Jul. 07, 2008, 22:05 +0300, "J. Bruce Fields" <bfields@fieldses.org> wrote:
> On Fri, Jul 04, 2008 at 03:34:11PM +0300, Benny Halevy wrote:
>> On Jul. 03, 2008, 23:36 +0300, "J. Bruce Fields" <bfields@fieldses.org> wrote:
>>> We're just trying to enforce rfc 3530 14.2.19:
>> OK. I see.
>> Thanks for explaining!
>> It is a bit mind boggling, maybe adding some comments explaining
>> why the bitmap is needed would help...
> 
> Where do you think you would have looked for a comment?  I figured just
> before the helper functions here was one obvious place.

Yup. Either here, or closer to (nfsd's) struct nfs4_stateid's definition
where st_{access,deny}_bmap are defined.

Benny

> 
> --b.
> 
> commit 4f83aa302f8f8b42397c6d3703d670f0588c03ec
> Author: J. Bruce Fields <bfields@citi.umich.edu>
> Date:   Mon Jul 7 15:02:02 2008 -0400
> 
>     nfsd: document open share bit tracking
>     
>     It's not immediately obvious from the code why we're doing this.
>     
>     Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
>     Cc: Benny Halevy <bhalevy@panasas.com>
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index eca8aaa..c29b6ed 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1173,6 +1173,24 @@ static inline int deny_valid(u32 x)
>  	return x <= NFS4_SHARE_DENY_BOTH;
>  }
>  
> +/*
> + * We store the NONE, READ, WRITE, and BOTH bits separately in the
> + * st_{access,deny}_bmap field of the stateid, in order to track not
> + * only what share bits are currently in force, but also what
> + * combinations of share bits previous opens have used.  This allows us
> + * to enforce the recommendation of rfc 3530 14.2.19 that the server
> + * return an error if the client attempt to downgrade to a combination
> + * of share bits not explicable by closing some of its previous opens.
> + *
> + * XXX: This enforcement is actually incomplete, since we don't keep
> + * track of access/deny bit combinations; so, e.g., we allow:
> + *
> + *	OPEN allow read, deny write
> + *	OPEN allow both, deny none
> + *	DOWNGRADE allow read, deny none
> + *
> + * which we should reject.
> + */
>  static void
>  set_access(unsigned int *access, unsigned long bmap) {
>  	int i;


      reply	other threads:[~2008-07-08  8:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-03 12:21 writeable file with no mnt_want_write() Benny Halevy
2008-07-03 20:36 ` J. Bruce Fields
2008-07-04 12:34   ` Benny Halevy
2008-07-04 12:38     ` [PATCH] nfsd: take file and mnt write in nfs4_upgrade_open Benny Halevy
2008-07-07 19:25       ` J. Bruce Fields
2008-07-08  8:16         ` Benny Halevy
2008-07-08 14:35           ` J. Bruce Fields
2008-07-07 19:05     ` writeable file with no mnt_want_write() J. Bruce Fields
2008-07-08  8:40       ` Benny Halevy [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=48732814.2050004@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.