[pnfs] [PATCH] check that the owner is unlocking

Marc Eshel eshel at almaden.ibm.com
Fri May 16 13:12:33 EDT 2008


"J. Bruce Fields" <bfields at fieldses.org> wrote on 05/16/2008 09:59:35 AM:

> "J. Bruce Fields" <bfields at fieldses.org> 
> 05/16/2008 09:59 AM
> 
> To
> 
> Marc Eshel <eshel at almaden.ibm.com>
> 
> cc
> 
> pnfs at linux-nfs.org
> 
> Subject
> 
> Re: [pnfs] [PATCH] check that the owner is unlocking
> 
> On Fri, May 16, 2008 at 09:22:40AM -0700, Marc Eshel wrote:
> > "J. Bruce Fields" <bfields at fieldses.org> wrote on 05/16/2008 07:35:14 
AM:
> > 
> > > "J. Bruce Fields" <bfields at fieldses.org> 
> > > 05/16/2008 07:35 AM
> > > 
> > > To
> > > 
> > > Marc Eshel <eshel at almaden.ibm.com>
> > > 
> > > cc
> > > 
> > > pnfs at linux-nfs.org
> > > 
> > > Subject
> > > 
> > > Re: [pnfs] [PATCH] check that the owner is unlocking
> > > 
> > > On Thu, May 15, 2008 at 03:26:49PM -0700, Marc Eshel wrote:
> > > > From: Marc Eshel <eshel at almaden.ibm.com>
> > > > 
> > > > 
> > > > ---
> > > > 
> > > >  fs/nfsd/nfs4state.c |    1 +
> > > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > > > 
> > > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > > > index 20a4b8e..b75a863 100644
> > > > --- a/fs/nfsd/nfs4state.c
> > > > +++ b/fs/nfsd/nfs4state.c
> > > > @@ -134,6 +134,7 @@ nfs4_lock_state(void)
> > > >  void
> > > >  nfs4_unlock_state(void)
> > > >  {
> > > > +   BUG_ON(client_mutex_owner != current_thread_info());
> > > >     client_mutex_owner = NULL;
> > > >     mutex_unlock(&client_mutex);
> > > 
> > > The mutex code should already check for this.
> > > 
> > 
> > but by than client_mutex_owner is already NULL
> 
> Right, but I don't understand why the client_mutex_owner is needed, when
> the struct mutex already has an owner field, and already uses it to do
> the above check for us; see include/linux/mutex.h.  Looks like you need
> CONFIG_DEBUG_MUTEXES defined (under Kernel Hacking->"Mutex debugging:
> basic checks").

I am not sure if there is better way to implement 
nfs4_lock_state_nested(), I did not this routine but as long as this 
routine is there it depend on that owner field.
Marc.
 
> 
> --b.
> 
> > so if some thread unlocks 
> > a lock that it doesn't own it will reset the real owner to NULL which 
will 
> > confuse functions like nfs4_lock_state_nested().



More information about the pNFS mailing list