[PATCH 18/20] xfs: use RCU to free 'struct xfs_mount'.

NeilBrown
2015-03-23T02:39:51Z

In order for ->follow_link to be safe in RCU-walk, any
data structures accessed need to be freed after
an RCU grace period.

'struct xfs_mount' is not currently guaranteed to be delayed
sufficiently, so use kfree_rcu() to free it.

Signed-off-by: NeilBrown <neilb@suse.de>
---
fs/xfs/xfs_mount.h | 2 ++
fs/xfs/xfs_super.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 0d8abd6364d9..6a1094e493e9 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -185,6 +185,8 @@ typedef struct xfs_mount {
* to various other kinds of pain inflicted on the pNFS server.
*/
__uint32_t m_generation;
+
+ struct rcu_head m_rcu;
} xfs_mount_t;

/*
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 8fcc4ccc5c79..3827be14383c 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1047,7 +1047,7 @@ xfs_fs_put_super(
xfs_destroy_mount_workqueues(mp);
xfs_close_devices(mp);
xfs_free_fsname(mp);
- kfree(mp);
+ kfree_rcu(mp, m_rcu);
}

STATIC int