Skip to contentSkip to conversation

SQUASHME pnfs_submit: move unmount_pnfs_layoutdriver call

PATCH In review [email protected] 2 participants 2 messages May 11, 2010 – May 12, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SQUASHME pnfs_submit: move unmount_pnfs_layoutdriver call

From: Andy Adamson <[email protected]>

from nfs4_kill_super to nfs_free_server. Fixes a bug reported by Boaz Harrosh where the deviceid cache is not defererenced on super block creation error or for two mounts that share a super block.

---
 fs/nfs/client.c |    9 +++++++++
 fs/nfs/super.c  |    3 ---
 2 files changed, 9 insertions(+), 3 deletions(-)
fs/nfs/client.c +9 -0
index 56f3d50..0337330 100644
@@ -884,6 +884,14 @@ static void nfs4_init_pnfs(struct nfs_server *server, struct nfs_fsinfo *fsinfo)
 #endif /* CONFIG_NFS_V4_1 */
 }
 
+static void nfs4_uninit_pnfs(struct nfs_server *server)
+{
+#if defined(CONFIG_NFS_V4_1)
+	if (nfs4_has_session(server->nfs_client))
+		unmount_pnfs_layoutdriver(server);
+#endif /* CONFIG_NFS_V4_1 */
+}
+
 /*
  * Load up the server record from information gained in an fsinfo record
  */
@@ -1039,6 +1047,7 @@ void nfs_free_server(struct nfs_server *server)
 {
 	dprintk("--> nfs_free_server()\n");
 
+	nfs4_uninit_pnfs(server);
 	spin_lock(&nfs_client_lock);
 	list_del(&server->client_link);
 	list_del(&server->master_link);
fs/nfs/super.c +0 -3
index 5fc60cf..7822187 100644
@@ -2799,9 +2799,6 @@ static void nfs4_kill_super(struct super_block *sb)
 	dprintk("--> %s\n", __func__);
 	nfs_super_return_all_delegations(sb);
 	kill_anon_super(sb);
-#ifdef CONFIG_NFS_V4_1
-	unmount_pnfs_layoutdriver(server);
-#endif
 	nfs_fscache_release_super_cookie(sb);
 	nfs_free_server(server);
 	dprintk("<-- %s\n", __func__);
Signature · 1 line
1.6.6
#1 lore raw
Quoted 5 lines · On 2010-05-12 01:24, [email protected] wrote:

From: Andy Adamson <[email protected]>

from nfs4_kill_super to nfs_free_server. Fixes a bug reported by Boaz Harrosh where the deviceid cache is not defererenced on super block creation error or for two mounts that share a super block.

Looks good to me.
Thanks!

Benny

Quoted 48 lines
---
 fs/nfs/client.c |    9 +++++++++
 fs/nfs/super.c  |    3 ---
 2 files changed, 9 insertions(+), 3 deletions(-)
fs/nfs/client.c +9 -0
index 56f3d50..0337330 100644
@@ -884,6 +884,14 @@ static void nfs4_init_pnfs(struct nfs_server *server, struct nfs_fsinfo *fsinfo)
 #endif /* CONFIG_NFS_V4_1 */
 }
 
+static void nfs4_uninit_pnfs(struct nfs_server *server)
+{
+#if defined(CONFIG_NFS_V4_1)
+	if (nfs4_has_session(server->nfs_client))
+		unmount_pnfs_layoutdriver(server);
+#endif /* CONFIG_NFS_V4_1 */
+}
+
 /*
  * Load up the server record from information gained in an fsinfo record
  */
@@ -1039,6 +1047,7 @@ void nfs_free_server(struct nfs_server *server)
 {
 	dprintk("--> nfs_free_server()\n");
 
+	nfs4_uninit_pnfs(server);
 	spin_lock(&nfs_client_lock);
 	list_del(&server->client_link);
 	list_del(&server->master_link);
fs/nfs/super.c +0 -3
index 5fc60cf..7822187 100644
@@ -2799,9 +2799,6 @@ static void nfs4_kill_super(struct super_block *sb)
 	dprintk("--> %s\n", __func__);
 	nfs_super_return_all_delegations(sb);
 	kill_anon_super(sb);
-#ifdef CONFIG_NFS_V4_1
-	unmount_pnfs_layoutdriver(server);
-#endif
 	nfs_fscache_release_super_cookie(sb);
 	nfs_free_server(server);
 	dprintk("<-- %s\n", __func__);