Skip to content

Commit

Permalink
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/jejb/scsi

Pull SCSI updates from James Bottomley:
 "Updates to the usual drivers (target, ufs, smartpqi, lpfc).

  There are some core changes, mostly around reworking some of our user
  context assumptions in device put and moving some code around.

  The remaining updates are bug fixes and minor changes"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (138 commits)
  scsi: sg: Fix get_user() in call sg_scsi_ioctl()
  scsi: megaraid_sas: Fix some spelling mistakes in comment
  scsi: core: Use SCSI_SCAN_INITIAL in do_scsi_scan_host()
  scsi: core: Use SCSI_SCAN_RESCAN in __scsi_add_device()
  scsi: ufs: ufs-mediatek: Remove unnecessary return code
  scsi: ufs: core: Fix the polling implementation
  scsi: libsas: Do not export sas_ata_wait_after_reset()
  scsi: hisi_sas: Fix SATA devices missing issue during I_T nexus reset
  scsi: libsas: Add smp_ata_check_ready_type()
  scsi: Revert "scsi: hisi_sas: Don't send bcast events from HW during nexus HA reset"
  scsi: Revert "scsi: hisi_sas: Drain bcast events in hisi_sas_rescan_topology()"
  scsi: ufs: ufs-mediatek: Modify the return value
  scsi: ufs: ufs-mediatek: Remove unneeded code
  scsi: device_handler: alua: Call scsi_device_put() from non-atomic context
  scsi: device_handler: alua: Revert "Move a scsi_device_put() call out of alua_check_vpd()"
  scsi: snic: Fix possible UAF in snic_tgt_create()
  scsi: qla2xxx: Initialize vha->unknown_atio_[list, work] for NPIV hosts
  scsi: qla2xxx: Remove duplicate of vha->iocb_work initialization
  scsi: fcoe: Fix transport not deattached when fcoe_if_init() fails
  scsi: sd: Use 16-byte SYNCHRONIZE CACHE on ZBC devices
  ...
  • Loading branch information
torvalds committed Dec 14, 2022
2 parents e2ca6ba + 4e80eef commit aa5ad10
Show file tree
Hide file tree
Showing 103 changed files with 2,535 additions and 1,191 deletions.
7 changes: 5 additions & 2 deletions Documentation/scsi/scsi_eh.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,17 @@ The timeout handler is scsi_timeout(). When a timeout occurs, this function
1. invokes optional hostt->eh_timed_out() callback. Return value can
be one of

- BLK_EH_RESET_TIMER
- SCSI_EH_RESET_TIMER
This indicates that more time is required to finish the
command. Timer is restarted.

- BLK_EH_DONE
- SCSI_EH_NOT_HANDLED
eh_timed_out() callback did not handle the command.
Step #2 is taken.

- SCSI_EH_DONE
eh_timed_out() completed the command.

2. scsi_abort_command() is invoked to schedule an asynchronous abort which may
issue a retry scmd->allowed + 1 times. Asynchronous aborts are not invoked
for commands for which the SCSI_EH_ABORT_SCHEDULED flag is set (this
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -9362,7 +9362,7 @@ F: Documentation/devicetree/bindings/infiniband/hisilicon-hns-roce.txt
F: drivers/infiniband/hw/hns/

HISILICON SAS Controller
M: John Garry <john.garry@huawei.com>
M: Xiang Chen <chenxiang66@hisilicon.com>
S: Supported
W: http://www.hisilicon.com
F: Documentation/devicetree/bindings/scsi/hisilicon-sas.txt
Expand Down
2 changes: 0 additions & 2 deletions drivers/message/fusion/mptctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,6 @@ static struct mpt_pci_driver mptctl_driver = {
static int __init mptctl_init(void)
{
int err;
int where = 1;

show_mptmod_ver(my_NAME, my_VERSION);

Expand All @@ -2898,7 +2897,6 @@ static int __init mptctl_init(void)
/*
* Install our handler
*/
++where;
mptctl_id = mpt_register(mptctl_reply, MPTCTL_DRIVER,
"mptctl_reply");
if (!mptctl_id || mptctl_id >= MPT_MAX_PROTOCOL_DRIVERS) {
Expand Down
8 changes: 4 additions & 4 deletions drivers/message/fusion/mptsas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1952,12 +1952,12 @@ mptsas_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
* @sc: scsi command that the midlayer is about to time out
*
**/
static enum blk_eh_timer_return mptsas_eh_timed_out(struct scsi_cmnd *sc)
static enum scsi_timeout_action mptsas_eh_timed_out(struct scsi_cmnd *sc)
{
MPT_SCSI_HOST *hd;
MPT_ADAPTER *ioc;
VirtDevice *vdevice;
enum blk_eh_timer_return rc = BLK_EH_DONE;
enum scsi_timeout_action rc = SCSI_EH_NOT_HANDLED;

hd = shost_priv(sc->device->host);
if (hd == NULL) {
Expand All @@ -1980,15 +1980,15 @@ static enum blk_eh_timer_return mptsas_eh_timed_out(struct scsi_cmnd *sc)
dtmprintk(ioc, printk(MYIOC_s_WARN_FMT ": %s: ioc is in reset,"
"SML need to reset the timer (sc=%p)\n",
ioc->name, __func__, sc));
rc = BLK_EH_RESET_TIMER;
rc = SCSI_EH_RESET_TIMER;
}
vdevice = sc->device->hostdata;
if (vdevice && vdevice->vtarget && (vdevice->vtarget->inDMD
|| vdevice->vtarget->deleted)) {
dtmprintk(ioc, printk(MYIOC_s_WARN_FMT ": %s: target removed "
"or in device removal delay (sc=%p)\n",
ioc->name, __func__, sc));
rc = BLK_EH_RESET_TIMER;
rc = SCSI_EH_RESET_TIMER;
goto done;
}

Expand Down
6 changes: 2 additions & 4 deletions drivers/scsi/BusLogic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ static int blogic_slaveconfig(struct scsi_device *dev)

static int __init blogic_init(void)
{
int adapter_count = 0, drvr_optindex = 0, probeindex;
int drvr_optindex = 0, probeindex;
struct blogic_adapter *adapter;
int ret = 0;

Expand Down Expand Up @@ -2368,10 +2368,8 @@ static int __init blogic_init(void)
list_del(&myadapter->host_list);
scsi_host_put(host);
ret = -ENODEV;
} else {
} else
scsi_scan_host(host);
adapter_count++;
}
}
} else {
/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/NCR5380.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ static void NCR5380_dma_complete(struct Scsi_Host *instance)
* latency, but a bus reset will reset chip logic. Checking for parity error
* is unnecessary because that interrupt is never enabled. A Loss of BSY
* condition will clear DMA Mode. We can tell when this occurs because the
* the Busy Monitor interrupt is enabled together with DMA Mode.
* Busy Monitor interrupt is enabled together with DMA Mode.
*/

static irqreturn_t __maybe_unused NCR5380_intr(int irq, void *dev_id)
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/bfa/bfa_fc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ enum fdmi_port_attribute_type {
struct fdmi_attr_s {
__be16 type;
__be16 len;
u8 value[1];
u8 value[];
};

/*
Expand Down
29 changes: 29 additions & 0 deletions drivers/scsi/bfa/bfad_bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2540,6 +2540,35 @@ bfad_iocmd_vf_clr_stats(struct bfad_s *bfad, void *cmd)
return 0;
}

/*
* Set the SCSI device sdev_bflags - sdev_bflags are used by the
* SCSI mid-layer to choose LUN Scanning mode REPORT_LUNS vs. Sequential Scan
*
* Internally iterates over all the ITNIM's part of the im_port & sets the
* sdev_bflags for the scsi_device associated with LUN #0.
*/
static void bfad_reset_sdev_bflags(struct bfad_im_port_s *im_port,
int lunmask_cfg)
{
const u32 scan_flags = BLIST_NOREPORTLUN | BLIST_SPARSELUN;
struct bfad_itnim_s *itnim;
struct scsi_device *sdev;
unsigned long flags;

spin_lock_irqsave(im_port->shost->host_lock, flags);
list_for_each_entry(itnim, &im_port->itnim_mapped_list, list_entry) {
sdev = __scsi_device_lookup(im_port->shost, itnim->channel,
itnim->scsi_tgt_id, 0);
if (sdev) {
if (lunmask_cfg == BFA_TRUE)
sdev->sdev_bflags |= scan_flags;
else
sdev->sdev_bflags &= ~scan_flags;
}
}
spin_unlock_irqrestore(im_port->shost->host_lock, flags);
}

/* Function to reset the LUN SCAN mode */
static void
bfad_iocmd_lunmask_reset_lunscan_mode(struct bfad_s *bfad, int lunmask_cfg)
Expand Down
26 changes: 0 additions & 26 deletions drivers/scsi/bfa/bfad_im.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,30 +198,4 @@ irqreturn_t bfad_intx(int irq, void *dev_id);
int bfad_im_bsg_request(struct bsg_job *job);
int bfad_im_bsg_timeout(struct bsg_job *job);

/*
* Macro to set the SCSI device sdev_bflags - sdev_bflags are used by the
* SCSI mid-layer to choose LUN Scanning mode REPORT_LUNS vs. Sequential Scan
*
* Internally iterate's over all the ITNIM's part of the im_port & set's the
* sdev_bflags for the scsi_device associated with LUN #0.
*/
#define bfad_reset_sdev_bflags(__im_port, __lunmask_cfg) do { \
struct scsi_device *__sdev = NULL; \
struct bfad_itnim_s *__itnim = NULL; \
u32 scan_flags = BLIST_NOREPORTLUN | BLIST_SPARSELUN; \
list_for_each_entry(__itnim, &((__im_port)->itnim_mapped_list), \
list_entry) { \
__sdev = scsi_device_lookup((__im_port)->shost, \
__itnim->channel, \
__itnim->scsi_tgt_id, 0); \
if (__sdev) { \
if ((__lunmask_cfg) == BFA_TRUE) \
__sdev->sdev_bflags |= scan_flags; \
else \
__sdev->sdev_bflags &= ~scan_flags; \
scsi_device_put(__sdev); \
} \
} \
} while (0)

#endif
3 changes: 1 addition & 2 deletions drivers/scsi/csiostor/csio_wr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,6 @@ csio_wr_process_fl(struct csio_hw *hw, struct csio_q *q,
struct csio_fl_dma_buf flb;
struct csio_dma_buf *buf, *fbuf;
uint32_t bufsz, len, lastlen = 0;
int n;
struct csio_q *flq = hw->wrm.q_arr[q->un.iq.flq_idx];

CSIO_DB_ASSERT(flq != NULL);
Expand All @@ -1071,7 +1070,7 @@ csio_wr_process_fl(struct csio_hw *hw, struct csio_q *q,
flb.totlen = len;

/* Consume all freelist buffers used for len bytes */
for (n = 0, fbuf = flb.flbufs; ; n++, fbuf++) {
for (fbuf = flb.flbufs; ; fbuf++) {
buf = &flq->un.fl.bufs[flq->cidx];
bufsz = csio_wr_fl_bufsz(sge, buf);

Expand Down
65 changes: 43 additions & 22 deletions drivers/scsi/device_handler/scsi_dh_alua.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
"%s: port group %x rel port %x\n",
ALUA_DH_NAME, group_id, rel_port);

kref_get(&pg->kref);

/* Check for existing port group references */
spin_lock(&h->pg_lock);
old_pg = rcu_dereference_protected(h->pg, lockdep_is_held(&h->pg_lock));
Expand All @@ -373,11 +375,11 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
list_add_rcu(&h->node, &pg->dh_list);
spin_unlock_irqrestore(&pg->lock, flags);

alua_rtpg_queue(rcu_dereference_protected(h->pg,
lockdep_is_held(&h->pg_lock)),
sdev, NULL, true);
spin_unlock(&h->pg_lock);

alua_rtpg_queue(pg, sdev, NULL, true);
kref_put(&pg->kref, release_port_group);

if (old_pg)
kref_put(&old_pg->kref, release_port_group);

Expand Down Expand Up @@ -811,14 +813,19 @@ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_port_group *pg)
return SCSI_DH_RETRY;
}

static bool alua_rtpg_select_sdev(struct alua_port_group *pg)
/*
* The caller must call scsi_device_put() on the returned pointer if it is not
* NULL.
*/
static struct scsi_device * __must_check
alua_rtpg_select_sdev(struct alua_port_group *pg)
{
struct alua_dh_data *h;
struct scsi_device *sdev = NULL;
struct scsi_device *sdev = NULL, *prev_sdev;

lockdep_assert_held(&pg->lock);
if (WARN_ON(!pg->rtpg_sdev))
return false;
return NULL;

/*
* RCU protection isn't necessary for dh_list here
Expand All @@ -845,22 +852,22 @@ static bool alua_rtpg_select_sdev(struct alua_port_group *pg)
pr_warn("%s: no device found for rtpg\n",
(pg->device_id_len ?
(char *)pg->device_id_str : "(nameless PG)"));
return false;
return NULL;
}

sdev_printk(KERN_INFO, sdev, "rtpg retry on different device\n");

scsi_device_put(pg->rtpg_sdev);
prev_sdev = pg->rtpg_sdev;
pg->rtpg_sdev = sdev;

return true;
return prev_sdev;
}

static void alua_rtpg_work(struct work_struct *work)
{
struct alua_port_group *pg =
container_of(work, struct alua_port_group, rtpg_work.work);
struct scsi_device *sdev;
struct scsi_device *sdev, *prev_sdev = NULL;
LIST_HEAD(qdata_list);
int err = SCSI_DH_OK;
struct alua_queue_data *qdata, *tmp;
Expand Down Expand Up @@ -901,7 +908,7 @@ static void alua_rtpg_work(struct work_struct *work)

/* If RTPG failed on the current device, try using another */
if (err == SCSI_DH_RES_TEMP_UNAVAIL &&
alua_rtpg_select_sdev(pg))
(prev_sdev = alua_rtpg_select_sdev(pg)))
err = SCSI_DH_IMM_RETRY;

if (err == SCSI_DH_RETRY || err == SCSI_DH_IMM_RETRY ||
Expand All @@ -913,9 +920,7 @@ static void alua_rtpg_work(struct work_struct *work)
pg->interval = ALUA_RTPG_RETRY_DELAY;
pg->flags |= ALUA_PG_RUN_RTPG;
spin_unlock_irqrestore(&pg->lock, flags);
queue_delayed_work(kaluad_wq, &pg->rtpg_work,
pg->interval * HZ);
return;
goto queue_rtpg;
}
if (err != SCSI_DH_OK)
pg->flags &= ~ALUA_PG_RUN_STPG;
Expand All @@ -930,9 +935,7 @@ static void alua_rtpg_work(struct work_struct *work)
pg->interval = 0;
pg->flags &= ~ALUA_PG_RUNNING;
spin_unlock_irqrestore(&pg->lock, flags);
queue_delayed_work(kaluad_wq, &pg->rtpg_work,
pg->interval * HZ);
return;
goto queue_rtpg;
}
}

Expand All @@ -946,6 +949,9 @@ static void alua_rtpg_work(struct work_struct *work)
pg->rtpg_sdev = NULL;
spin_unlock_irqrestore(&pg->lock, flags);

if (prev_sdev)
scsi_device_put(prev_sdev);

list_for_each_entry_safe(qdata, tmp, &qdata_list, entry) {
list_del(&qdata->entry);
if (qdata->callback_fn)
Expand All @@ -957,6 +963,12 @@ static void alua_rtpg_work(struct work_struct *work)
spin_unlock_irqrestore(&pg->lock, flags);
scsi_device_put(sdev);
kref_put(&pg->kref, release_port_group);
return;

queue_rtpg:
if (prev_sdev)
scsi_device_put(prev_sdev);
queue_delayed_work(kaluad_wq, &pg->rtpg_work, pg->interval * HZ);
}

/**
Expand All @@ -976,6 +988,9 @@ static bool alua_rtpg_queue(struct alua_port_group *pg,
{
int start_queue = 0;
unsigned long flags;

might_sleep();

if (WARN_ON_ONCE(!pg) || scsi_device_get(sdev))
return false;

Expand All @@ -986,11 +1001,17 @@ static bool alua_rtpg_queue(struct alua_port_group *pg,
force = true;
}
if (pg->rtpg_sdev == NULL) {
pg->interval = 0;
pg->flags |= ALUA_PG_RUN_RTPG;
kref_get(&pg->kref);
pg->rtpg_sdev = sdev;
start_queue = 1;
struct alua_dh_data *h = sdev->handler_data;

rcu_read_lock();
if (h && rcu_dereference(h->pg) == pg) {
pg->interval = 0;
pg->flags |= ALUA_PG_RUN_RTPG;
kref_get(&pg->kref);
pg->rtpg_sdev = sdev;
start_queue = 1;
}
rcu_read_unlock();
} else if (!(pg->flags & ALUA_PG_RUN_RTPG) && force) {
pg->flags |= ALUA_PG_RUN_RTPG;
/* Do not queue if the worker is already running */
Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/elx/efct/efct_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ efct_device_init(void)

rc = efct_scsi_reg_fc_transport();
if (rc) {
efct_scsi_tgt_driver_exit();
pr_err("failed to register to FC host\n");
return rc;
}
Expand Down
6 changes: 4 additions & 2 deletions drivers/scsi/elx/libefc/efclib.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ enum efc_node_send_ls_acc {
#define EFC_LINK_STATUS_UP 0
#define EFC_LINK_STATUS_DOWN 1

enum efc_sm_event;

/* State machine context header */
struct efc_sm_ctx {
void (*current_state)(struct efc_sm_ctx *ctx,
u32 evt, void *arg);
enum efc_sm_event evt, void *arg);

const char *description;
void *app;
Expand Down Expand Up @@ -365,7 +367,7 @@ struct efc_node {
int prev_evt;

void (*nodedb_state)(struct efc_sm_ctx *ctx,
u32 evt, void *arg);
enum efc_sm_event evt, void *arg);
struct timer_list gidpt_delay_timer;
u64 time_last_gidpt_msec;

Expand Down
Loading

0 comments on commit aa5ad10

Please sign in to comment.