38 lines
1.2 KiB
Diff
38 lines
1.2 KiB
Diff
From 34825fb2c891ee56fdde84000f0b1bc83a12f42f Mon Sep 17 00:00:00 2001
|
|
From: Ian Kent <raven@themaw.net>
|
|
Date: Mon, 22 Nov 2010 02:21:38 +0000
|
|
Subject: [PATCH 2/3] Btrfs - fix race between btrfs_get_sb() and umount
|
|
|
|
When mounting a btrfs file system btrfs_test_super() may attempt to
|
|
use sb->s_fs_info, the btrfs root, of a super block that is going away
|
|
and that has had the btrfs root set to NULL in its ->put_super(). But
|
|
if the super block is going away it cannot be an existing super block
|
|
so we can return false in this case.
|
|
|
|
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
Signed-off-by: Chris Mason <chris.mason@oracle.com>
|
|
---
|
|
fs/btrfs/super.c | 6 ++++++
|
|
1 files changed, 6 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
|
|
index 185702f..b169698 100644
|
|
--- a/fs/btrfs/super.c
|
|
+++ b/fs/btrfs/super.c
|
|
@@ -551,6 +551,12 @@ static int btrfs_test_super(struct super_block *s, void *data)
|
|
struct btrfs_fs_devices *test_fs_devices = data;
|
|
struct btrfs_root *root = btrfs_sb(s);
|
|
|
|
+ /*
|
|
+ * If this super block is going away, return false as it
|
|
+ * can't match as an existing super block.
|
|
+ */
|
|
+ if (!atomic_read(&s->s_active))
|
|
+ return 0;
|
|
return root->fs_info->fs_devices == test_fs_devices;
|
|
}
|
|
|
|
--
|
|
1.7.3.3
|
|
|