Whamcloud - gitweb
LU-478 Set tunables on lvm device
authorNiu Yawei <niu@whamcloud.com>
Mon, 4 Jul 2011 09:37:43 +0000 (02:37 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 6 Jul 2011 17:19:47 +0000 (10:19 -0700)
- 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 <niu@whamcloud.com>
Change-Id: I54c0e427772d8a1066a37d011d4cfd18240374b5
Reviewed-on: http://review.whamcloud.com/1046
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/utils/mount_lustre.c

index bfee63c..f622728 100644 (file)
@@ -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;
                 }
         }