summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorSuman Chakravartula <[email protected]>2012-01-11 16:48:02 -0800
committerBrian Behlendorf <[email protected]>2012-01-12 15:49:38 -0800
commite18be9a637088911d2b618788cd45982986e63cb (patch)
tree611485fc0e3b37bea63a1e48ccff9f55be9b38a6 /cmd
parent96b91ef0d6b289037c4d54357901e4b694e08f02 (diff)
Add overlay(-O) mount option support
Linux supports mounting over non-empty directories by default. In Solaris this is not the case and -O option is required for zfs mount to mount a zfs filesystem over a non-empty directory. For compatibility, I've added support for -O option to mount zfs filesystems over non-empty directories if the user wants to, just like in Solaris. I've defined MS_OVERLAY to record it in the flags variable if the -O option is supplied. The flags variable passes through a few functions and its checked before performing the empty directory check in zfs_mount function. If -O is given, the check is not performed. Signed-off-by: Brian Behlendorf <[email protected]> Closes #473
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index a052be520..518000cf1 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -5469,7 +5469,7 @@ share_mount(int op, int argc, char **argv)
int flags = 0;
/* check options */
- while ((c = getopt(argc, argv, op == OP_MOUNT ? ":avo:" : "a"))
+ while ((c = getopt(argc, argv, op == OP_MOUNT ? ":avo:O" : "a"))
!= -1) {
switch (c) {
case 'a':
@@ -5491,7 +5491,9 @@ share_mount(int op, int argc, char **argv)
/* option validation is done later */
append_options(options, optarg);
break;
-
+ case 'O':
+ flags |= MS_OVERLAY;
+ break;
case ':':
(void) fprintf(stderr, gettext("missing argument for "
"'%c' option\n"), optopt);