From: James Simmons Date: Fri, 6 Feb 2015 17:43:05 +0000 (-0500) Subject: LU-6063 kernel: use proper flags for call_usermodehelper X-Git-Tag: 2.6.94~13 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8febfe0e30c5febdf716e4591c355199de4a6ab8 LU-6063 kernel: use proper flags for call_usermodehelper When a parameter is permanently changed on the MGS the MGS send a changelog packet to the proper nodes that are affected by the change. Once the nodes receive the change they then call the userland utility lctl to change its local value. When calling a userland application from the kernel you specify a flag to control the interaction with the application. Originally by default the flag was set to 0 which is UMH_NO_WAIT which meant lctl was being called asynchronously. In older kernels this was fine since UHM_NO_WAIT and UHM_WAIT_PROC had nearly the same logic. This changed with newer kernels which broke updating our parameters. Plus doing a UHM_NO_WAIT doesn't report back a error if something goes wrong with lctl. The fix is to set the flag to UHM_WAIT_PROC so kernel space waits until lctl has finished and we get a proper error code if something does go wrong with lctl. Secondly the patch uses the proper flag name instead of a number for the use of call_usermodehelper in mdt_identity.c so the code is more readable. Change-Id: I016fd4342315e9db6ec3ef544bcfb3a477c97b52 Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/13677 Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/mdt/mdt_identity.c b/lustre/mdt/mdt_identity.c index 9e44e90..1b23332 100644 --- a/lustre/mdt/mdt_identity.c +++ b/lustre/mdt/mdt_identity.c @@ -126,7 +126,7 @@ static int mdt_identity_do_upcall(struct upcall_cache *cache, snprintf(keystr, sizeof(keystr), LPU64, entry->ue_key); do_gettimeofday(&start); - rc = call_usermodehelper(argv[0], argv, envp, 1); + rc = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); do_gettimeofday(&end); if (rc < 0) { CERROR("%s: error invoking upcall %s %s %s: rc %d; " diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 587dbe2..610244f 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -1047,7 +1047,7 @@ static int process_param2_config(struct lustre_cfg *lcfg) } do_gettimeofday(&start); - rc = call_usermodehelper(argv[0], argv, NULL, 0); + rc = call_usermodehelper(argv[0], argv, NULL, UMH_WAIT_PROC); do_gettimeofday(&end); if (rc < 0) {