Skip to content

zfs_main: allow umount only on original mountpoint #17421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/zfs/zfs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7755,6 +7755,12 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
return (1);
}

if (strcmp(entry.mnt_mountp, path) != 0) {
(void) fprintf(stderr, gettext("cannot %s '%s': not an original"
" mountpoint\n"), cmdname, path);
Comment on lines +7758 to +7760
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I understand there is a problem, I am not sure this solution is right. Please correct me if I am wrong, but looking on getextmntent() I see this comment:

 * Search for the path in /proc/self/mounts. Rather than looking for the
 * specific path, which can be fooled by non-standard paths (i.e. ".."
 * or "//"), we stat() the path and search for the corresponding
 * (major,minor) device pair.

, which makes me think the exactly path match is not required there.

return (1);
}

if ((zhp = zfs_open(g_zfs, entry.mnt_special,
ZFS_TYPE_FILESYSTEM)) == NULL)
return (1);
Expand Down