From mboxrd@z Thu Jan 1 00:00:00 1970 From: NeilBrown Subject: [PATCH 18/20] xfs: use RCU to free 'struct xfs_mount'. Date: Mon, 23 Mar 2015 13:37:40 +1100 Message-ID: <20150323023740.8161.39099.stgit@notabene.brown> References: <20150323023258.8161.32467.stgit@notabene.brown> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Al Viro Return-path: In-Reply-To: <20150323023258.8161.32467.stgit@notabene.brown> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 --- 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