From 0a694ff4b0bf37b6ade11184401420af002faffd Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 10 Oct 2017 14:53:32 +0200 Subject: [PATCH] btrfs-progs: check: drop exclusive open mode for --force The check opens the given device in exclusive by default. In the forced mode we want to access a device in use, so we have to drop the exclusivity bit. This works for block devices but not for files, that could be mounted via a loop device. In that respect test check/007 is broken and will be fixed. Signed-off-by: David Sterba --- cmds-check.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmds-check.c b/cmds-check.c index 0c08618e..5c822b84 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -13112,6 +13112,8 @@ int cmd_check(int argc, char **argv) warning( "filesystem mounted, continuing because of --force"); } + /* A block device is mounted in exclusive mode by kernel */ + ctree_flags &= ~OPEN_CTREE_EXCLUSIVE; } /* only allow partial opening under repair mode */