From fa0a54c45c44e8ff3885ccc72a43fd2d96e01b14 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Wed, 21 May 2025 21:41:00 -0400 Subject: cmd_dump: Don't use noexcl by default This has been leading to too many people taking metadata dumps of rw mounted filesystems. Signed-off-by: Kent Overstreet --- c_src/cmd_dump.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'c_src/cmd_dump.c') diff --git a/c_src/cmd_dump.c b/c_src/cmd_dump.c index c6b813e9..eb338858 100644 --- a/c_src/cmd_dump.c +++ b/c_src/cmd_dump.c @@ -23,10 +23,11 @@ static void dump_usage(void) "Usage: bcachefs dump [OPTION]... \n" "\n" "Options:\n" - " -o output Output qcow2 image(s)\n" - " -f, --force Force; overwrite when needed\n" - " --nojournal Don't dump entire journal, just dirty entries\n" - " -h, --help Display this help and exit\n" + " -o output Output qcow2 image(s)\n" + " -f, --force Force; overwrite when needed\n" + " --nojournal Don't dump entire journal, just dirty entries\n" + " --noexcl Open devices with O_NOEXCL (not recommended)\n" + " -h, --help Display this help and exit\n" "Report bugs to "); } @@ -101,6 +102,7 @@ int cmd_dump(int argc, char *argv[]) static const struct option longopts[] = { { "force", no_argument, NULL, 'f' }, { "nojournal", no_argument, NULL, 'j' }, + { "noexcl", no_argument, NULL, 'e' }, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { NULL } @@ -112,7 +114,6 @@ int cmd_dump(int argc, char *argv[]) int fd, opt; opt_set(opts, direct_io, false); - opt_set(opts, noexcl, true); opt_set(opts, read_only, true); opt_set(opts, nochanges, true); opt_set(opts, norecovery, true); @@ -132,6 +133,9 @@ int cmd_dump(int argc, char *argv[]) case 'j': entire_journal = false; break; + case 'e': + opt_set(opts, noexcl, true); + break; case 'v': opt_set(opts, verbose, true); break; -- cgit v1.2.3