git://git.camperquake.de
/
zfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix VOP_CLOSE() in userspace.
[zfs.git]
/
cmd
/
mount_zfs
/
mount_zfs.c
diff --git
a/cmd/mount_zfs/mount_zfs.c
b/cmd/mount_zfs/mount_zfs.c
index
e97b2b8
..
0a69d69
100644
(file)
--- a/
cmd/mount_zfs/mount_zfs.c
+++ b/
cmd/mount_zfs/mount_zfs.c
@@
-30,6
+30,7
@@
#include <sys/mount.h>
#include <sys/stat.h>
#include <libzfs.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <libzfs.h>
+#include <locale.h>
#ifdef HAVE_LIBSELINUX
#include <selinux/selinux.h>
#endif /* HAVE_LIBSELINUX */
#ifdef HAVE_LIBSELINUX
#include <selinux/selinux.h>
#endif /* HAVE_LIBSELINUX */
@@
-96,6
+97,7
@@
static const option_map_t option_map[] = {
{ MNTOPT_QUIET, MS_SILENT, ZS_COMMENT },
#endif
/* Custom zfs options */
{ MNTOPT_QUIET, MS_SILENT, ZS_COMMENT },
#endif
/* Custom zfs options */
+ { MNTOPT_XATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_NOXATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_ZFSUTIL, MS_COMMENT, ZS_ZFSUTIL },
{ NULL, 0, 0 } };
{ MNTOPT_NOXATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_ZFSUTIL, MS_COMMENT, ZS_ZFSUTIL },
{ NULL, 0, 0 } };
@@
-252,7
+254,7
@@
mtab_is_writeable(void)
struct stat st;
int error, fd;
struct stat st;
int error, fd;
- error = stat(MNTTAB, &st);
+ error =
l
stat(MNTTAB, &st);
if (error || S_ISLNK(st.st_mode))
return (0);
if (error || S_ISLNK(st.st_mode))
return (0);
@@
-310,7
+312,7
@@
main(int argc, char **argv)
char badopt[MNT_LINE_MAX] = { '\0' };
char mtabopt[MNT_LINE_MAX] = { '\0' };
char *dataset, *mntpoint;
char badopt[MNT_LINE_MAX] = { '\0' };
char mtabopt[MNT_LINE_MAX] = { '\0' };
char *dataset, *mntpoint;
- unsigned long mntflags = 0, zfsflags = 0, remount
_ro
= 0;
+ unsigned long mntflags = 0, zfsflags = 0, remount = 0;
int sloppy = 0, fake = 0, verbose = 0, nomtab = 0, zfsutil = 0;
int error, c;
int sloppy = 0, fake = 0, verbose = 0, nomtab = 0, zfsutil = 0;
int error, c;
@@
-415,11
+417,10
@@
main(int argc, char **argv)
" mountopts: \"%s\"\n mtabopts: \"%s\"\n"),
dataset, mntpoint, mntflags, zfsflags, mntopts, mtabopt);
" mountopts: \"%s\"\n mtabopts: \"%s\"\n"),
dataset, mntpoint, mntflags, zfsflags, mntopts, mtabopt);
- if (mntflags & MS_REMOUNT)
+ if (mntflags & MS_REMOUNT)
{
nomtab = 1;
nomtab = 1;
-
- if ((mntflags & MS_REMOUNT) && (mntflags & MS_RDONLY))
- remount_ro = 1;
+ remount = 1;
+ }
if (zfsflags & ZS_ZFSUTIL)
zfsutil = 1;
if (zfsflags & ZS_ZFSUTIL)
zfsutil = 1;
@@
-452,9
+453,10
@@
main(int argc, char **argv)
* we differentiate the two cases using the 'zfsutil' mount option.
* This mount option should only be supplied by the 'zfs mount' util.
*
* we differentiate the two cases using the 'zfsutil' mount option.
* This mount option should only be supplied by the 'zfs mount' util.
*
- * The only exception to the above rule is '-o remount,ro'. This is
- * always allowed for non-legacy datasets for rc.sysinit/umountroot
- * to safely remount the root filesystem and flush its cache.
+ * The only exception to the above rule is '-o remount' which is
+ * always allowed for non-legacy datasets. This is done because when
+ * using zfs as your root file system both rc.sysinit/umountroot and
+ * systemd depend on 'mount -o remount <mountpoint>' to work.
*/
if (zfsutil && !strcmp(legacy, ZFS_MOUNTPOINT_LEGACY)) {
(void) fprintf(stderr, gettext(
*/
if (zfsutil && !strcmp(legacy, ZFS_MOUNTPOINT_LEGACY)) {
(void) fprintf(stderr, gettext(
@@
-465,7
+467,7
@@
main(int argc, char **argv)
return (MOUNT_USAGE);
}
return (MOUNT_USAGE);
}
- if (!zfsutil && strcmp(legacy, ZFS_MOUNTPOINT_LEGACY) && !remount
_ro
) {
+ if (!zfsutil && strcmp(legacy, ZFS_MOUNTPOINT_LEGACY) && !remount) {
(void) fprintf(stderr, gettext(
"filesystem '%s' cannot be mounted using 'mount'.\n"
"Use 'zfs set mountpoint=%s' or 'zfs mount %s'.\n"
(void) fprintf(stderr, gettext(
"filesystem '%s' cannot be mounted using 'mount'.\n"
"Use 'zfs set mountpoint=%s' or 'zfs mount %s'.\n"
@@
-479,6
+481,10
@@
main(int argc, char **argv)
mntflags, mntopts);
if (error) {
switch (errno) {
mntflags, mntopts);
if (error) {
switch (errno) {
+ case ENOENT:
+ (void) fprintf(stderr, gettext("mount point "
+ "'%s' does not exist\n"), mntpoint);
+ return (MOUNT_SYSERR);
case EBUSY:
(void) fprintf(stderr, gettext("filesystem "
"'%s' is already mounted\n"), dataset);
case EBUSY:
(void) fprintf(stderr, gettext("filesystem "
"'%s' is already mounted\n"), dataset);