Re: [PATCH v2 07/12] IB/srp: Avoid that I/O hangs due to a cable pull during LUN scanning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/19/14 18:27, Sagi Grimberg wrote:
On 10/7/2014 4:05 PM, Bart Van Assche wrote:
+static int srp_sdev_count(struct Scsi_Host *host)
+{
+    struct scsi_device *sdev;
+    int c = 0;
+
+    shost_for_each_device(sdev, host)
+        c++;
+
+    return c;
+}
+

Is this really an SRP specific routine?
Can you move it to a more natural location?

How about renaming this function into shost_sdev_count() and moving its declaration to <scsi/scsi_device.h> and its implementation to drivers/scsi/scsi_lib.c ?

  static int srp_add_target(struct srp_host *host, struct
srp_target_port *target)
  {
      struct srp_rport_identifiers ids;
      struct srp_rport *rport;

+    target->state = SRP_TARGET_SCANNING;
      sprintf(target->target_name, "SRP.T10:%016llX",
           (unsigned long long) be64_to_cpu(target->id_ext));

@@ -2634,11 +2650,26 @@ static int srp_add_target(struct srp_host
*host, struct srp_target_port *target)
      list_add_tail(&target->list, &host->target_list);
      spin_unlock(&host->target_lock);

-    target->state = SRP_TARGET_LIVE;
-
      scsi_scan_target(&target->scsi_host->shost_gendev,
               0, target->scsi_id, SCAN_WILD_CARD, 0);

+    if (!target->connected || target->qp_in_error) {
+        shost_printk(KERN_INFO, target->scsi_host,
+                 PFX "SCSI scan failed - removing SCSI host\n");
+        srp_queue_remove_work(target);
+        goto out;
+    }

So my impression is that by conditioning target->qp_in_error you are
relying on the fact that SRP eh was invoked here (RC error), what if
scsi eh was invoked prior to that? did you test this path?

This code path has been tested. It's not that hard to trigger this code path - setting the channel count (ch_count) parameter to a high value and running a loop at the target side that disables IB ports after a random delay between 0s and (2*srp_daemon_scan_interval) is sufficient. After not too many iterations this code will be hit because the higher the channel count the longer it takes to log in.

The SCSI EH is only activated after a SCSI command has failed. No SCSI commands are sent to a target system before the scsi_scan_target() call. This means that the SCSI EH can only get activated while scsi_scan_target() is in progress or after that function has finished.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux