linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Treinish <treinish@linux.vnet.ibm.com>
To: linux-nfs@vger.kernel.org
Cc: treinish@linux.vnet.ibm.com, Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH/RFC v3 02/10] Save root file handle in nfs_server.
Date: Mon,  5 Mar 2012 15:26:43 -0500	[thread overview]
Message-ID: <1330979211-894-3-git-send-email-treinish@linux.vnet.ibm.com> (raw)
In-Reply-To: <1330979211-894-1-git-send-email-treinish@linux.vnet.ibm.com>

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 <chuck.lever@oracle.com>
Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com>
---
 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 2f96f9d..7566325 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1137,6 +1137,7 @@ void nfs_free_server(struct nfs_server *server)
 	ida_destroy(&server->lockowner_id);
 	ida_destroy(&server->openowner_id);
 	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 15a2056..5993319 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -160,6 +160,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


  parent reply	other threads:[~2012-03-05 20:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05 20:26 [PATCH/RFC v3 00/10] Volatile File Handle Client-side Support Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 01/10] Add support for FH_EXPIRE_TYPE attribute Matthew Treinish
2012-03-05 20:26 ` Matthew Treinish [this message]
2012-03-05 20:26 ` [PATCH/RFC v3 03/10] Store root dentry in server object Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 04/10] Store objects in nfs4_exception to be used during FHEXPIRED recovery Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 05/10] Add nfs4_vfh_getdentry() for getattr recovery Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 06/10] Add VFH FHEXPIRED recovery functions Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 07/10] Perform recovery on both inodes for rename Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 08/10] Added error handling for NFS4ERR_FHEXPIRED Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 09/10] VFH recovery from a replication/migration event Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 10/10] New mount option for volatile filehandle recovery Matthew Treinish
2012-03-13 17:33 ` [PATCH/RFC v3 00/10] Volatile File Handle Client-side Support Matthew Treinish

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=1330979211-894-3-git-send-email-treinish@linux.vnet.ibm.com \
    --to=treinish@linux.vnet.ibm.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /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).