From: Ned Bass Date: Wed, 9 Jan 2013 23:46:31 +0000 (-0800) Subject: call_usermodehelper() should wait for process X-Git-Tag: debian/0.7.9-2~340^2~13 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=761394b3af152895ac68a970a91a4f8a917c547b;p=mirror_zfs-debian.git call_usermodehelper() should wait for process 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 Closes #816 --- diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c index 3f9b624d..cbf0a4d4 100644 --- a/module/zfs/vdev_disk.c +++ b/module/zfs/vdev_disk.c @@ -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 */ diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c index a667340c..b5c4510f 100644 --- a/module/zfs/zfs_ctldir.c +++ b/module/zfs/zfs_ctldir.c @@ -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", diff --git a/module/zpios/pios.c b/module/zpios/pios.c index 6af20057..aa1f2bbd 100644 --- a/module/zpios/pios.c +++ b/module/zpios/pios.c @@ -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