1 // SPDX-License-Identifier: GPL-2.0-only
4 #include <linux/module.h>
5 #include <linux/namei.h>
6 #include <linux/fs_context.h>
7 #include <linux/fs_parser.h>
8 #include <linux/posix_acl_xattr.h>
9 #include <linux/seq_file.h>
10 #include <linux/xattr.h>
11 #include "overlayfs.h"
14 static bool ovl_redirect_dir_def = IS_ENABLED(CONFIG_OVERLAY_FS_REDIRECT_DIR);
15 module_param_named(redirect_dir, ovl_redirect_dir_def, bool, 0644);
16 MODULE_PARM_DESC(redirect_dir,
17 "Default to on or off for the redirect_dir feature");
19 static bool ovl_redirect_always_follow =
20 IS_ENABLED(CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW);
21 module_param_named(redirect_always_follow, ovl_redirect_always_follow,
23 MODULE_PARM_DESC(redirect_always_follow,
24 "Follow redirects even if redirect_dir feature is turned off");
26 static bool ovl_xino_auto_def = IS_ENABLED(CONFIG_OVERLAY_FS_XINO_AUTO);
27 module_param_named(xino_auto, ovl_xino_auto_def, bool, 0644);
28 MODULE_PARM_DESC(xino_auto,
29 "Auto enable xino feature");
31 static bool ovl_index_def = IS_ENABLED(CONFIG_OVERLAY_FS_INDEX);
32 module_param_named(index, ovl_index_def, bool, 0644);
33 MODULE_PARM_DESC(index,
34 "Default to on or off for the inodes index feature");
36 static bool ovl_nfs_export_def = IS_ENABLED(CONFIG_OVERLAY_FS_NFS_EXPORT);
37 module_param_named(nfs_export, ovl_nfs_export_def, bool, 0644);
38 MODULE_PARM_DESC(nfs_export,
39 "Default to on or off for the NFS export feature");
41 static bool ovl_metacopy_def = IS_ENABLED(CONFIG_OVERLAY_FS_METACOPY);
42 module_param_named(metacopy, ovl_metacopy_def, bool, 0644);
43 MODULE_PARM_DESC(metacopy,
44 "Default to on or off for the metadata only copy up feature");
52 Opt_default_permissions,
64 static const struct constant_table ovl_parameter_bool[] = {
70 static const struct constant_table ovl_parameter_uuid[] = {
71 { "off", OVL_UUID_OFF },
72 { "null", OVL_UUID_NULL },
73 { "auto", OVL_UUID_AUTO },
74 { "on", OVL_UUID_ON },
78 static const char *ovl_uuid_mode(struct ovl_config *config)
80 return ovl_parameter_uuid[config->uuid].name;
83 static int ovl_uuid_def(void)
88 static const struct constant_table ovl_parameter_xino[] = {
89 { "off", OVL_XINO_OFF },
90 { "auto", OVL_XINO_AUTO },
91 { "on", OVL_XINO_ON },
95 const char *ovl_xino_mode(struct ovl_config *config)
97 return ovl_parameter_xino[config->xino].name;
100 static int ovl_xino_def(void)
102 return ovl_xino_auto_def ? OVL_XINO_AUTO : OVL_XINO_OFF;
105 const struct constant_table ovl_parameter_redirect_dir[] = {
106 { "off", OVL_REDIRECT_OFF },
107 { "follow", OVL_REDIRECT_FOLLOW },
108 { "nofollow", OVL_REDIRECT_NOFOLLOW },
109 { "on", OVL_REDIRECT_ON },
113 static const char *ovl_redirect_mode(struct ovl_config *config)
115 return ovl_parameter_redirect_dir[config->redirect_mode].name;
118 static int ovl_redirect_mode_def(void)
120 return ovl_redirect_dir_def ? OVL_REDIRECT_ON :
121 ovl_redirect_always_follow ? OVL_REDIRECT_FOLLOW :
122 OVL_REDIRECT_NOFOLLOW;
125 static const struct constant_table ovl_parameter_verity[] = {
126 { "off", OVL_VERITY_OFF },
127 { "on", OVL_VERITY_ON },
128 { "require", OVL_VERITY_REQUIRE },
132 static const char *ovl_verity_mode(struct ovl_config *config)
134 return ovl_parameter_verity[config->verity_mode].name;
137 static int ovl_verity_mode_def(void)
139 return OVL_VERITY_OFF;
142 #define fsparam_string_empty(NAME, OPT) \
143 __fsparam(fs_param_is_string, NAME, OPT, fs_param_can_be_empty, NULL)
146 const struct fs_parameter_spec ovl_parameter_spec[] = {
147 fsparam_string_empty("lowerdir", Opt_lowerdir),
148 fsparam_string("lowerdir+", Opt_lowerdir_add),
149 fsparam_string("datadir+", Opt_datadir_add),
150 fsparam_string("upperdir", Opt_upperdir),
151 fsparam_string("workdir", Opt_workdir),
152 fsparam_flag("default_permissions", Opt_default_permissions),
153 fsparam_enum("redirect_dir", Opt_redirect_dir, ovl_parameter_redirect_dir),
154 fsparam_enum("index", Opt_index, ovl_parameter_bool),
155 fsparam_enum("uuid", Opt_uuid, ovl_parameter_uuid),
156 fsparam_enum("nfs_export", Opt_nfs_export, ovl_parameter_bool),
157 fsparam_flag("userxattr", Opt_userxattr),
158 fsparam_enum("xino", Opt_xino, ovl_parameter_xino),
159 fsparam_enum("metacopy", Opt_metacopy, ovl_parameter_bool),
160 fsparam_enum("verity", Opt_verity, ovl_parameter_verity),
161 fsparam_flag("volatile", Opt_volatile),
165 static char *ovl_next_opt(char **s)
173 for (p = sbegin; *p; p++) {
178 } else if (*p == ',') {
188 static int ovl_parse_monolithic(struct fs_context *fc, void *data)
190 return vfs_parse_monolithic_sep(fc, data, ovl_next_opt);
193 static ssize_t ovl_parse_param_split_lowerdirs(char *str)
195 ssize_t nr_layers = 1, nr_colons = 0;
198 for (s = d = str;; s++, d++) {
200 /* keep esc chars in split lowerdir */
202 } else if (*s == ':') {
203 bool next_colon = (*(s + 1) == ':');
206 if (nr_colons == 2 && next_colon) {
207 pr_err("only single ':' or double '::' sequences of unescaped colons in lowerdir mount option allowed.\n");
210 /* count layers, not colons */
220 /* trailing colons */
222 pr_err("unescaped trailing colons in lowerdir mount option.\n");
233 static int ovl_mount_dir_noesc(const char *name, struct path *path)
238 pr_err("empty lowerdir\n");
241 err = kern_path(name, LOOKUP_FOLLOW, path);
243 pr_err("failed to resolve '%s': %i\n", name, err);
252 static void ovl_unescape(char *s)
265 static int ovl_mount_dir(const char *name, struct path *path)
268 char *tmp = kstrdup(name, GFP_KERNEL);
272 err = ovl_mount_dir_noesc(tmp, path);
278 static int ovl_mount_dir_check(struct fs_context *fc, const struct path *path,
279 enum ovl_opt layer, const char *name, bool upper)
281 struct ovl_fs_context *ctx = fc->fs_private;
283 if (ovl_dentry_weird(path->dentry))
284 return invalfc(fc, "filesystem on %s not supported", name);
286 if (!d_is_dir(path->dentry))
287 return invalfc(fc, "%s is not a directory", name);
291 * Check whether upper path is read-only here to report failures
292 * early. Don't forget to recheck when the superblock is created
293 * as the mount attributes could change.
296 if (path->dentry->d_flags & DCACHE_OP_REAL)
297 return invalfc(fc, "filesystem on %s not supported as upperdir", name);
298 if (__mnt_is_readonly(path->mnt))
299 return invalfc(fc, "filesystem on %s is read-only", name);
301 if (ctx->lowerdir_all && layer != Opt_lowerdir)
302 return invalfc(fc, "lowerdir+ and datadir+ cannot follow lowerdir");
303 if (ctx->nr_data && layer == Opt_lowerdir_add)
304 return invalfc(fc, "regular lower layers cannot follow data layers");
305 if (ctx->nr == OVL_MAX_STACK)
306 return invalfc(fc, "too many lower directories, limit is %d",
312 static int ovl_ctx_realloc_lower(struct fs_context *fc)
314 struct ovl_fs_context *ctx = fc->fs_private;
315 struct ovl_fs_context_layer *l;
318 if (ctx->nr < ctx->capacity)
321 nr = min_t(size_t, max(4096 / sizeof(*l), ctx->capacity * 2),
323 l = krealloc_array(ctx->lower, nr, sizeof(*l), GFP_KERNEL_ACCOUNT);
332 static void ovl_add_layer(struct fs_context *fc, enum ovl_opt layer,
333 struct path *path, char **pname)
335 struct ovl_fs *ofs = fc->s_fs_info;
336 struct ovl_config *config = &ofs->config;
337 struct ovl_fs_context *ctx = fc->fs_private;
338 struct ovl_fs_context_layer *l;
342 swap(config->workdir, *pname);
343 swap(ctx->work, *path);
346 swap(config->upperdir, *pname);
347 swap(ctx->upper, *path);
349 case Opt_datadir_add:
352 case Opt_lowerdir_add:
353 WARN_ON(ctx->nr >= ctx->capacity);
354 l = &ctx->lower[ctx->nr++];
355 memset(l, 0, sizeof(*l));
356 swap(l->name, *pname);
357 swap(l->path, *path);
364 static int ovl_parse_layer(struct fs_context *fc, struct fs_parameter *param,
367 char *name = kstrdup(param->string, GFP_KERNEL);
368 bool upper = (layer == Opt_upperdir || layer == Opt_workdir);
376 err = ovl_mount_dir(name, &path);
378 err = ovl_mount_dir_noesc(name, &path);
382 err = ovl_mount_dir_check(fc, &path, layer, name, upper);
387 err = ovl_ctx_realloc_lower(fc);
392 /* Store the user provided path string in ctx to show in mountinfo */
393 ovl_add_layer(fc, layer, &path, &name);
402 static void ovl_reset_lowerdirs(struct ovl_fs_context *ctx)
404 struct ovl_fs_context_layer *l = ctx->lower;
406 // Reset old user provided lowerdir string
407 kfree(ctx->lowerdir_all);
408 ctx->lowerdir_all = NULL;
410 for (size_t nr = 0; nr < ctx->nr; nr++, l++) {
420 * Parse lowerdir= mount option:
422 * e.g.: lowerdir=/lower1:/lower2:/lower3::/data1::/data2
423 * Set "/lower1", "/lower2", and "/lower3" as lower layers and
424 * "/data1" and "/data2" as data lower layers. Any existing lower
425 * layers are replaced.
427 static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
430 struct ovl_fs_context *ctx = fc->fs_private;
431 struct ovl_fs_context_layer *l;
432 char *dup = NULL, *iter;
433 ssize_t nr_lower = 0, nr = 0, nr_data = 0;
434 bool data_layer = false;
437 * Ensure we're backwards compatible with mount(2)
438 * by allowing relative paths.
441 /* drop all existing lower layers */
442 ovl_reset_lowerdirs(ctx);
448 pr_err("cannot append lower layer");
452 // Store user provided lowerdir string to show in mount options
453 ctx->lowerdir_all = kstrdup(name, GFP_KERNEL);
454 if (!ctx->lowerdir_all)
457 dup = kstrdup(name, GFP_KERNEL);
462 nr_lower = ovl_parse_param_split_lowerdirs(dup);
466 if (nr_lower > OVL_MAX_STACK) {
467 pr_err("too many lower directories, limit is %d\n", OVL_MAX_STACK);
471 if (nr_lower > ctx->capacity) {
473 l = krealloc_array(ctx->lower, nr_lower, sizeof(*ctx->lower),
479 ctx->capacity = nr_lower;
484 for (nr = 0; nr < nr_lower; nr++, l++) {
485 memset(l, 0, sizeof(*l));
487 err = ovl_mount_dir(iter, &l->path);
491 err = ovl_mount_dir_check(fc, &l->path, Opt_lowerdir, iter, false);
496 l->name = kstrdup(iter, GFP_KERNEL_ACCOUNT);
503 /* Calling strchr() again would overrun. */
504 if ((nr + 1) == nr_lower)
508 iter = strchr(iter, '\0') + 1;
511 * This is a regular layer so we require that
512 * there are no data layers.
514 if ((ctx->nr_data + nr_data) > 0) {
515 pr_err("regular lower layers cannot follow data lower layers");
523 /* This is a data lower layer. */
528 ctx->nr_data += nr_data;
533 ovl_reset_lowerdirs(ctx);
538 /* Intentionally don't realloc to a smaller size. */
542 static int ovl_parse_param(struct fs_context *fc, struct fs_parameter *param)
545 struct fs_parse_result result;
546 struct ovl_fs *ofs = fc->s_fs_info;
547 struct ovl_config *config = &ofs->config;
548 struct ovl_fs_context *ctx = fc->fs_private;
551 if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
553 * On remount overlayfs has always ignored all mount
554 * options no matter if malformed or not so for
555 * backwards compatibility we do the same here.
561 * Give us the freedom to allow changing mount options
562 * with the new mount api in the future. So instead of
563 * silently ignoring everything we report a proper
564 * error. This is only visible for users of the new
567 return invalfc(fc, "No changes allowed in reconfigure");
570 opt = fs_parse(fc, ovl_parameter_spec, param, &result);
576 err = ovl_parse_param_lowerdir(param->string, fc);
578 case Opt_lowerdir_add:
579 case Opt_datadir_add:
582 err = ovl_parse_layer(fc, param, opt);
584 case Opt_default_permissions:
585 config->default_permissions = true;
587 case Opt_redirect_dir:
588 config->redirect_mode = result.uint_32;
589 if (config->redirect_mode == OVL_REDIRECT_OFF) {
590 config->redirect_mode = ovl_redirect_always_follow ?
591 OVL_REDIRECT_FOLLOW :
592 OVL_REDIRECT_NOFOLLOW;
594 ctx->set.redirect = true;
597 config->index = result.uint_32;
598 ctx->set.index = true;
601 config->uuid = result.uint_32;
604 config->nfs_export = result.uint_32;
605 ctx->set.nfs_export = true;
608 config->xino = result.uint_32;
611 config->metacopy = result.uint_32;
612 ctx->set.metacopy = true;
615 config->verity_mode = result.uint_32;
618 config->ovl_volatile = true;
621 config->userxattr = true;
624 pr_err("unrecognized mount option \"%s\" or missing value\n",
632 static int ovl_get_tree(struct fs_context *fc)
634 return get_tree_nodev(fc, ovl_fill_super);
637 static inline void ovl_fs_context_free(struct ovl_fs_context *ctx)
639 ovl_reset_lowerdirs(ctx);
640 path_put(&ctx->upper);
641 path_put(&ctx->work);
646 static void ovl_free(struct fs_context *fc)
648 struct ovl_fs *ofs = fc->s_fs_info;
649 struct ovl_fs_context *ctx = fc->fs_private;
652 * ofs is stored in the fs_context when it is initialized.
653 * ofs is transferred to the superblock on a successful mount,
654 * but if an error occurs before the transfer we have to free
661 ovl_fs_context_free(ctx);
664 static int ovl_reconfigure(struct fs_context *fc)
666 struct super_block *sb = fc->root->d_sb;
667 struct ovl_fs *ofs = OVL_FS(sb);
668 struct super_block *upper_sb;
671 if (!(fc->sb_flags & SB_RDONLY) && ovl_force_readonly(ofs))
674 if (fc->sb_flags & SB_RDONLY && !sb_rdonly(sb)) {
675 upper_sb = ovl_upper_mnt(ofs)->mnt_sb;
676 if (ovl_should_sync(ofs)) {
677 down_read(&upper_sb->s_umount);
678 ret = sync_filesystem(upper_sb);
679 up_read(&upper_sb->s_umount);
686 static const struct fs_context_operations ovl_context_ops = {
687 .parse_monolithic = ovl_parse_monolithic,
688 .parse_param = ovl_parse_param,
689 .get_tree = ovl_get_tree,
690 .reconfigure = ovl_reconfigure,
695 * This is called during fsopen() and will record the user namespace of
696 * the caller in fc->user_ns since we've raised FS_USERNS_MOUNT. We'll
697 * need it when we actually create the superblock to verify that the
698 * process creating the superblock is in the same user namespace as
699 * process that called fsopen().
701 int ovl_init_fs_context(struct fs_context *fc)
703 struct ovl_fs_context *ctx;
706 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL_ACCOUNT);
711 * By default we allocate for three lower layers. It's likely
712 * that it'll cover most users.
714 ctx->lower = kmalloc_array(3, sizeof(*ctx->lower), GFP_KERNEL_ACCOUNT);
719 ofs = kzalloc(sizeof(struct ovl_fs), GFP_KERNEL);
723 ofs->config.redirect_mode = ovl_redirect_mode_def();
724 ofs->config.index = ovl_index_def;
725 ofs->config.uuid = ovl_uuid_def();
726 ofs->config.nfs_export = ovl_nfs_export_def;
727 ofs->config.xino = ovl_xino_def();
728 ofs->config.metacopy = ovl_metacopy_def;
731 fc->fs_private = ctx;
732 fc->ops = &ovl_context_ops;
736 ovl_fs_context_free(ctx);
741 void ovl_free_fs(struct ovl_fs *ofs)
743 struct vfsmount **mounts;
746 iput(ofs->workbasedir_trap);
747 iput(ofs->indexdir_trap);
748 iput(ofs->workdir_trap);
752 if (ofs->workdir_locked)
753 ovl_inuse_unlock(ofs->workbasedir);
754 dput(ofs->workbasedir);
755 if (ofs->upperdir_locked)
756 ovl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root);
758 /* Reuse ofs->config.lowerdirs as a vfsmount array before freeing it */
759 mounts = (struct vfsmount **) ofs->config.lowerdirs;
760 for (i = 0; i < ofs->numlayer; i++) {
761 iput(ofs->layers[i].trap);
762 kfree(ofs->config.lowerdirs[i]);
763 mounts[i] = ofs->layers[i].mnt;
765 kern_unmount_array(mounts, ofs->numlayer);
767 for (i = 0; i < ofs->numfs; i++)
768 free_anon_bdev(ofs->fs[i].pseudo_dev);
771 kfree(ofs->config.lowerdirs);
772 kfree(ofs->config.upperdir);
773 kfree(ofs->config.workdir);
774 if (ofs->creator_cred)
775 put_cred(ofs->creator_cred);
779 int ovl_fs_params_verify(const struct ovl_fs_context *ctx,
780 struct ovl_config *config)
782 struct ovl_opt_set set = ctx->set;
784 if (ctx->nr_data > 0 && !config->metacopy) {
785 pr_err("lower data-only dirs require metacopy support.\n");
789 /* Workdir/index are useless in non-upper mount */
790 if (!config->upperdir) {
791 if (config->workdir) {
792 pr_info("option \"workdir=%s\" is useless in a non-upper mount, ignore\n",
794 kfree(config->workdir);
795 config->workdir = NULL;
797 if (config->index && set.index) {
798 pr_info("option \"index=on\" is useless in a non-upper mount, ignore\n");
801 config->index = false;
804 if (!config->upperdir && config->ovl_volatile) {
805 pr_info("option \"volatile\" is meaningless in a non-upper mount, ignoring it.\n");
806 config->ovl_volatile = false;
809 if (!config->upperdir && config->uuid == OVL_UUID_ON) {
810 pr_info("option \"uuid=on\" requires an upper fs, falling back to uuid=null.\n");
811 config->uuid = OVL_UUID_NULL;
814 /* Resolve verity -> metacopy dependency */
815 if (config->verity_mode && !config->metacopy) {
816 /* Don't allow explicit specified conflicting combinations */
818 pr_err("conflicting options: metacopy=off,verity=%s\n",
819 ovl_verity_mode(config));
822 /* Otherwise automatically enable metacopy. */
823 config->metacopy = true;
827 * This is to make the logic below simpler. It doesn't make any other
828 * difference, since redirect_dir=on is only used for upper.
830 if (!config->upperdir && config->redirect_mode == OVL_REDIRECT_FOLLOW)
831 config->redirect_mode = OVL_REDIRECT_ON;
833 /* Resolve verity -> metacopy -> redirect_dir dependency */
834 if (config->metacopy && config->redirect_mode != OVL_REDIRECT_ON) {
835 if (set.metacopy && set.redirect) {
836 pr_err("conflicting options: metacopy=on,redirect_dir=%s\n",
837 ovl_redirect_mode(config));
840 if (config->verity_mode && set.redirect) {
841 pr_err("conflicting options: verity=%s,redirect_dir=%s\n",
842 ovl_verity_mode(config), ovl_redirect_mode(config));
847 * There was an explicit redirect_dir=... that resulted
850 pr_info("disabling metacopy due to redirect_dir=%s\n",
851 ovl_redirect_mode(config));
852 config->metacopy = false;
854 /* Automatically enable redirect otherwise. */
855 config->redirect_mode = OVL_REDIRECT_ON;
859 /* Resolve nfs_export -> index dependency */
860 if (config->nfs_export && !config->index) {
861 if (!config->upperdir &&
862 config->redirect_mode != OVL_REDIRECT_NOFOLLOW) {
863 pr_info("NFS export requires \"redirect_dir=nofollow\" on non-upper mount, falling back to nfs_export=off.\n");
864 config->nfs_export = false;
865 } else if (set.nfs_export && set.index) {
866 pr_err("conflicting options: nfs_export=on,index=off\n");
868 } else if (set.index) {
870 * There was an explicit index=off that resulted
873 pr_info("disabling nfs_export due to index=off\n");
874 config->nfs_export = false;
876 /* Automatically enable index otherwise. */
877 config->index = true;
881 /* Resolve nfs_export -> !metacopy && !verity dependency */
882 if (config->nfs_export && config->metacopy) {
883 if (set.nfs_export && set.metacopy) {
884 pr_err("conflicting options: nfs_export=on,metacopy=on\n");
889 * There was an explicit metacopy=on that resulted
892 pr_info("disabling nfs_export due to metacopy=on\n");
893 config->nfs_export = false;
894 } else if (config->verity_mode) {
896 * There was an explicit verity=.. that resulted
899 pr_info("disabling nfs_export due to verity=%s\n",
900 ovl_verity_mode(config));
901 config->nfs_export = false;
904 * There was an explicit nfs_export=on that resulted
907 pr_info("disabling metacopy due to nfs_export=on\n");
908 config->metacopy = false;
913 /* Resolve userxattr -> !redirect && !metacopy && !verity dependency */
914 if (config->userxattr) {
916 config->redirect_mode != OVL_REDIRECT_NOFOLLOW) {
917 pr_err("conflicting options: userxattr,redirect_dir=%s\n",
918 ovl_redirect_mode(config));
921 if (config->metacopy && set.metacopy) {
922 pr_err("conflicting options: userxattr,metacopy=on\n");
925 if (config->verity_mode) {
926 pr_err("conflicting options: userxattr,verity=%s\n",
927 ovl_verity_mode(config));
931 * Silently disable default setting of redirect and metacopy.
932 * This shall be the default in the future as well: these
933 * options must be explicitly enabled if used together with
936 config->redirect_mode = OVL_REDIRECT_NOFOLLOW;
937 config->metacopy = false;
945 * @m: the seq_file handle
946 * @dentry: The dentry to query
948 * Prints the mount options for a given superblock.
949 * Returns zero; does not fail.
951 int ovl_show_options(struct seq_file *m, struct dentry *dentry)
953 struct super_block *sb = dentry->d_sb;
954 struct ovl_fs *ofs = OVL_FS(sb);
955 size_t nr, nr_merged_lower, nr_lower = 0;
956 char **lowerdirs = ofs->config.lowerdirs;
959 * lowerdirs[0] holds the colon separated list that user provided
960 * with lowerdir mount option.
961 * lowerdirs[1..numlayer] hold the lowerdir paths that were added
962 * using the lowerdir+ and datadir+ mount options.
963 * For now, we do not allow mixing the legacy lowerdir mount option
964 * with the new lowerdir+ and datadir+ mount options.
967 seq_show_option(m, "lowerdir", lowerdirs[0]);
969 nr_lower = ofs->numlayer;
970 nr_merged_lower = nr_lower - ofs->numdatalayer;
972 for (nr = 1; nr < nr_lower; nr++) {
973 if (nr < nr_merged_lower)
974 seq_show_option(m, "lowerdir+", lowerdirs[nr]);
976 seq_show_option(m, "datadir+", lowerdirs[nr]);
978 if (ofs->config.upperdir) {
979 seq_show_option(m, "upperdir", ofs->config.upperdir);
980 seq_show_option(m, "workdir", ofs->config.workdir);
982 if (ofs->config.default_permissions)
983 seq_puts(m, ",default_permissions");
984 if (ofs->config.redirect_mode != ovl_redirect_mode_def())
985 seq_printf(m, ",redirect_dir=%s",
986 ovl_redirect_mode(&ofs->config));
987 if (ofs->config.index != ovl_index_def)
988 seq_printf(m, ",index=%s", ofs->config.index ? "on" : "off");
989 if (ofs->config.uuid != ovl_uuid_def())
990 seq_printf(m, ",uuid=%s", ovl_uuid_mode(&ofs->config));
991 if (ofs->config.nfs_export != ovl_nfs_export_def)
992 seq_printf(m, ",nfs_export=%s", ofs->config.nfs_export ?
994 if (ofs->config.xino != ovl_xino_def() && !ovl_same_fs(ofs))
995 seq_printf(m, ",xino=%s", ovl_xino_mode(&ofs->config));
996 if (ofs->config.metacopy != ovl_metacopy_def)
997 seq_printf(m, ",metacopy=%s",
998 ofs->config.metacopy ? "on" : "off");
999 if (ofs->config.ovl_volatile)
1000 seq_puts(m, ",volatile");
1001 if (ofs->config.userxattr)
1002 seq_puts(m, ",userxattr");
1003 if (ofs->config.verity_mode != ovl_verity_mode_def())
1004 seq_printf(m, ",verity=%s",
1005 ovl_verity_mode(&ofs->config));