From: Niu Yawei Date: Mon, 4 Jul 2011 09:37:43 +0000 (-0700) Subject: LU-478 Set tunables on lvm device X-Git-Tag: 2.0.64.0~5 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=536981b0f297a2fa4ae53d4ab81b38e183ee43c0 LU-478 Set tunables on lvm device - The set_blockdev_tunables() shouldn't chop the tail digit on the /dev/mapper/xxx device. - Sometimes, the /sys/block/dm-x doesn't have the max_[hw]_sectors_kb, such errors should be tolerated. Signed-off-by: Niu Yawei Change-Id: I54c0e427772d8a1066a37d011d4cfd18240374b5 Reviewed-on: http://review.whamcloud.com/1046 Tested-by: Hudson Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Reviewed-by: Yu Jian Reviewed-by: Oleg Drokin Tested-by: Maloo --- diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index bfee63c..f622728 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -400,12 +400,16 @@ int set_blockdev_tunables(char *source, int fan_out) * match any entry under /sys/block/. In that case we need to * match the major/minor number to find the entry under * sys/block corresponding to /dev/X */ - dev = real_path + strlen(real_path); - while (--dev > real_path && isdigit(*dev)) - *dev = 0; - if (strncmp(real_path, "/dev/md_", 8) == 0) - *dev = 0; + /* Don't chop tail digit on /dev/mapper/xxx, LU-478 */ + if (strncmp(real_path, "/dev/mapper", 11) != 0) { + dev = real_path + strlen(real_path); + while (--dev > real_path && isdigit(*dev)) + *dev = 0; + + if (strncmp(real_path, "/dev/md_", 8) == 0) + *dev = 0; + } rc = stat(real_path, &stat_buf); if (rc) { @@ -488,7 +492,9 @@ set_params: if (verbose) fprintf(stderr, "warning: opening %s: %s\n", real_path, strerror(errno)); - return rc; + /* No MAX_HW_SECTORS_KB_PATH isn't necessary an + * error for some device. */ + rc = 0; } if (strlen(buf) - 1 > 0) { @@ -499,7 +505,9 @@ set_params: if (verbose) fprintf(stderr, "warning: writing to %s: %s\n", real_path, strerror(errno)); - return rc; + /* No MAX_SECTORS_KB_PATH isn't necessary an + * error for some device. */ + rc = 0; } }