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 <behlendorf1@llnl.gov>
Closes #473
This commit is contained in:
Suman Chakravartula
2012-01-11 16:48:02 -08:00
committed by Brian Behlendorf
parent 96b91ef0d6
commit e18be9a637
3 changed files with 15 additions and 4 deletions
+7
View File
@@ -73,4 +73,11 @@
# define MS_DETACH 0x00000002
#endif /* MNT_DETACH */
/*
* Overlay mount is default in Linux, but for solaris/zfs
* compatibility, MS_OVERLAY is defined to explicitly have the user
* provide a flag (-O) to mount over a non empty directory.
*/
#define MS_OVERLAY 0x00000004
#endif /* _LIBSPL_SYS_MOUNT_H */