Skip to content

Commit d3e4501

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Obvious driver patch plus update to sr to add back rotational media flag since CDROMS are rotational" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: sr: Reinstate rotational media flag scsi: lpfc: Fix buffer free/clear order in deferred receive path
2 parents 53b48f6 + 708e237 commit d3e4501

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

drivers/scsi/lpfc/lpfc_nvmet.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,31 +1243,33 @@ lpfc_nvmet_defer_rcv(struct nvmet_fc_target_port *tgtport,
12431243
struct lpfc_nvmet_tgtport *tgtp;
12441244
struct lpfc_async_xchg_ctx *ctxp =
12451245
container_of(rsp, struct lpfc_async_xchg_ctx, hdlrctx.fcp_req);
1246-
struct rqb_dmabuf *nvmebuf = ctxp->rqb_buffer;
1246+
struct rqb_dmabuf *nvmebuf;
12471247
struct lpfc_hba *phba = ctxp->phba;
12481248
unsigned long iflag;
12491249

12501250

12511251
lpfc_nvmeio_data(phba, "NVMET DEFERRCV: xri x%x sz %d CPU %02x\n",
12521252
ctxp->oxid, ctxp->size, raw_smp_processor_id());
12531253

1254+
spin_lock_irqsave(&ctxp->ctxlock, iflag);
1255+
nvmebuf = ctxp->rqb_buffer;
12541256
if (!nvmebuf) {
1257+
spin_unlock_irqrestore(&ctxp->ctxlock, iflag);
12551258
lpfc_printf_log(phba, KERN_INFO, LOG_NVME_IOERR,
12561259
"6425 Defer rcv: no buffer oxid x%x: "
12571260
"flg %x ste %x\n",
12581261
ctxp->oxid, ctxp->flag, ctxp->state);
12591262
return;
12601263
}
1264+
ctxp->rqb_buffer = NULL;
1265+
spin_unlock_irqrestore(&ctxp->ctxlock, iflag);
12611266

12621267
tgtp = phba->targetport->private;
12631268
if (tgtp)
12641269
atomic_inc(&tgtp->rcv_fcp_cmd_defer);
12651270

12661271
/* Free the nvmebuf since a new buffer already replaced it */
12671272
nvmebuf->hrq->rqbp->rqb_free_buffer(phba, nvmebuf);
1268-
spin_lock_irqsave(&ctxp->ctxlock, iflag);
1269-
ctxp->rqb_buffer = NULL;
1270-
spin_unlock_irqrestore(&ctxp->ctxlock, iflag);
12711273
}
12721274

12731275
/**

drivers/scsi/sr.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,13 +475,21 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt)
475475

476476
static int sr_revalidate_disk(struct scsi_cd *cd)
477477
{
478+
struct request_queue *q = cd->device->request_queue;
478479
struct scsi_sense_hdr sshdr;
480+
struct queue_limits lim;
481+
int sector_size;
479482

480483
/* if the unit is not ready, nothing more to do */
481484
if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr))
482485
return 0;
483486
sr_cd_check(&cd->cdi);
484-
return get_sectorsize(cd);
487+
sector_size = get_sectorsize(cd);
488+
489+
lim = queue_limits_start_update(q);
490+
lim.logical_block_size = sector_size;
491+
lim.features |= BLK_FEAT_ROTATIONAL;
492+
return queue_limits_commit_update_frozen(q, &lim);
485493
}
486494

487495
static int sr_block_open(struct gendisk *disk, blk_mode_t mode)
@@ -721,10 +729,8 @@ static int sr_probe(struct device *dev)
721729

722730
static int get_sectorsize(struct scsi_cd *cd)
723731
{
724-
struct request_queue *q = cd->device->request_queue;
725732
static const u8 cmd[10] = { READ_CAPACITY };
726733
unsigned char buffer[8] = { };
727-
struct queue_limits lim;
728734
int err;
729735
int sector_size;
730736
struct scsi_failure failure_defs[] = {
@@ -795,9 +801,7 @@ static int get_sectorsize(struct scsi_cd *cd)
795801
set_capacity(cd->disk, cd->capacity);
796802
}
797803

798-
lim = queue_limits_start_update(q);
799-
lim.logical_block_size = sector_size;
800-
return queue_limits_commit_update_frozen(q, &lim);
804+
return sector_size;
801805
}
802806

803807
static int get_capabilities(struct scsi_cd *cd)

0 commit comments

Comments
 (0)