diff options
Diffstat (limited to 'drivers/infiniband/ulp/srp/ib_srp.c')
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 4305da2c9037..d5cbad2c61e4 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -2340,7 +2340,6 @@ static void srp_handle_qp_err(struct ib_cq *cq, struct ib_wc *wc, | |||
2340 | static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) | 2340 | static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) |
2341 | { | 2341 | { |
2342 | struct srp_target_port *target = host_to_target(shost); | 2342 | struct srp_target_port *target = host_to_target(shost); |
2343 | struct srp_rport *rport = target->rport; | ||
2344 | struct srp_rdma_ch *ch; | 2343 | struct srp_rdma_ch *ch; |
2345 | struct srp_request *req; | 2344 | struct srp_request *req; |
2346 | struct srp_iu *iu; | 2345 | struct srp_iu *iu; |
@@ -2350,16 +2349,6 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) | |||
2350 | u32 tag; | 2349 | u32 tag; |
2351 | u16 idx; | 2350 | u16 idx; |
2352 | int len, ret; | 2351 | int len, ret; |
2353 | const bool in_scsi_eh = !in_interrupt() && current == shost->ehandler; | ||
2354 | |||
2355 | /* | ||
2356 | * The SCSI EH thread is the only context from which srp_queuecommand() | ||
2357 | * can get invoked for blocked devices (SDEV_BLOCK / | ||
2358 | * SDEV_CREATED_BLOCK). Avoid racing with srp_reconnect_rport() by | ||
2359 | * locking the rport mutex if invoked from inside the SCSI EH. | ||
2360 | */ | ||
2361 | if (in_scsi_eh) | ||
2362 | mutex_lock(&rport->mutex); | ||
2363 | 2352 | ||
2364 | scmnd->result = srp_chkready(target->rport); | 2353 | scmnd->result = srp_chkready(target->rport); |
2365 | if (unlikely(scmnd->result)) | 2354 | if (unlikely(scmnd->result)) |
@@ -2428,13 +2417,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd) | |||
2428 | goto err_unmap; | 2417 | goto err_unmap; |
2429 | } | 2418 | } |
2430 | 2419 | ||
2431 | ret = 0; | 2420 | return 0; |
2432 | |||
2433 | unlock_rport: | ||
2434 | if (in_scsi_eh) | ||
2435 | mutex_unlock(&rport->mutex); | ||
2436 | |||
2437 | return ret; | ||
2438 | 2421 | ||
2439 | err_unmap: | 2422 | err_unmap: |
2440 | srp_unmap_data(scmnd, ch, req); | 2423 | srp_unmap_data(scmnd, ch, req); |
@@ -2456,7 +2439,7 @@ err: | |||
2456 | ret = SCSI_MLQUEUE_HOST_BUSY; | 2439 | ret = SCSI_MLQUEUE_HOST_BUSY; |
2457 | } | 2440 | } |
2458 | 2441 | ||
2459 | goto unlock_rport; | 2442 | return ret; |
2460 | } | 2443 | } |
2461 | 2444 | ||
2462 | /* | 2445 | /* |