[RFC v4 9/9] NFS: Kill all client RPCs if transient

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When unmounting with the MNT_FORCE flag, all client RPCs will be killed
in all mount points if the mount is transient

Signed-off-by: Joshua Watt <JPEWhacker@xxxxxxxxx>
---
 fs/nfs/super.c | 40 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 09c413c098ef..f97cec1a1dec 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -904,6 +904,18 @@ kill_rpc(struct rpc_clnt *rpc)
 	}
 }
 
+static void
+kill_client_rpc(struct nfs_client *client)
+{
+	struct nfs_server *server;
+
+	kill_rpc(client->cl_rpcclient);
+	list_for_each_entry_rcu(server, &client->cl_superblocks, client_link) {
+		kill_rpc(server->client_acl);
+		kill_rpc(server->client);
+	}
+}
+
 /*
  * Begin unmount by attempting to remove all automounted mountpoints we added
  * in response to xdev traversals and referrals
@@ -914,8 +926,12 @@ void nfs_umount_begin(struct super_block *sb)
 
 	server = NFS_SB(sb);
 	/* -EIO all pending I/O */
-	kill_rpc(server->client_acl);
-	kill_rpc(server->client);
+	if (server->flags & NFS_MOUNT_TRANSIENT) {
+		kill_client_rpc(server->nfs_client);
+	} else {
+		kill_rpc(server->client_acl);
+		kill_rpc(server->client);
+	}
 }
 EXPORT_SYMBOL_GPL(nfs_umount_begin);
 
@@ -926,13 +942,29 @@ restore_rpc(struct rpc_clnt *rpc)
 		__atomic_add_unless(&rpc->cl_kill_new_tasks, -1, 0);
 }
 
+static void
+restore_client_rpc(struct nfs_client *client)
+{
+	struct nfs_server *server;
+
+	restore_rpc(client->cl_rpcclient);
+	list_for_each_entry_rcu(server, &client->cl_superblocks, client_link) {
+		restore_rpc(server->client_acl);
+		restore_rpc(server->client);
+	}
+}
+
 void
 nfs_umount_end(struct super_block *sb)
 {
 	struct nfs_server *server = NFS_SB(sb);
 
-	restore_rpc(server->client_acl);
-	restore_rpc(server->client);
+	if (server->flags & NFS_MOUNT_TRANSIENT) {
+		restore_client_rpc(server->nfs_client);
+	} else {
+		restore_rpc(server->client_acl);
+		restore_rpc(server->client);
+	}
 }
 EXPORT_SYMBOL_GPL(nfs_umount_end);
 
-- 
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux