From c632a238e6d0c4a3240959a894d36a8a409d64f8 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Tue, 4 Jun 2019 19:14:47 -0500 Subject: [PATCH] LU-12387 utils: Avoid passing symlink to tune_block_dev In tune_block_dev_slaves we iterate over the directories inside the slaves subdirectory for the multipath device that is being tuned. For example: $ /usr/sbin/l_tunedisk /dev/mapper/mpathc Suppose mpathc maps to /dev/dm-2. tune_block_dev will initially set the value of /sys/devices/virtual/block/dm-2/queue/max_sectors_kb equal to the value of /sys/devices/virtual/block/dm-2/queue/max_hw_sectors_kb Then it looks at the entries in /sys/devices/virtual/block/dm-2/slaves Suppose the slave devices are as follows: $ ls /sys/devices/virtual/block/dm-2/slaves sdc sdh sdm sdr $ It then calls tune_block_dev recursively, passing /sys/devices/virtual/block/dm-2/slaves/sdc, /sys/devices/virtual/block/dm-2/slaves/sdh, etc. However, these are symlinks that point to directories and as such tune_block_dev will not tune them because stat does not identify them as block devices. Instead we should contruct the path argument for these recursive calls as /dev/. In this example, /dev/sdc, /dev/sdh, etc. Cray-bug-id: LUS-7358 Signed-off-by: Chris Horn Change-Id: I63bc073a82384d68648ff23a56b7d43d6656159b Reviewed-on: https://review.whamcloud.com/35065 Reviewed-by: Andreas Dilger Reviewed-by: Nathaniel Clark Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Gu Zheng --- lustre/utils/libmount_utils_ldiskfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/utils/libmount_utils_ldiskfs.c b/lustre/utils/libmount_utils_ldiskfs.c index a3c4900d..bf97b95 100644 --- a/lustre/utils/libmount_utils_ldiskfs.c +++ b/lustre/utils/libmount_utils_ldiskfs.c @@ -1259,7 +1259,7 @@ static int tune_block_dev_slaves(const char *sys_path, struct mount_opts *mop) if (d->d_type != DT_LNK) continue; - snprintf(path, sizeof(path), "%s/%s", slaves_path, d->d_name); + snprintf(path, sizeof(path), "/dev/%s", d->d_name); rc2 = tune_block_dev(path, mop); if (rc2 != 0) rc = rc2; -- 1.8.3.1