lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <153365634503.19074.14972123229522734895.stgit@localhost.localdomain>
Date:   Tue, 07 Aug 2018 18:39:05 +0300
From:   Kirill Tkhai <ktkhai@...tuozzo.com>
To:     akpm@...ux-foundation.org, gregkh@...uxfoundation.org,
        rafael@...nel.org, viro@...iv.linux.org.uk,
        darrick.wong@...cle.com, paulmck@...ux.vnet.ibm.com,
        josh@...htriplett.org, rostedt@...dmis.org,
        mathieu.desnoyers@...icios.com, jiangshanlai@...il.com,
        hughd@...gle.com, shuah@...nel.org, robh@...nel.org,
        ulf.hansson@...aro.org, aspriel@...il.com,
        vivek.gautam@...eaurora.org, robin.murphy@....com, joe@...ches.com,
        heikki.krogerus@...ux.intel.com, ktkhai@...tuozzo.com,
        sfr@...b.auug.org.au, vdavydov.dev@...il.com, mhocko@...e.com,
        chris@...is-wilson.co.uk, penguin-kernel@...ove.SAKURA.ne.jp,
        aryabinin@...tuozzo.com, willy@...radead.org, ying.huang@...el.com,
        shakeelb@...gle.com, jbacik@...com, mingo@...nel.org,
        mhiramat@...nel.org, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-mm@...ck.org
Subject: [PATCH RFC 08/10] xfs: Introduce xfs_fs_destroy_super()

xfs_fs_nr_cached_objects() touches sb->s_fs_info,
and this patch makes it to be destructed later.

After this patch xfs_fs_nr_cached_objects() is safe
for splitting unregister_shrinker(): mp->m_perag_tree
is stable till destroy_super_work(), while iteration
over it is already RCU-protected by internal XFS
business.

Signed-off-by: Kirill Tkhai <ktkhai@...tuozzo.com>
---
 fs/xfs/xfs_super.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 9e2ce4cd98e1..c1e00dd06893 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1774,11 +1774,20 @@ xfs_fs_put_super(
 	xfs_destroy_mount_workqueues(mp);
 	xfs_close_devices(mp);
 
-	sb->s_fs_info = NULL;
 	xfs_free_fsname(mp);
-	kfree(mp);
 }
 
+STATIC void
+xfs_fs_destroy_super(
+	struct super_block	*sb)
+{
+	if (sb->s_fs_info) {
+		kfree(sb->s_fs_info);
+		sb->s_fs_info = NULL;
+	}
+}
+
+
 STATIC struct dentry *
 xfs_fs_mount(
 	struct file_system_type	*fs_type,
@@ -1816,6 +1825,7 @@ static const struct super_operations xfs_super_operations = {
 	.dirty_inode		= xfs_fs_dirty_inode,
 	.drop_inode		= xfs_fs_drop_inode,
 	.put_super		= xfs_fs_put_super,
+	.destroy_super		= xfs_fs_destroy_super,
 	.sync_fs		= xfs_fs_sync_fs,
 	.freeze_fs		= xfs_fs_freeze,
 	.unfreeze_fs		= xfs_fs_unfreeze,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ