linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mi Jinlong <mijinlong@cn.fujitsu.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] nfsd4: set right access bmap when initializing lock stateid
Date: Tue, 29 Mar 2011 11:41:39 +0800	[thread overview]
Message-ID: <4D9154F3.20806@cn.fujitsu.com> (raw)
In-Reply-To: <20110329031804.GD2695@fieldses.org>



J. Bruce Fields:
> On Mon, Mar 28, 2011 at 03:15:09PM +0800, Mi Jinlong wrote:
>>  
>> Content-Type: text/plain; charset=ISO-2022-JP
>> Content-Transfer-Encoding: 7bit
> 
> Thanks, Mi Jinlong, the analysis is helpful, but I don't think your fix
> is right.
> 
> I think the problem here is basically that the cleanup on exit from
> nfsd4_lock() may have to deal with a lock stateid that is partially
> initialized, in that everything has been setup except the stuff that's
> done by get_lock_access().

  You are right.

> 
> Maybe something like this??  But I'm not able to test right now.
> 
> --b.
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index fbde6f7..9e8ef31 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -397,10 +397,13 @@ static void unhash_generic_stateid(struct nfs4_stateid *stp)
>  
>  static void free_generic_stateid(struct nfs4_stateid *stp)
>  {
> -	int oflag = nfs4_access_bmap_to_omode(stp);
> +	int oflag;
>  
> -	nfs4_file_put_access(stp->st_file, oflag);
> -	put_nfs4_file(stp->st_file);
> +	if (stp->st_access_bmap) {
> +		nfs4_access_bmap_to_omode(stp);

 This line should be 

     oflag = nfs4_access_bmap_to_omode(stp);

 otherwise, uninitialized oflag will be used at the next line.

 After this patch, kernel runs correctly!

-- 
----
thanks
Mi Jinlong

> +		nfs4_file_put_access(stp->st_file, oflag);
> +		put_nfs4_file(stp->st_file);
> +	}
>  	kmem_cache_free(stateid_slab, stp);
>  }
>  
> 
> 


  reply	other threads:[~2011-03-29  3:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28  7:15 [PATCH] nfsd4: set right access bmap when initializing lock stateid Mi Jinlong
2011-03-29  3:18 ` J. Bruce Fields
2011-03-29  3:41   ` Mi Jinlong [this message]
2011-04-10 16:20     ` J. Bruce Fields
2011-04-11  0:28       ` Mi Jinlong

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=4D9154F3.20806@cn.fujitsu.com \
    --to=mijinlong@cn.fujitsu.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 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).