btrfs-progs: check: drop exclusive open mode for --force
authorDavid Sterba <dsterba@suse.com>
Tue, 10 Oct 2017 12:53:32 +0000 (14:53 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 13 Oct 2017 18:15:43 +0000 (20:15 +0200)
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 <dsterba@suse.com>
cmds-check.c

index 0c08618..5c822b8 100644 (file)
@@ -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 */