* 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) {
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) {
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;
}