Disable mount(8) canonical paths in do_mount()

By default the mount(8) command, as invoked by 'zfs mount', will try
to resolve any path parameter in its canonical form: this could lead
to mount failures when the cwd contains a symlink having the same name
of the dataset being mounted.

Fix this by explicitly disabling mount(8) path canonicalization.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #1791 
Closes #6429 
Closes #6437
This commit is contained in:
LOLi 2017-08-21 18:31:54 +02:00 committed by Brian Behlendorf
parent f763c3d1df
commit 9000a9fac9
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,6 @@ Before=local-fs.target
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStart=@sbindir@/zfs mount -a ExecStart=@sbindir@/zfs mount -a
WorkingDirectory=-/sbin/
[Install] [Install]
WantedBy=zfs-share.service WantedBy=zfs-share.service

View File

@ -345,8 +345,9 @@ zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t buflen,
static int static int
do_mount(const char *src, const char *mntpt, char *opts) do_mount(const char *src, const char *mntpt, char *opts)
{ {
char *argv[8] = { char *argv[9] = {
"/bin/mount", "/bin/mount",
"--no-canonicalize",
"-t", MNTTYPE_ZFS, "-t", MNTTYPE_ZFS,
"-o", opts, "-o", opts,
(char *)src, (char *)src,