Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor xattr=sa dataset property #3788

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/mount_zfs/mount_zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ static const option_map_t option_map[] = {
{ MNTOPT_QUIET, MS_SILENT, ZS_COMMENT },
#endif
/* Custom zfs options */
{ MNTOPT_DIRXATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_SAXATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_XATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_NOXATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_ZFSUTIL, MS_COMMENT, ZS_ZFSUTIL },
Expand Down
2 changes: 2 additions & 0 deletions include/sys/mntent.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
#define MNTOPT_LOUD "loud" /* verbose mount */
#define MNTOPT_BIND "bind" /* remount part of a tree */
#define MNTOPT_RBIND "rbind" /* include subtrees */
#define MNTOPT_DIRXATTR "dirxattr" /* enable directory xattrs */
#define MNTOPT_SAXATTR "saxattr" /* enable system-attribute xattrs */
#define MNTOPT_XATTR "xattr" /* enable extended attributes */
#define MNTOPT_NOXATTR "noxattr" /* disable extended attributes */
#define MNTOPT_COMMENT "comment" /* comment */
Expand Down
2 changes: 1 addition & 1 deletion include/sys/zfs_vfsops.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct znode;
typedef struct zfs_mntopts {
char *z_osname; /* Objset name */
char *z_mntpoint; /* Primary mount point */
uint64_t z_xattr;
boolean_t z_readonly;
boolean_t z_do_readonly;
boolean_t z_setuid;
Expand All @@ -52,7 +53,6 @@ typedef struct zfs_mntopts {
boolean_t z_do_exec;
boolean_t z_devices;
boolean_t z_do_devices;
boolean_t z_xattr;
boolean_t z_do_xattr;
boolean_t z_atime;
boolean_t z_do_atime;
Expand Down
2 changes: 0 additions & 2 deletions lib/libzfs/libzfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ zfs_add_options(zfs_handle_t *zhp, char *options, int len)
ZFS_PROP_READONLY, MNTOPT_RO, MNTOPT_RW);
error = error ? error : zfs_add_option(zhp, options, len,
ZFS_PROP_SETUID, MNTOPT_SETUID, MNTOPT_NOSETUID);
error = error ? error : zfs_add_option(zhp, options, len,
ZFS_PROP_XATTR, MNTOPT_XATTR, MNTOPT_NOXATTR);
error = error ? error : zfs_add_option(zhp, options, len,
ZFS_PROP_NBMAND, MNTOPT_NBMAND, MNTOPT_NONBMAND);

Expand Down
14 changes: 11 additions & 3 deletions man/man8/mount.zfs.8
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ under that mountpoint.
This flag sets the SELinux context for the filesytem being mounted.
.TP
.BI "\-o defcontext"
This flag sets the SELinux context for unlabled files.
This flag sets the SELinux context for unlabeled files.
.TP
.BI "\-o rootcontext"
This flag sets the SELinux context for the root inode of the filesystem.
Expand All @@ -97,8 +97,16 @@ has an entry in the /etc/fstab file.
This private flag disables extended attributes.
.TP
.BI "\-o xattr
This private flag enables extended attributes and, if appropriate,
adds a ZFS context to the selinux system policy.
This private flag enables directory-based extended attributes and, if
appropriate, adds a ZFS context to the selinux system policy.
.TP
.BI "\-o saxattr
This private flag enables system attributed-based extended attributes and, if
appropriate, adds a ZFS context to the selinux system policy.
.TP
.BI "\-o dirxattr
Equivalent to
.BR xattr .
.TP
.BI "\-o zfsutil"
This private flag indicates that
Expand Down
16 changes: 14 additions & 2 deletions module/zfs/zpl_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ enum {
TOKEN_NOEXEC,
TOKEN_DEVICES,
TOKEN_NODEVICES,
TOKEN_DIRXATTR,
TOKEN_SAXATTR,
TOKEN_XATTR,
TOKEN_NOXATTR,
TOKEN_ATIME,
Expand All @@ -214,6 +216,8 @@ static const match_table_t zpl_tokens = {
{ TOKEN_NOEXEC, MNTOPT_NOEXEC },
{ TOKEN_DEVICES, MNTOPT_DEVICES },
{ TOKEN_NODEVICES, MNTOPT_NODEVICES },
{ TOKEN_DIRXATTR, MNTOPT_DIRXATTR },
{ TOKEN_SAXATTR, MNTOPT_SAXATTR },
{ TOKEN_XATTR, MNTOPT_XATTR },
{ TOKEN_NOXATTR, MNTOPT_NOXATTR },
{ TOKEN_ATIME, MNTOPT_ATIME },
Expand Down Expand Up @@ -263,12 +267,20 @@ zpl_parse_option(char *option, int token, substring_t *args,
zmo->z_devices = B_FALSE;
zmo->z_do_devices = B_TRUE;
break;
case TOKEN_DIRXATTR:
zmo->z_xattr = ZFS_XATTR_DIR;
zmo->z_do_xattr = B_TRUE;
break;
case TOKEN_SAXATTR:
zmo->z_xattr = ZFS_XATTR_SA;
zmo->z_do_xattr = B_TRUE;
break;
case TOKEN_XATTR:
zmo->z_xattr = B_TRUE;
zmo->z_xattr = ZFS_XATTR_DIR;
zmo->z_do_xattr = B_TRUE;
break;
case TOKEN_NOXATTR:
zmo->z_xattr = B_FALSE;
zmo->z_xattr = ZFS_XATTR_OFF;
zmo->z_do_xattr = B_TRUE;
break;
case TOKEN_ATIME:
Expand Down