Return-Path: linux-nfs-owner@vger.kernel.org Received: from e1.ny.us.ibm.com ([32.97.182.141]:58610 "EHLO e1.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751796Ab1LIPXt (ORCPT ); Fri, 9 Dec 2011 10:23:49 -0500 Received: from /spool/local by e1.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Dec 2011 10:23:47 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pB9FNgMw292544 for ; Fri, 9 Dec 2011 10:23:42 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pB9FNgCl021181 for ; Fri, 9 Dec 2011 13:23:42 -0200 From: Matthew Treinish To: linux-nfs@vger.kernel.org Cc: treinish@linux.vnet.ibm.com, Chuck Lever Subject: [PATCH/RFC v2 4/7] Save root file handle in nfs_server. Date: Fri, 9 Dec 2011 10:23:29 -0500 Message-Id: <1323444212-9855-5-git-send-email-treinish@linux.vnet.ibm.com> In-Reply-To: <1323444212-9855-1-git-send-email-treinish@linux.vnet.ibm.com> References: <1323444212-9855-1-git-send-email-treinish@linux.vnet.ibm.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: Save each FSID's root directory file handle in the export's local nfs_server structure on the client. This FH can then be used as the end case for the recursive walkback during VFH recovery. This was originally written by Chuck Lever so that the FH can be used for migration recovery logic. Signed-off-by: Chuck Lever Signed-off-by: Matthew Treinish --- fs/nfs/client.c | 1 + fs/nfs/getroot.c | 7 +++++++ include/linux/nfs_fs_sb.h | 1 + 3 files changed, 9 insertions(+), 0 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 44dedfe..641f69f 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1108,6 +1108,7 @@ void nfs_free_server(struct nfs_server *server) nfs_put_client(server->nfs_client); nfs_free_iostats(server->io_stats); + nfs_free_fhandle(server->rootfh); bdi_destroy(&server->backing_dev_info); kfree(server); nfs_release_automount_timer(); diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index dcb6154..51ca63b 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -232,6 +232,13 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh, ret = ERR_CAST(inode); goto out; } + server->rootfh = nfs_alloc_fhandle(); + if (server->rootfh == NULL) { + dprintk("nfs_get_root: alloc rootfh failed\n"); + ret = ERR_PTR(-ENOMEM); + goto out; + } + nfs_copy_fh(server->rootfh, mntfh); error = nfs_superblock_set_dummy_root(sb, inode); if (error != 0) { diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 706c92b..5261fa1 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -157,6 +157,7 @@ struct nfs_server { struct list_head layouts; struct list_head delegations; void (*destroy)(struct nfs_server *); + struct nfs_fh *rootfh; atomic_t active; /* Keep trace of any activity to this server */ -- 1.7.4.4