diff options
author | Brian Behlendorf <[email protected]> | 2011-03-07 10:10:20 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-03-09 15:26:48 -0800 |
commit | 9ac97c2a939aef0f9899244920007c605387949a (patch) | |
tree | c6750083fbdebd56a657c8ce7e72f4ffc8b3bf96 /lib/libzfs/libzfs_mount.c | |
parent | d53368f6755ff67342f68e2e536c4157409fd047 (diff) |
Print mount/umount errors
Because we are dependent of the system mount/umount utilities to
ensure correct mtab locking, we should not suppress their error
output. During a successful mount/umount they will be silent,
but during a failure the error message they print is the only sure
way to know why a mount failed. This is because the (u)mount(8)
return code does not contain the result of the system call issued.
The only way to clearly idenify why thing failed is to rely on
the error message printed by the tool.
Longer term once libmount is available we can issue the mount/umount
system calls within the tool and still be ensured correct mtab locking.
Closed #107
Diffstat (limited to 'lib/libzfs/libzfs_mount.c')
-rw-r--r-- | lib/libzfs/libzfs_mount.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index a1faf49d1..1dc58f924 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -269,7 +269,7 @@ do_mount(const char *src, const char *mntpt, char *opts) int rc; /* Return only the most critical mount error */ - rc = libzfs_run_process(argv[0], argv); + rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE); if (rc) { if (rc & MOUNT_FILEIO) return EIO; @@ -310,7 +310,7 @@ do_unmount(const char *mntpt, int flags) } argv[count] = (char *)mntpt; - rc = libzfs_run_process(argv[0], argv); + rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE); return (rc ? EINVAL : 0); } @@ -414,8 +414,10 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int flags) static int unmount_one(libzfs_handle_t *hdl, const char *mountpoint, int flags) { - if (do_unmount(mountpoint, flags) != 0) { - zfs_error_aux(hdl, strerror(errno)); + int error; + + error = do_unmount(mountpoint, flags); + if (error != 0) { return (zfs_error_fmt(hdl, EZFS_UMOUNTFAILED, dgettext(TEXT_DOMAIN, "cannot unmount '%s'"), mountpoint)); |