linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 05/12] NFS: Save root file handle in nfs_server
Date: Mon, 14 Mar 2011 08:57:10 -0400	[thread overview]
Message-ID: <20110314125710.2413.18253.stgit@matisse.1015granger.net> (raw)
In-Reply-To: <20110314125204.2413.8870.stgit@matisse.1015granger.net>

Save each FSID's root directory file handle in the export's local
nfs_server structure on the client.  This FH can later be used by the
migration recovery logic.

NB: Saving the root FH is done only for NFSv4 mounts.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 fs/nfs/client.c           |    1 +
 fs/nfs/getroot.c          |    5 +++++
 include/linux/nfs_fs_sb.h |    1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index f8c95e4..a2f016a 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1081,6 +1081,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 b5ffe8f..437d1a1 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -205,6 +205,11 @@ 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_display_fhandle(mntfh, "nfs_get_root: new root FH");
+		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 b197563..961ee85 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -153,6 +153,7 @@ struct nfs_server {
 #endif
 	struct list_head	delegations;
 	void (*destroy)(struct nfs_server *);
+	struct nfs_fh		*rootfh;
 
 	atomic_t active; /* Keep trace of any activity to this server */
 


  parent reply	other threads:[~2011-03-14 12:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14 12:56 [PATCH 00/12] Snapshot of client-side NFSv4 migration support (v2) Chuck Lever
2011-03-14 12:56 ` [PATCH 01/12] SUNRPC: Remove obsolete comment Chuck Lever
2011-03-14 12:56 ` [PATCH 02/12] SUNRPC: Add API to acquire source address Chuck Lever
2011-03-14 12:56 ` [PATCH 03/12] NFS: Add NFS4CLNT_UPDATE_CLIENTID Chuck Lever
2011-03-14 12:57 ` [PATCH 04/12] NFS: Add a client-side function to display file handles Chuck Lever
2011-03-14 12:57 ` Chuck Lever [this message]
2011-03-14 12:57 ` [PATCH 06/12] NFS: Introduce NFS_ATTR_FATTR_V4_LOCATIONS Chuck Lever
2011-03-14 12:57 ` [PATCH 07/12] NFS: Introduce nfs4_proc_get_mig_status() Chuck Lever
2011-03-14 12:57 ` [PATCH 08/12] NFS: Add functions to swap transports during migration recovery Chuck Lever
2011-03-14 12:57 ` [PATCH 09/12] NFS: Add basic migration support to state manager thread Chuck Lever
2011-03-14 12:57 ` [PATCH 10/12] NFS: Remove "const" from "struct nfs_server *" fields Chuck Lever
2011-03-14 12:58 ` [PATCH 11/12] NFS: Add migration recovery callouts in nfs4proc.c Chuck Lever
2011-03-14 12:58 ` [PATCH 12/12] NFS: Implement support for NFS4ERR_LEASE_MOVED Chuck Lever

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=20110314125710.2413.18253.stgit@matisse.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.com \
    /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).