From patchwork Tue Mar 29 03:18:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 670522 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2T3I8H0017876 for ; Tue, 29 Mar 2011 03:18:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755167Ab1C2DSH (ORCPT ); Mon, 28 Mar 2011 23:18:07 -0400 Received: from fieldses.org ([174.143.236.118]:32786 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755596Ab1C2DSF (ORCPT ); Mon, 28 Mar 2011 23:18:05 -0400 Received: from bfields by fieldses.org with local (Exim 4.72) (envelope-from ) id 1Q4PRU-0000oC-ER; Mon, 28 Mar 2011 23:18:04 -0400 Date: Mon, 28 Mar 2011 23:18:04 -0400 From: "J. Bruce Fields" To: Mi Jinlong Cc: NFS Subject: Re: [PATCH] nfsd4: set right access bmap when initializing lock stateid Message-ID: <20110329031804.GD2695@fieldses.org> References: <4D90357D.3080604@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4D90357D.3080604@cn.fujitsu.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 29 Mar 2011 03:18:08 +0000 (UTC) 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); + nfs4_file_put_access(stp->st_file, oflag); + put_nfs4_file(stp->st_file); + } kmem_cache_free(stateid_slab, stp); }