Commit 6fa2c95f authored by Stefan Hajnoczi's avatar Stefan Hajnoczi Committed by Kevin Wolf
Browse files

scsi-disk: Move active request asserts



SCSI read/write requests should not be re-issued before the current
fragment of I/O completes.  There are asserts in scsi-disk.c that guard
this constraint but they trigger on SPARC Linux 2.4.  It turns out that
the asserts are too early in the code path and don't allow for read
requests to terminate.

Only the read assert needs to be moved but move the write assert too for
consistency.

Reported-by: default avatarNigel Horne <njh@bandsman.co.uk>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent f711df67
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -170,6 +170,9 @@ static void scsi_read_request(SCSIDiskReq *r)
        return;
    }

    /* No data transfer may already be in progress */
    assert(r->req.aiocb == NULL);

    n = r->sector_count;
    if (n > SCSI_DMA_BUF_SIZE / 512)
        n = SCSI_DMA_BUF_SIZE / 512;
@@ -197,9 +200,6 @@ static void scsi_read_data(SCSIDevice *d, uint32_t tag)
        return;
    }

    /* No data transfer may already be in progress */
    assert(r->req.aiocb == NULL);

    scsi_read_request(r);
}

@@ -269,6 +269,9 @@ static void scsi_write_request(SCSIDiskReq *r)
    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
    uint32_t n;

    /* No data transfer may already be in progress */
    assert(r->req.aiocb == NULL);

    n = r->iov.iov_len / 512;
    if (n) {
        qemu_iovec_init_external(&r->qiov, &r->iov, 1);
@@ -298,9 +301,6 @@ static int scsi_write_data(SCSIDevice *d, uint32_t tag)
        return 1;
    }

    /* No data transfer may already be in progress */
    assert(r->req.aiocb == NULL);

    scsi_write_request(r);

    return 0;