Whamcloud - gitweb
LU-478 Set tunables on lvm device
authorNiu Yawei <niu@whamcloud.com>
Thu, 29 Sep 2011 10:25:02 +0000 (03:25 -0700)
committerJohann Lombardi <johann@whamcloud.com>
Thu, 29 Sep 2011 12:01:37 +0000 (08:01 -0400)
- 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: I3c3737be561302adc93ab699701649e71c0c1321
Reviewed-on: http://review.whamcloud.com/1439
Tested-by: Hudson
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/utils/mount_lustre.c

index 7b728c3..ebb5391 100644 (file)
@@ -381,12 +381,16 @@ int set_blockdev_tunables(char *source)
          * 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) {
@@ -468,7 +472,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) {
@@ -478,6 +484,9 @@ set_params:
                 if (rc && verbose)
                         fprintf(stderr, "warning: writing to %s: %s\n",
                                 real_path, strerror(errno));
+                /* No MAX_HW_SECTORS_KB_PATH isn't necessary an
+                 * error for some device. */
+                rc = 0;
         }
         return rc;
 }