Whamcloud - gitweb
LU-12387 utils: Avoid passing symlink to tune_block_dev 65/35065/4
authorChris Horn <hornc@cray.com>
Wed, 5 Jun 2019 00:14:47 +0000 (19:14 -0500)
committerOleg Drokin <green@whamcloud.com>
Sun, 16 Jun 2019 03:23:38 +0000 (03:23 +0000)
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/<d_name>. In this example, /dev/sdc, /dev/sdh, etc.

Cray-bug-id: LUS-7358
Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: I63bc073a82384d68648ff23a56b7d43d6656159b
Reviewed-on: https://review.whamcloud.com/35065
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Nathaniel Clark <nclark@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
lustre/utils/libmount_utils_ldiskfs.c

index a3c4900..bf97b95 100644 (file)
@@ -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;