Commit c0ed79a3 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[SCSI] sd: fix issue_flush

sd_issue_flush() is called from atomic context so we can't use the
semaphore based routines to get a reference to the scsi_disk.  Assume
something else already got the reference so we can safely use it.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 2ef89198
...@@ -769,20 +769,16 @@ static void sd_end_flush(request_queue_t *q, struct request *flush_rq) ...@@ -769,20 +769,16 @@ static void sd_end_flush(request_queue_t *q, struct request *flush_rq)
static int sd_prepare_flush(request_queue_t *q, struct request *rq) static int sd_prepare_flush(request_queue_t *q, struct request *rq)
{ {
struct scsi_device *sdev = q->queuedata; struct scsi_device *sdev = q->queuedata;
struct scsi_disk *sdkp = scsi_disk_get_from_dev(&sdev->sdev_gendev); struct scsi_disk *sdkp = dev_get_drvdata(&sdev->sdev_gendev);
int ret = 0;
if (sdkp) { if (!sdkp || !sdkp->WCE)
if (sdkp->WCE) { return 0;
memset(rq->cmd, 0, sizeof(rq->cmd));
rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER; memset(rq->cmd, 0, sizeof(rq->cmd));
rq->timeout = SD_TIMEOUT; rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER;
rq->cmd[0] = SYNCHRONIZE_CACHE; rq->timeout = SD_TIMEOUT;
ret = 1; rq->cmd[0] = SYNCHRONIZE_CACHE;
} return 1;
scsi_disk_put(sdkp);
}
return ret;
} }
static void sd_rescan(struct device *dev) static void sd_rescan(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment