summaryrefslogtreecommitdiff
path: root/fs/bcachefs/errcode.h
diff options
context:
space:
mode:
authorHongbo Li <lihongbo22@huawei.com>2024-02-19 20:24:32 +0800
committerKent Overstreet <kent.overstreet@linux.dev>2024-03-13 21:22:25 -0400
commit79162e829b5e5859409736b19daa2f6d2d1e0b59 (patch)
treea6032a336cdf9f3d166f0e5a24449ba3573cae6a /fs/bcachefs/errcode.h
parent2cce3752cec5a895030c8aa534cef3f493145a8e (diff)
bcachefs: fix the error code when mounting with incorrect options.
When mount with incorrect options such as: "mount -t bcachefs -o errors=back /dev/loop1 /mnt/bcachefs/". It rebacks the error "mount: /mnt/bcachefs: permission denied." cause bch2_parse_mount_opts returns -1 and bch2_mount throws it up. This is unreasonable. The real error message should be like this: "mount: /mnt/bcachefs: wrong fs type, bad option, bad superblock on /dev/loop1, missing codepage or helper program, or other error." Adding three private error codes for mounting error. Here are: - BCH_ERR_mount_option as the parent class for option error. - BCH_ERR_option_name represents the invalid option name. - BCH_ERR_option_value represents the invalid option value. Signed-off-by: Hongbo Li <lihongbo22@huawei.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/errcode.h')
-rw-r--r--fs/bcachefs/errcode.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/errcode.h b/fs/bcachefs/errcode.h
index e960a6eae66a..a8f1a3976305 100644
--- a/fs/bcachefs/errcode.h
+++ b/fs/bcachefs/errcode.h
@@ -5,6 +5,9 @@
#define BCH_ERRCODES() \
x(ERANGE, ERANGE_option_too_small) \
x(ERANGE, ERANGE_option_too_big) \
+ x(EINVAL, mount_option) \
+ x(BCH_ERR_mount_option, option_name) \
+ x(BCH_ERR_mount_option, option_value) \
x(ENOMEM, ENOMEM_stripe_buf) \
x(ENOMEM, ENOMEM_replicas_table) \
x(ENOMEM, ENOMEM_cpu_replicas) \