From b96e4758041ffac1b8d8c39f4897edd6182a46e9 Mon Sep 17 00:00:00 2001 From: Sargun Dhillon Date: Sun, 27 Dec 2020 03:17:46 -0800 Subject: 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 --- util/fusermount.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'util') 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", -- cgit v1.2.1