diff options
author | Sargun Dhillon <sargun@sargun.me> | 2020-12-27 03:17:46 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-27 11:17:46 +0000 |
commit | b96e4758041ffac1b8d8c39f4897edd6182a46e9 (patch) | |
tree | 7fad7a7178b3bd6a72bc43fbf7c10ab4e7ba797f | |
parent | 9bfbeb576c5901b62a171d35510f0d1a922020b7 (diff) | |
download | fuse-b96e4758041ffac1b8d8c39f4897edd6182a46e9.tar.gz |
util/fusermount.c: Assume the kernel supports UMOUNT_NOFOLLOW (#574)
UMOUNT_NOFOLLOW was added in Kernel 2.6.34. It's been 10 years since it's been added
Kernel 5.9, and 5.10 break this check mechanism[1]. Let's deprecate it.
[1]: https://lore.kernel.org/linux-fsdevel/20201223102604.2078-1-sargun@sargun.me/
Signed-off-by: Sargun Dhillon <sargun@sargun.me>
-rw-r--r-- | util/fusermount.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/util/fusermount.c b/util/fusermount.c index 953d4ca..45e96bc 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -397,26 +397,12 @@ static int chdir_to_parent(char *copy, const char **lastp) } #ifndef IGNORE_MTAB -/* Check whether the kernel supports UMOUNT_NOFOLLOW flag */ -static int umount_nofollow_support(void) -{ - int res = umount2("", UMOUNT_UNUSED); - if (res != -1 || errno != EINVAL) - return 0; - - res = umount2("", UMOUNT_NOFOLLOW); - if (res != -1 || errno != ENOENT) - return 0; - - return 1; -} - static int unmount_fuse_locked(const char *mnt, int quiet, int lazy) { int res; char *copy; const char *last; - int umount_flags = lazy ? UMOUNT_DETACH : 0; + int umount_flags = (lazy ? UMOUNT_DETACH : 0) | UMOUNT_NOFOLLOW; if (getuid() != 0) { res = may_unmount(mnt, quiet); @@ -436,14 +422,6 @@ static int unmount_fuse_locked(const char *mnt, int quiet, int lazy) if (res == -1) goto out; - if (umount_nofollow_support()) { - umount_flags |= UMOUNT_NOFOLLOW; - } else { - res = check_is_mount(last, mnt, NULL); - if (res == -1) - goto out; - } - res = umount2(last, umount_flags); if (res == -1 && !quiet) { fprintf(stderr, "%s: failed to unmount %s: %s\n", |