From patchwork Sat Aug 27 00:47:36 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: 1103542 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7R0kO2q005429 for ; Sat, 27 Aug 2011 00:47:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754544Ab1H0Ari (ORCPT ); Fri, 26 Aug 2011 20:47:38 -0400 Received: from fieldses.org ([174.143.236.118]:35980 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752920Ab1H0Ari (ORCPT ); Fri, 26 Aug 2011 20:47:38 -0400 Received: from bfields by fieldses.org with local (Exim 4.72) (envelope-from ) id 1Qx73g-0005Ch-8t; Fri, 26 Aug 2011 20:47:36 -0400 Date: Fri, 26 Aug 2011 20:47:36 -0400 From: "J. Bruce Fields" To: Boaz Harrosh Cc: "J. Bruce Fields" , NFS list Subject: [PATCH 2/2] nfsd4: fix failure to end nfsd4 grace period Message-ID: <20110827004736.GB19967@fieldses.org> References: <4E45C594.1030609@panasas.com> <20110826201910.GB17196@fieldses.org> <4E5838E0.4090703@panasas.com> <20110827004618.GG18699@fieldses.org> <20110827004708.GA19967@fieldses.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110827004708.GA19967@fieldses.org> 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 (demeter2.kernel.org [140.211.167.43]); Sat, 27 Aug 2011 00:47:39 +0000 (UTC) From: Boaz Harrosh Even if we fail to write a recovery record, we should still mark the client as having acquired its first state. Otherwise we leave 4.1 clients with indefinite ERR_GRACE returns. However, an inability to write stable storage records may cause failures of reboot recovery, and the problem should still be brought to the server administrator's attention. So, make sure the error is logged. These errors shouldn't normally be triggered on a corectly functioning server--this isn't a case where a misconfigured client could spam the logs. Signed-off-by: Boaz Harrosh Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4recover.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 3e6ebcf..ed083b9 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -130,6 +130,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) if (!rec_file || clp->cl_firststate) return 0; + clp->cl_firststate = 1; status = nfs4_save_creds(&original_cred); if (status < 0) return status; @@ -144,10 +145,8 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) goto out_unlock; } status = -EEXIST; - if (dentry->d_inode) { - dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n"); + if (dentry->d_inode) goto out_put; - } status = mnt_want_write(rec_file->f_path.mnt); if (status) goto out_put; @@ -157,12 +156,14 @@ out_put: dput(dentry); out_unlock: mutex_unlock(&dir->d_inode->i_mutex); - if (status == 0) { - clp->cl_firststate = 1; + if (status == 0) vfs_fsync(rec_file, 0); - } + else + printk(KERN_ERR "NFSD: failed to write recovery record" + " (err %d); please check that %s exists" + " and is writeable", status, + user_recovery_dirname); nfs4_reset_creds(original_cred); - dprintk("NFSD: nfsd4_create_clid_dir returns %d\n", status); return status; }