/* skip directories */
if (S_ISDIR(statbuf.st_mode)) return 0;
The problem here is that stat() gets called on the containing directory in devpath (as opposed to devpath+attr_name). Then the code proceeds to check if that is a directory (which obviously it is going to be) and before returning without having done anything. The rest of the function also seems to assume that "devpath" contains the full path to the sysfs attribute as opposed to the containing directory.
How the verification in comment #22 could have found this code to be working is beyond me, as the only place where the attr_name variable is actively being used for anything in the function is in the condlog() call.
It appears this got fixed upstream by http://git.opensvc.com/gitweb.cgi?p=multipath-tools/.git;a=commit;h=050b24b33d3c60e29f7820d2fb75e84a9edde528 . This patch applies fine to the multipath-tools 0.4.9-3ubuntu7.9 sources from trusty (with --fuzz=3), and I can confirm that it does fix the problem for me - the sysfs timeout attributes gets set correctly when the maps is being created (both when using multipathd and the multipath tool).
Ok, so I found the bug. The problematic code is in sysfs_attr_ set_value( ) in libmultipath/ sysfs.c:
devpath = udev_device_ get_syspath( dev);
condlog( 4, "stat '%s' failed: %s", devpath, strerror(errno));
return 0;
condlog(4, "open '%s'/'%s'", devpath, attr_name);
if (stat(devpath, &statbuf) != 0) {
}
/* skip directories */ statbuf. st_mode) )
return 0;
if (S_ISDIR(
The problem here is that stat() gets called on the containing directory in devpath (as opposed to devpath+attr_name). Then the code proceeds to check if that is a directory (which obviously it is going to be) and before returning without having done anything. The rest of the function also seems to assume that "devpath" contains the full path to the sysfs attribute as opposed to the containing directory.
How the verification in comment #22 could have found this code to be working is beyond me, as the only place where the attr_name variable is actively being used for anything in the function is in the condlog() call.
It appears this got fixed upstream by http:// git.opensvc. com/gitweb. cgi?p=multipath -tools/ .git;a= commit; h=050b24b33d3c6 0e29f7820d2fb75 e84a9edde528 . This patch applies fine to the multipath-tools 0.4.9-3ubuntu7.9 sources from trusty (with --fuzz=3), and I can confirm that it does fix the problem for me - the sysfs timeout attributes gets set correctly when the maps is being created (both when using multipathd and the multipath tool).
Tore