From f371cc18f81168c74314b77480862b6c516e15d5 Mon Sep 17 00:00:00 2001 From: ixhamza <106930537+ixhamza@users.noreply.github.com> Date: Thu, 14 Jul 2022 22:38:16 +0500 Subject: [PATCH] Expose ZFS dataset case sensitivity setting via sb_opts Makes the case sensitivity setting visible on Linux in /proc/mounts. Reviewed-by: Ryan Moeller Reviewed-by: Alexander Motin Signed-off-by: Ameer Hamza Closes #13607 --- include/sys/mntent.h | 3 +++ lib/libzfs/os/linux/libzfs_mount_os.c | 7 +++++++ module/os/linux/zfs/zpl_super.c | 12 ++++++++++++ 3 files changed, 22 insertions(+) diff --git a/include/sys/mntent.h b/include/sys/mntent.h index d5e75daf0..5bb7e080c 100644 --- a/include/sys/mntent.h +++ b/include/sys/mntent.h @@ -108,5 +108,8 @@ #define MNTOPT_NOACL "noacl" /* likewise */ #define MNTOPT_POSIXACL "posixacl" /* likewise */ #define MNTOPT_MNTPOINT "mntpoint" /* mount point hint */ +#define MNTOPT_CASESENSITIVE "casesensitive" /* case sensitivity */ +#define MNTOPT_CASEINSENSITIVE "caseinsensitive" /* case insensitivity */ +#define MNTOPT_CASEMIXED "casemixed" /* case mixed */ #endif /* _SYS_MNTENT_H */ diff --git a/lib/libzfs/os/linux/libzfs_mount_os.c b/lib/libzfs/os/linux/libzfs_mount_os.c index 1718cf62a..f0bf3dcc6 100644 --- a/lib/libzfs/os/linux/libzfs_mount_os.c +++ b/lib/libzfs/os/linux/libzfs_mount_os.c @@ -84,6 +84,13 @@ static const option_map_t option_map[] = { { MNTOPT_ACL, MS_POSIXACL, ZS_COMMENT }, { MNTOPT_NOACL, MS_COMMENT, ZS_COMMENT }, { MNTOPT_POSIXACL, MS_POSIXACL, ZS_COMMENT }, + /* + * Case sensitive options are just listed here to silently + * ignore the error if passed with zfs mount command. + */ + { MNTOPT_CASESENSITIVE, MS_COMMENT, ZS_COMMENT }, + { MNTOPT_CASEINSENSITIVE, MS_COMMENT, ZS_COMMENT }, + { MNTOPT_CASEMIXED, MS_COMMENT, ZS_COMMENT }, #ifdef MS_NOATIME { MNTOPT_NOATIME, MS_NOATIME, ZS_COMMENT }, { MNTOPT_ATIME, MS_COMMENT, ZS_COMMENT }, diff --git a/module/os/linux/zfs/zpl_super.c b/module/os/linux/zfs/zpl_super.c index 88b01145c..cf879a289 100644 --- a/module/os/linux/zfs/zpl_super.c +++ b/module/os/linux/zfs/zpl_super.c @@ -233,6 +233,18 @@ __zpl_show_options(struct seq_file *seq, zfsvfs_t *zfsvfs) } #endif /* CONFIG_FS_POSIX_ACL */ + switch (zfsvfs->z_case) { + case ZFS_CASE_SENSITIVE: + seq_puts(seq, ",casesensitive"); + break; + case ZFS_CASE_INSENSITIVE: + seq_puts(seq, ",caseinsensitive"); + break; + default: + seq_puts(seq, ",casemixed"); + break; + } + return (0); }