[GIT PULL] SCSI fixes for 6.17-rc4

James Bottomley posted 1 patch 4 days, 1 hour ago
drivers/scsi/lpfc/lpfc_nvmet.c | 10 ++++++----
drivers/scsi/sr.c              | 16 ++++++++++------
2 files changed, 16 insertions(+), 10 deletions(-)
[GIT PULL] SCSI fixes for 6.17-rc4
Posted by James Bottomley 4 days, 1 hour ago
Obvious driver patch plus update to sr to add back rotational media
flag since CDROMS are rotational.

The patch is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

The short changelog is:

John Evans (1):
      scsi: lpfc: Fix buffer free/clear order in deferred receive path

Ming Lei (1):
      scsi: sr: Reinstate rotational media flag

And the diffstat:

 drivers/scsi/lpfc/lpfc_nvmet.c | 10 ++++++----
 drivers/scsi/sr.c              | 16 ++++++++++------
 2 files changed, 16 insertions(+), 10 deletions(-)

With full diff below.

Regards,

James

---

diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index fba2e62027b7..4cfc928bcf2d 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -1243,7 +1243,7 @@ lpfc_nvmet_defer_rcv(struct nvmet_fc_target_port *tgtport,
 struct lpfc_nvmet_tgtport *tgtp;
 struct lpfc_async_xchg_ctx *ctxp =
 container_of(rsp, struct lpfc_async_xchg_ctx, hdlrctx.fcp_req);
- struct rqb_dmabuf *nvmebuf = ctxp->rqb_buffer;
+ struct rqb_dmabuf *nvmebuf;
 struct lpfc_hba *phba = ctxp->phba;
 unsigned long iflag;
 
@@ -1251,13 +1251,18 @@ lpfc_nvmet_defer_rcv(struct nvmet_fc_target_port *tgtport,
 lpfc_nvmeio_data(phba, "NVMET DEFERRCV: xri x%x sz %d CPU %02x\n",
 ctxp->oxid, ctxp->size, raw_smp_processor_id());
 
+ spin_lock_irqsave(&ctxp->ctxlock, iflag);
+ nvmebuf = ctxp->rqb_buffer;
 if (!nvmebuf) {
+ spin_unlock_irqrestore(&ctxp->ctxlock, iflag);
 lpfc_printf_log(phba, KERN_INFO, LOG_NVME_IOERR,
 "6425 Defer rcv: no buffer oxid x%x: "
 "flg %x ste %x\n",
 ctxp->oxid, ctxp->flag, ctxp->state);
 return;
 }
+ ctxp->rqb_buffer = NULL;
+ spin_unlock_irqrestore(&ctxp->ctxlock, iflag);
 
 tgtp = phba->targetport->private;
 if (tgtp)
@@ -1265,9 +1270,6 @@ lpfc_nvmet_defer_rcv(struct nvmet_fc_target_port *tgtport,
 
 /* Free the nvmebuf since a new buffer already replaced it */
 nvmebuf->hrq->rqbp->rqb_free_buffer(phba, nvmebuf);
- spin_lock_irqsave(&ctxp->ctxlock, iflag);
- ctxp->rqb_buffer = NULL;
- spin_unlock_irqrestore(&ctxp->ctxlock, iflag);
 }
 
 /**
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index b17796d5ee66..add13e306898 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -475,13 +475,21 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt)
 
 static int sr_revalidate_disk(struct scsi_cd *cd)
 {
+ struct request_queue *q = cd->device->request_queue;
 struct scsi_sense_hdr sshdr;
+ struct queue_limits lim;
+ int sector_size;
 
 /* if the unit is not ready, nothing more to do */
 if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr))
 return 0;
 sr_cd_check(&cd->cdi);
- return get_sectorsize(cd);
+ sector_size = get_sectorsize(cd);
+
+ lim = queue_limits_start_update(q);
+ lim.logical_block_size = sector_size;
+ lim.features |= BLK_FEAT_ROTATIONAL;
+ return queue_limits_commit_update_frozen(q, &lim);
 }
 
 static int sr_block_open(struct gendisk *disk, blk_mode_t mode)
@@ -721,10 +729,8 @@ static int sr_probe(struct device *dev)
 
 static int get_sectorsize(struct scsi_cd *cd)
 {
- struct request_queue *q = cd->device->request_queue;
 static const u8 cmd[10] = { READ_CAPACITY };
 unsigned char buffer[8] = { };
- struct queue_limits lim;
 int err;
 int sector_size;
 struct scsi_failure failure_defs[] = {
@@ -795,9 +801,7 @@ static int get_sectorsize(struct scsi_cd *cd)
 set_capacity(cd->disk, cd->capacity);
 }
 
- lim = queue_limits_start_update(q);
- lim.logical_block_size = sector_size;
- return queue_limits_commit_update_frozen(q, &lim);
+ return sector_size;
 }
 
 static int get_capabilities(struct scsi_cd *cd)
Re: [GIT PULL] SCSI fixes for 6.17-rc4
Posted by pr-tracker-bot@kernel.org 3 days, 22 hours ago
The pull request you sent on Fri, 05 Sep 2025 16:03:06 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/d3e45016f75e3efc2366e9060241d38e3fd03a8f

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html