summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>2016-06-13 05:39:58 +0200
committerDavid Sterba <dsterba@suse.com>2016-06-17 18:32:40 +0200
commit90c711ab380d633bf85249bd5d819edb601feda7 (patch)
tree556934ae4488ebae6490610894bbfe92bd405478 /fs/btrfs/super.c
parentBtrfs: don't BUG_ON() in btrfs_orphan_add (diff)
downloadlinux-90c711ab380d633bf85249bd5d819edb601feda7.tar.xz
linux-90c711ab380d633bf85249bd5d819edb601feda7.zip
btrfs: avoid blocking open_ctree from cleaner_kthread
This fixes a problem introduced in commit 2f3165ecf103599f82bf0ea254039db335fb5005 "btrfs: don't force mounts to wait for cleaner_kthread to delete one or more subvolumes". open_ctree eventually calls btrfs_replay_log which in turn calls btrfs_commit_super which tries to lock the cleaner_mutex, causing a recursive mutex deadlock during mount. Instead of playing whack-a-mole trying to keep up with all the functions that may want to lock cleaner_mutex, put all the cleaner_mutex lockers back where they were, and attack the problem more directly: keep cleaner_kthread asleep until the filesystem is mounted. When filesystems are mounted read-only and later remounted read-write, open_ctree did not set fs_info->open and neither does anything else. Set this flag in btrfs_remount so that neither btrfs_delete_unused_bgs nor cleaner_kthread get confused by the common case of "/" filesystem read-only mount followed by read-write remount. Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index bf70d33b5791..60e7179ed4b7 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1807,6 +1807,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
}
}
sb->s_flags &= ~MS_RDONLY;
+
+ fs_info->open = 1;
}
out:
wake_up_process(fs_info->transaction_kthread);