Whamcloud - gitweb
EX-5260 pumount: use O_PATH for mount point
authorJohn L. Hammond <jhammond@whamcloud.com>
Thu, 12 May 2022 20:50:10 +0000 (15:50 -0500)
committerJohn L. Hammond <jhammond@whamcloud.com>
Fri, 13 May 2022 21:57:11 +0000 (21:57 +0000)
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 <jhammond@whamcloud.com>
Change-Id: Ibd66579d9b5ecef724334c01d90367af4bd93179
Reviewed-on: https://review.whamcloud.com/47323
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
pumount/pumount.c

index bba34af..747f6cb 100644 (file)
@@ -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));