Return-Path: linux-nfs-owner@vger.kernel.org Received: from e31.co.us.ibm.com ([32.97.110.149]:43467 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588Ab2A3TaC (ORCPT ); Mon, 30 Jan 2012 14:30:02 -0500 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Jan 2012 12:30:01 -0700 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 2C8D419D8026 for ; Mon, 30 Jan 2012 12:29:56 -0700 (MST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0UJTwwe151234 for ; Mon, 30 Jan 2012 12:29:58 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0UJTweF007285 for ; Mon, 30 Jan 2012 12:29:58 -0700 Received: from malahal (malahal.austin.ibm.com [9.53.40.203]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q0UJTvJE007268 for ; Mon, 30 Jan 2012 12:29:58 -0700 From: Malahal Naineni To: linux-nfs@vger.kernel.org Subject: [PATCH 07/13] NFS: Save root file handle in nfs_server Date: Mon, 30 Jan 2012 13:29:49 -0600 Message-Id: <1327951795-16400-8-git-send-email-malahal@us.ibm.com> In-Reply-To: <1327951795-16400-1-git-send-email-malahal@us.ibm.com> References: <1327951795-16400-1-git-send-email-malahal@us.ibm.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: From: Chuck Lever Save each FSID's root directory file handle in the FSID's nfs_server structure on the client. For now, only NFSv4 mounts save the root FH. This is needed for migration recovery. Signed-off-by: Chuck Lever Signed-off-by: Malahal Naineni --- fs/nfs/client.c | 1 + fs/nfs/getroot.c | 3 +++ include/linux/nfs_fs_sb.h | 1 + 3 files changed, 5 insertions(+), 0 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 3e3c2ff..2045baa 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1112,6 +1112,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..53eed24 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -232,6 +232,9 @@ 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) + 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 ba4d765..6532d7b 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.8.3