From: John L. Hammond Date: Thu, 12 May 2022 20:50:10 +0000 (-0500) Subject: EX-5260 pumount: use O_PATH for mount point X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=cedae8170d6aadb76eed3bc9b2b411a3e012463e;p=fs%2Flustre-release.git EX-5260 pumount: use O_PATH for mount point In pumount, use O_PATH when opening the mount point to try to avoid RPCs from permission or atomic_open. Test-Parameters: trivial testlist=sanity-pumount clientextra_install_params="--packages pumount" Signed-off-by: John L. Hammond Change-Id: Ibd66579d9b5ecef724334c01d90367af4bd93179 Reviewed-on: https://review.whamcloud.com/47323 Tested-by: jenkins Tested-by: Maloo --- diff --git a/pumount/pumount.c b/pumount/pumount.c index bba34af..747f6cb 100644 --- a/pumount/pumount.c +++ b/pumount/pumount.c @@ -944,7 +944,10 @@ int main(int argc, char *argv[]) PU_FATAL("cannot open '%s': %s\n", "/proc", strerror(errno)); if (do_open) { - mount_dirfd = open(mount_point, O_RDONLY|O_DIRECTORY); + /* We open the mount point to prevent a mount ID reuse + * race. Use O_PATH to avoid invoking permission or + * atomic_open. */ + mount_dirfd = open(mount_point, O_RDONLY|O_DIRECTORY|O_PATH); if (mount_dirfd < 0) PU_FATAL("cannot open '%s': %s\n", mount_point, strerror(errno));