Ticket #1472: hpsa-respect-hba-mode-1472.patch

File hpsa-respect-hba-mode-1472.patch, 1.9 KB (added by Phillip Schichtel, 3 years ago)

This patch changes the is_hspa(name) function to the is_hspa_in_raid_mode(name) function and checks the raid_level disk attribute for value "N/A", which is used by the kernel module for drives that are not logical: ​https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/hpsa.c?id=6417f03132a6952cd17ddd8eaddbac92b61b17e0#n693

  • ChangeLog

     
    11$Id$
    22
     32021-04-09  Phillip Schichtel <phillip@schich.tel>
     4
     5        os_linux.cpp: Only require '-d cciss,N' if hpsa devices are in RAID mode
     6
    372021-04-09  Alex Samorukov <samm@os2.kiev.ua>
    48
    59        os_openbsd.cpp: fix SAT autodetection for the sd* devices (#1467)
  • os_linux.cpp

     
    32063206  return x * 100000 + y * 1000 + z;
    32073207}
    32083208
    3209 // Check for SCSI host proc_name "hpsa"
    3210 static bool is_hpsa(const char * name)
     3209// Check for SCSI host proc_name "hpsa" and HPSA raid_level
     3210static bool is_hpsa_in_raid_mode(const char * name)
    32113211{
    32123212  char path[128];
    32133213  snprintf(path, sizeof(path), "/sys/block/%s/device", name);
     
    32473247  if (strcmp(proc_name, "hpsa"))
    32483248    return false;
    32493249
    3250   return true;
     3250  // See: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/hpsa.c?id=6417f03132a6952cd17ddd8eaddbac92b61b17e0#n693
     3251  snprintf(path, sizeof(path), "/sys/block/%s/device/raid_level", name);
     3252  fd = open(path, O_RDONLY);
     3253  if (fd < 0)
     3254    return false;
     3255
     3256  char raid_level[4];
     3257  n = read(fd, raid_level, sizeof(raid_level) - 1);
     3258  close(fd);
     3259  if (n < 3)
     3260    return false;
     3261  raid_level[n] = 0;
     3262
     3263  if (strcmp(raid_level, "N/A"))
     3264    return true;
     3265
     3266  return false;
    32513267}
    32523268
    32533269// Guess device type (ata or scsi) based on device name (Linux
     
    33023318      return get_scsi_passthrough_device(usbtype, new linux_scsi_device(this, name, ""));
    33033319    }
    33043320
    3305     // Fail if hpsa driver
    3306     if (is_hpsa(test_name))
     3321    // Fail if hpsa driver and device is using RAID
     3322    if (is_hpsa_in_raid_mode(test_name))
    33073323      return missing_option("-d cciss,N");
    33083324
    33093325    // No USB bridge or hpsa driver found, assume regular SCSI device