Skip to contentSkip to conversation

bcachefs: reject unknown mount options

PATCH RESEND In review David Disseldorp 4 participants 6 messages Sep 17, 2024 – Oct 10, 2024

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 bcachefs: reject unknown mount options

This is effectively a revert of commit 03ef80b469d5 ("bcachefs: Ignore unknown mount options"), rebased atop commit 929d954330142 ("bcachefs:
use new mount API").

Contrary to the 03ef80b469d5 commit message, unknown mount options do result in failure on other filesystems such as xfs, btrfs, ext4, etc.

Ignoring unknown options may result in unexpected behaviour: e.g. if an application requires future-workload-specific-mount-option to work and is run on a system without future-workload-specific-mount-option kernel support, then it may fail without indication of the missing kernel functionality.

This reversion may cause failures for existing users reliant on the ignore-unknown behaviour, but it should be bearable given bcachefs is still flagged experimental.

Fixes 03ef80b469d5 ("bcachefs: Ignore unknown mount options")
---
 fs/bcachefs/opts.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/bcachefs/opts.c +1 -2
index e10fc1da71b19..bc5c180878212 100644
@@ -482,9 +482,8 @@ int bch2_parse_one_mount_opt(struct bch_fs *c, struct bch_opts *opts,
 		val = "0";
 	}
 
-	/* Unknown options are ignored: */
 	if (id < 0)
-		return 0;
+		goto bad_opt;
 
 	if (!(bch2_opt_table[id].flags & OPT_MOUNT))
 		goto bad_opt;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 17 lines · David Disseldorp

This is effectively a revert of commit 03ef80b469d5 ("bcachefs: Ignore unknown mount options"), rebased atop commit 929d954330142 ("bcachefs:
use new mount API").

Contrary to the 03ef80b469d5 commit message, unknown mount options do result in failure on other filesystems such as xfs, btrfs, ext4, etc.

Ignoring unknown options may result in unexpected behaviour: e.g. if an application requires future-workload-specific-mount-option to work and is run on a system without future-workload-specific-mount-option kernel support, then it may fail without indication of the missing kernel functionality.

This reversion may cause failures for existing users reliant on the ignore-unknown behaviour, but it should be bearable given bcachefs is still flagged experimental.

Quoted 5 lines
Fixes 03ef80b469d5 ("bcachefs: Ignore unknown mount options")

I applied this and got some new failures in the CI - it seems something is broken in remount.

00162 ========= TEST ec_small
00162
00162 WATCHDOG 60
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): starting version 1.12: rebalance_work_acct_fix opts=errors=panic,metadata_replicas=2,data_replicas=2,erasure_code 00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): initializing new filesystem
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): going read-write
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): marking superblocks
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): initializing freespace
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): done initializing freespace
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): reading snapshots table
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): reading snapshots done
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): done starting filesystem
00163 1+0 records in
00163 1+0 records out
00163 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0115145 s, 91.1 MB/s
00163 bcachefs: bch2_parse_one_mount_opt() Bad mount option rwerrors
00163 Error: Invalid argument
00163 Error 1 at /host//home/testdashboard/ktest/tests/fs/bcachefs/ec.ktest 32 from: mount -o remount,ro /mnt, exiting
00163 Error 1 at /host/home/testdashboard/ktest/tests/prelude.sh 269 from: ( set -e; run_test $i ), exiting
00163
00163 ========= FAILED ec_small in 2s

The test is just doing
mount -o remount,ro /mnt

Thomas, this is likely something you introduced, think you could take a look?

#2 lore raw
Quoted 2 lines · Kent Overstreet

I applied this and got some new failures in the CI - it seems something is broken in remount.

...

Quoted 7 lines

00163 bcachefs: bch2_parse_one_mount_opt() Bad mount option rwerrors
00163 Error: Invalid argument
00163 Error 1 at /host//home/testdashboard/ktest/tests/fs/bcachefs/ec.ktest 32 from: mount -o remount,ro /mnt, exiting 00163 Error 1 at /host/home/testdashboard/ktest/tests/prelude.sh 269 from: ( set -e; run_test $i ), exiting 00163
00163 ========= FAILED ec_small in 2s

Quoted 5 lines

The test is just doing
mount -o remount,ro /mnt

Thomas, this is likely something you introduced, think you could take a look?

Thanks for the details. "mount -o remount,ro <mnt>" works fine for me, and I'm not aware of anything that could be providing the "rwerrors" parameter. Which version of mount / util-linux is used here?

#3 lore raw
Quoted 12 lines · David Disseldorp
Quoted 2 lines · Kent Overstreet

I applied this and got some new failures in the CI - it seems something is broken in remount.

...

Quoted 7 lines

00163 bcachefs: bch2_parse_one_mount_opt() Bad mount option rwerrors
00163 Error: Invalid argument
00163 Error 1 at /host//home/testdashboard/ktest/tests/fs/bcachefs/ec.ktest 32 from: mount -o remount,ro /mnt, exiting 00163 Error 1 at /host/home/testdashboard/ktest/tests/prelude.sh 269 from: ( set -e; run_test $i ), exiting 00163
00163 ========= FAILED ec_small in 2s

Quoted 8 lines
Quoted 5 lines

The test is just doing
mount -o remount,ro /mnt

Thomas, this is likely something you introduced, think you could take a look?

Thanks for the details. "mount -o remount,ro <mnt>" works fine for me, and I'm not aware of anything that could be providing the "rwerrors"

It seems rw, errors=xxx which misses a comma.

Quoted 1 line

parameter. Which version of mount / util-linux is used here?

#4 lore raw
In reply to Kent Overstreet
Quoted 49 lines · Kent Overstreet
Quoted 17 lines · David Disseldorp

This is effectively a revert of commit 03ef80b469d5 ("bcachefs: Ignore unknown mount options"), rebased atop commit 929d954330142 ("bcachefs:
use new mount API").

Contrary to the 03ef80b469d5 commit message, unknown mount options do result in failure on other filesystems such as xfs, btrfs, ext4, etc.

Ignoring unknown options may result in unexpected behaviour: e.g. if an application requires future-workload-specific-mount-option to work and is run on a system without future-workload-specific-mount-option kernel support, then it may fail without indication of the missing kernel functionality.

This reversion may cause failures for existing users reliant on the ignore-unknown behaviour, but it should be bearable given bcachefs is still flagged experimental.

Quoted 5 lines
Fixes 03ef80b469d5 ("bcachefs: Ignore unknown mount options")

I applied this and got some new failures in the CI - it seems something is broken in remount.

00162 ========= TEST ec_small
00162
00162 WATCHDOG 60
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): starting version 1.12: rebalance_work_acct_fix opts=errors=panic,metadata_replicas=2,data_replicas=2,erasure_code 00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): initializing new filesystem
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): going read-write
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): marking superblocks
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): initializing freespace
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): done initializing freespace
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): reading snapshots table
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): reading snapshots done
00163 bcachefs (857683e6-ef4f-41f5-abdd-dca191c38fff): done starting filesystem
00163 1+0 records in
00163 1+0 records out
00163 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0115145 s, 91.1 MB/s
00163 bcachefs: bch2_parse_one_mount_opt() Bad mount option rwerrors
00163 Error: Invalid argument
00163 Error 1 at /host//home/testdashboard/ktest/tests/fs/bcachefs/ec.ktest 32 from: mount -o remount,ro /mnt, exiting
00163 Error 1 at /host/home/testdashboard/ktest/tests/prelude.sh 269 from: ( set -e; run_test $i ), exiting
00163
00163 ========= FAILED ec_small in 2s

Quoted 2 lines

The test is just doing
mount -o remount,ro /mnt

ah, this is indeed a bug in show_options. It misses a comma when fill options buffer to seq. The following code should be added.

fs/bcachefs/fs.c +1 -1
index e774cb3e6b1a..79c3a650b714 100644
@@ -1927,7 +1927,7 @@ static int bch2_show_options(struct seq_file *seq, struct dentry *root)
 	bch2_opts_to_text(&buf, c->opts, c, c->disk_sb.sb,
 			  OPT_MOUNT, OPT_HIDDEN, OPT_SHOW_MOUNT_STYLE);
 	printbuf_nul_terminate(&buf);
-	seq_puts(seq, buf.buf);
+	seq_printf(seq, ",%s", buf.buf);
 
 	int ret = buf.allocation_failure ? -ENOMEM : 0;
 	printbuf_exit(&buf);

I will send this later. The test passed in my environment with this v2 patch.

Thanks,
Hongbo

Quoted 3 lines

Thomas, this is likely something you introduced, think you could take a look?

#5 lore raw
In reply to David Disseldorp

Op 17/09/2024 om 03:39 schreef David Disseldorp:

Quoted 31 lines

This is effectively a revert of commit 03ef80b469d5 ("bcachefs: Ignore unknown mount options"), rebased atop commit 929d954330142 ("bcachefs:
use new mount API").

Contrary to the 03ef80b469d5 commit message, unknown mount options do result in failure on other filesystems such as xfs, btrfs, ext4, etc.

Ignoring unknown options may result in unexpected behaviour: e.g. if an application requires future-workload-specific-mount-option to work and is run on a system without future-workload-specific-mount-option kernel support, then it may fail without indication of the missing kernel functionality.

This reversion may cause failures for existing users reliant on the ignore-unknown behaviour, but it should be bearable given bcachefs is still flagged experimental.

Fixes 03ef80b469d5 ("bcachefs: Ignore unknown mount options")
---
  fs/bcachefs/opts.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
fs/bcachefs/opts.c +0 -0
index e10fc1da71b19..bc5c180878212 100644

fs/bcachefs/opts.c int bch2_parse_one_mount_opt(struct bch_fs *c, struct bch_opts *opts, · line 489

Quoted 10 lines
fs/bcachefs/opts.c +1 -2
@@ -482,9 +482,8 @@ int bch2_parse_one_mount_opt(struct bch_fs *c, struct bch_opts *opts,
  		val = "0";
  	}
 
-	/* Unknown options are ignored: */
  	if (id < 0)
-		return 0;
+		goto bad_opt;
 
  	if (!(bch2_opt_table[id].flags & OPT_MOUNT))
  		goto bad_opt;

Testing this patch caused my bcachefs mount command to fail:
the "user" and "nofail" attributes in /etc/fstab are not recognised.
I'd love the "nofail" attribute on a "experimental" filesystem. IMO it is even a soft requirement

Janpieter Sollie