]> git.proxmox.com Git - mirror_zfs-debian.git/commitdiff
call_usermodehelper() should wait for process
authorNed Bass <bass6@llnl.gov>
Wed, 9 Jan 2013 23:46:31 +0000 (15:46 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 10 Jan 2013 00:54:52 +0000 (16:54 -0800)
As of Linux 3.4 the UMH_WAIT_* constants were renumbered.  In
particular, the meaning of "1" changed from UMH_WAIT_PROC (wait for
process to complete), to UMH_WAIT_EXEC (wait for the exec, but not the
process).  A number of call sites used the number 1 instead of the
constant name, so the behavior was not as expected on kernels with this
change.

One visible consequence of this change was that processes accessing
automounted snapshots received an ELOOP error because they failed to
wait for zfs.mount to complete.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #816

module/zfs/vdev_disk.c
module/zfs/zfs_ctldir.c
module/zpios/pios.c

index 3f9b624d8be377ec6ec9581f647a5c5343222b6c..cbf0a4d4fb0896c74f34ceeb4899d2f91675eea5 100644 (file)
@@ -159,7 +159,7 @@ vdev_elevator_switch(vdev_t *v, char *elevator)
                char *envp[] = { NULL };
 
                argv[2] = kmem_asprintf(SET_SCHEDULER_CMD, device, elevator);
-               error = call_usermodehelper(argv[0], argv, envp, 1);
+               error = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
                strfree(argv[2]);
        }
 #endif /* HAVE_ELEVATOR_CHANGE */
index a667340c8d9b50ad0d005130a7b90b022aa79156..b5c4510fe8ded8e47ed4375e22919cffeb1dc533 100644 (file)
@@ -696,7 +696,7 @@ __zfsctl_unmount_snapshot(zfs_snapentry_t *sep, int flags)
 
        argv[2] = kmem_asprintf(SET_UNMOUNT_CMD,
            flags & MNT_FORCE ? "-f " : "", sep->se_path);
-       error = call_usermodehelper(argv[0], argv, envp, 1);
+       error = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
        strfree(argv[2]);
 
        /*
@@ -822,7 +822,7 @@ zfsctl_mount_snapshot(struct path *path, int flags)
         * to safely abort the automount.  This should be very rare.
         */
        argv[2] = kmem_asprintf(SET_MOUNT_CMD, full_name, full_path);
-       error = call_usermodehelper(argv[0], argv, envp, 1);
+       error = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
        strfree(argv[2]);
        if (error) {
                printk("ZFS: Unable to automount %s at %s: %d\n",
index 6af2005703c423fc2eb072b1a4eccd31f11d49e5..aa1f2bbd3065b421d22a77d7bef6ea1f629ac126 100644 (file)
@@ -92,7 +92,7 @@ int zpios_upcall(char *path, char *phase, run_args_t *run_args, int rc)
         envp[2] = "PATH=/sbin:/usr/sbin:/bin:/usr/bin";
         envp[3] = NULL;
 
-        return call_usermodehelper(path, argv, envp, 1);
+        return call_usermodehelper(path, argv, envp, UMH_WAIT_PROC);
 }
 
 static uint64_t