From patchwork Mon May 9 19:37:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever III X-Patchwork-Id: 770422 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p49JbbrT010308 for ; Mon, 9 May 2011 19:37:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754225Ab1EITh1 (ORCPT ); Mon, 9 May 2011 15:37:27 -0400 Received: from mail-gx0-f174.google.com ([209.85.161.174]:49509 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754223Ab1EIThW (ORCPT ); Mon, 9 May 2011 15:37:22 -0400 Received: by gxk21 with SMTP id 21so1941561gxk.19 for ; Mon, 09 May 2011 12:37:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:subject:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=oujJkwDfgnbsGVV5Xo4Ee/aG60GMA5utW4AOYbkWCf8=; b=IfFl3GR1osnyuN2vM41tgzfiSJaE549HseL/dN0wQ36ZBSMp4JVh9El09j/DFxVA6I 9pVA5QYldnrQtq5E+S2sRHQ6l+KtiE2KNV8r1jCvpZx0TgplJN0hsRDJ1LWG/tFAj5xr jFAQkj/sRhSpqz8rTr48SKQF8penV9tIuZ7fs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=NWXvvCLOeyIyiAxuHpdeFJjob2uOwBMoVXzHYghecoMK6N9WEmxlbpekdyA22GJDaT ehPzKIuZVD4UwJGkt2jO4ZjjzOxYNjzVMLEKdKidwwOZ268cFHKZFl3k6DXHKkziGSeu Dxlnkei6x2+mXQRuvaQHwPTFEGjYZRZuhWvWg= Received: by 10.147.135.41 with SMTP id m41mr2856846yan.10.1304969842234; Mon, 09 May 2011 12:37:22 -0700 (PDT) Received: from matisse.1015granger.net (adsl-99-26-161-222.dsl.sfldmi.sbcglobal.net [99.26.161.222]) by mx.google.com with ESMTPS id d20sm6634280ang.43.2011.05.09.12.37.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 12:37:21 -0700 (PDT) From: Chuck Lever Subject: [PATCH 07/16] NFS: Save root file handle in nfs_server To: trond.myklebust@netapp.com Cc: linux-nfs@vger.kernel.org Date: Mon, 09 May 2011 15:37:19 -0400 Message-ID: <20110509193719.16568.95993.stgit@matisse.1015granger.net> In-Reply-To: <20110509192522.16568.59082.stgit@matisse.1015granger.net> References: <20110509192522.16568.59082.stgit@matisse.1015granger.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 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 (demeter1.kernel.org [140.211.167.41]); Mon, 09 May 2011 19:37:37 +0000 (UTC) Save each FSID's root directory file handle in the export's local nfs_server structure on the client. This file handle can later be used for migration recovery. NB: Saving the root FH is done only for NFSv4 mounts. Signed-off-by: Chuck Lever --- fs/nfs/client.c | 1 + fs/nfs/getroot.c | 5 +++++ include/linux/nfs_fs_sb.h | 1 + 3 files changed, 7 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/client.c b/fs/nfs/client.c index b55ef58..bf40649 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -1101,6 +1101,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..8d4fbe1 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -232,6 +232,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 87694ca..aa3a912 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -151,6 +151,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 */