Skip to content

Commit 06caa75

Browse files
committed
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull more SCSI updates from James Bottomley: "Updates that missed the first pull, mostly because of needing more soak time. Driver updates (zfcp, ufs, mpi3mr, plus two ipr bug fixes), an enclosure services (ses) update (mostly bug fixes) and other minor bug fixes and changes" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (32 commits) scsi: zfcp: Trace when request remove fails after qdio send fails scsi: zfcp: Change the type of all fsf request id fields and variables to u64 scsi: zfcp: Make the type for accessing request hashtable buckets size_t scsi: ufs: core: Simplify ufshcd_execute_start_stop() scsi: ufs: core: Rely on the block layer for setting RQF_PM scsi: core: Extend struct scsi_exec_args scsi: lpfc: Fix double word in comments scsi: core: Remove the /proc/scsi/${proc_name} directory earlier scsi: core: Fix a source code comment scsi: cxgbi: Remove unneeded version.h include scsi: qedi: Remove unneeded version.h include scsi: mpi3mr: Remove unneeded version.h include scsi: mpi3mr: Fix missing mrioc->evtack_cmds initialization scsi: mpi3mr: Use number of bits to manage bitmap sizes scsi: mpi3mr: Remove unnecessary memcpy() to alltgt_info->dmi scsi: mpi3mr: Fix issues in mpi3mr_get_all_tgt_info() scsi: mpi3mr: Fix an issue found by KASAN scsi: mpi3mr: Replace 1-element array with flex-array scsi: ipr: Work around fortify-string warning scsi: ipr: Make ipr_probe_ioa_part2() return void ...
2 parents 0a3f9a6 + 901b894 commit 06caa75

36 files changed

+291
-252
lines changed

drivers/s390/scsi/zfcp_dbf.c

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Debug traces for zfcp.
66
*
7-
* Copyright IBM Corp. 2002, 2020
7+
* Copyright IBM Corp. 2002, 2023
88
*/
99

1010
#define KMSG_COMPONENT "zfcp"
@@ -145,6 +145,48 @@ void zfcp_dbf_hba_fsf_fces(char *tag, const struct zfcp_fsf_req *req, u64 wwpn,
145145
spin_unlock_irqrestore(&dbf->hba_lock, flags);
146146
}
147147

148+
/**
149+
* zfcp_dbf_hba_fsf_reqid - trace only the tag and a request ID
150+
* @tag: tag documenting the source
151+
* @level: trace level
152+
* @adapter: adapter instance the request ID belongs to
153+
* @req_id: the request ID to trace
154+
*/
155+
void zfcp_dbf_hba_fsf_reqid(const char *const tag, const int level,
156+
struct zfcp_adapter *const adapter,
157+
const u64 req_id)
158+
{
159+
struct zfcp_dbf *const dbf = adapter->dbf;
160+
struct zfcp_dbf_hba *const rec = &dbf->hba_buf;
161+
struct zfcp_dbf_hba_res *const res = &rec->u.res;
162+
unsigned long flags;
163+
164+
if (unlikely(!debug_level_enabled(dbf->hba, level)))
165+
return;
166+
167+
spin_lock_irqsave(&dbf->hba_lock, flags);
168+
memset(rec, 0, sizeof(*rec));
169+
170+
memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
171+
172+
rec->id = ZFCP_DBF_HBA_RES;
173+
rec->fsf_req_id = req_id;
174+
rec->fsf_req_status = ~0u;
175+
rec->fsf_cmd = ~0u;
176+
rec->fsf_seq_no = ~0u;
177+
178+
res->req_issued = ~0ull;
179+
res->prot_status = ~0u;
180+
memset(res->prot_status_qual, 0xff, sizeof(res->prot_status_qual));
181+
res->fsf_status = ~0u;
182+
memset(res->fsf_status_qual, 0xff, sizeof(res->fsf_status_qual));
183+
res->port_handle = ~0u;
184+
res->lun_handle = ~0u;
185+
186+
debug_event(dbf->hba, level, rec, sizeof(*rec));
187+
spin_unlock_irqrestore(&dbf->hba_lock, flags);
188+
}
189+
148190
/**
149191
* zfcp_dbf_hba_fsf_uss - trace event for an unsolicited status buffer
150192
* @tag: tag indicating which kind of unsolicited status has been received
@@ -649,7 +691,7 @@ void zfcp_dbf_scsi_common(char *tag, int level, struct scsi_device *sdev,
649691
rec->scsi_id = sc->device->id;
650692
rec->scsi_lun = (u32)sc->device->lun;
651693
rec->scsi_lun_64_hi = (u32)(sc->device->lun >> 32);
652-
rec->host_scribble = (unsigned long)sc->host_scribble;
694+
rec->host_scribble = (u64)sc->host_scribble;
653695

654696
memcpy(rec->scsi_opcode, sc->cmnd,
655697
min_t(int, sc->cmd_len, ZFCP_DBF_SCSI_OPCODE));

drivers/s390/scsi/zfcp_def.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ struct zfcp_erp_action {
129129
struct scsi_device *sdev;
130130
u32 status; /* recovery status */
131131
enum zfcp_erp_steps step; /* active step of this erp action */
132-
unsigned long fsf_req_id;
132+
u64 fsf_req_id;
133133
struct timer_list timer;
134134
};
135135

@@ -163,7 +163,7 @@ struct zfcp_adapter {
163163
struct Scsi_Host *scsi_host; /* Pointer to mid-layer */
164164
struct list_head port_list; /* remote port list */
165165
rwlock_t port_list_lock; /* port list lock */
166-
unsigned long req_no; /* unique FSF req number */
166+
u64 req_no; /* unique FSF req number */
167167
struct zfcp_reqlist *req_list;
168168
u32 fsf_req_seq_no; /* FSF cmnd seq number */
169169
rwlock_t abort_lock; /* Protects against SCSI
@@ -325,7 +325,7 @@ static inline u64 zfcp_scsi_dev_lun(struct scsi_device *sdev)
325325
*/
326326
struct zfcp_fsf_req {
327327
struct list_head list;
328-
unsigned long req_id;
328+
u64 req_id;
329329
struct zfcp_adapter *adapter;
330330
struct zfcp_qdio_req qdio_req;
331331
struct completion completion;

drivers/s390/scsi/zfcp_ext.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* External function declarations.
66
*
7-
* Copyright IBM Corp. 2002, 2020
7+
* Copyright IBM Corp. 2002, 2023
88
*/
99

1010
#ifndef ZFCP_EXT_H
@@ -46,6 +46,9 @@ extern void zfcp_dbf_hba_fsf_res(char *, int, struct zfcp_fsf_req *);
4646
extern void zfcp_dbf_hba_fsf_fces(char *tag, const struct zfcp_fsf_req *req,
4747
u64 wwpn, u32 fc_security_old,
4848
u32 fc_security_new);
49+
extern void zfcp_dbf_hba_fsf_reqid(const char *const tag, const int level,
50+
struct zfcp_adapter *const adapter,
51+
const u64 req_id);
4952
extern void zfcp_dbf_hba_bit_err(char *, struct zfcp_fsf_req *);
5053
extern void zfcp_dbf_hba_def_err(struct zfcp_adapter *, u64, u16, void **);
5154
extern void zfcp_dbf_san_req(char *, struct zfcp_fsf_req *, u32);

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Implementation of FSF commands.
66
*
7-
* Copyright IBM Corp. 2002, 2020
7+
* Copyright IBM Corp. 2002, 2023
88
*/
99

1010
#define KMSG_COMPONENT "zfcp"
@@ -884,16 +884,19 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
884884
const bool is_srb = zfcp_fsf_req_is_status_read_buffer(req);
885885
struct zfcp_adapter *adapter = req->adapter;
886886
struct zfcp_qdio *qdio = adapter->qdio;
887-
unsigned long req_id = req->req_id;
887+
u64 req_id = req->req_id;
888888

889889
zfcp_reqlist_add(adapter->req_list, req);
890890

891891
req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q_free);
892892
req->issued = get_tod_clock();
893893
if (zfcp_qdio_send(qdio, &req->qdio_req)) {
894894
del_timer_sync(&req->timer);
895+
895896
/* lookup request again, list might have changed */
896-
zfcp_reqlist_find_rm(adapter->req_list, req_id);
897+
if (zfcp_reqlist_find_rm(adapter->req_list, req_id) == NULL)
898+
zfcp_dbf_hba_fsf_reqid("fsrsrmf", 1, adapter, req_id);
899+
897900
zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1");
898901
return -EIO;
899902
}
@@ -1042,7 +1045,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
10421045
struct scsi_device *sdev = scmnd->device;
10431046
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
10441047
struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio;
1045-
unsigned long old_req_id = (unsigned long) scmnd->host_scribble;
1048+
u64 old_req_id = (u64) scmnd->host_scribble;
10461049

10471050
spin_lock_irq(&qdio->req_q_lock);
10481051
if (zfcp_qdio_sbal_get(qdio))
@@ -1065,7 +1068,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
10651068
req->handler = zfcp_fsf_abort_fcp_command_handler;
10661069
req->qtcb->header.lun_handle = zfcp_sdev->lun_handle;
10671070
req->qtcb->header.port_handle = zfcp_sdev->port->handle;
1068-
req->qtcb->bottom.support.req_handle = (u64) old_req_id;
1071+
req->qtcb->bottom.support.req_handle = old_req_id;
10691072

10701073
zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT);
10711074
if (!zfcp_fsf_req_send(req)) {
@@ -1919,7 +1922,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
19191922
{
19201923
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
19211924
struct zfcp_fsf_req *req;
1922-
unsigned long req_id = 0;
1925+
u64 req_id = 0;
19231926
int retval = -EIO;
19241927

19251928
spin_lock_irq(&qdio->req_q_lock);
@@ -1978,7 +1981,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
19781981
{
19791982
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
19801983
struct zfcp_fsf_req *req;
1981-
unsigned long req_id = 0;
1984+
u64 req_id = 0;
19821985
int retval = -EIO;
19831986

19841987
spin_lock_irq(&qdio->req_q_lock);
@@ -2587,6 +2590,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd)
25872590
goto out;
25882591
}
25892592

2593+
BUILD_BUG_ON(sizeof(scsi_cmnd->host_scribble) < sizeof(req->req_id));
25902594
scsi_cmnd->host_scribble = (unsigned char *) req->req_id;
25912595

25922596
io = &req->qtcb->bottom.io;
@@ -2732,7 +2736,7 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
27322736
struct qdio_buffer *sbal = qdio->res_q[sbal_idx];
27332737
struct qdio_buffer_element *sbale;
27342738
struct zfcp_fsf_req *fsf_req;
2735-
unsigned long req_id;
2739+
u64 req_id;
27362740
int idx;
27372741

27382742
for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) {
@@ -2747,7 +2751,7 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
27472751
* corruption and must stop the machine immediately.
27482752
*/
27492753
zfcp_qdio_siosl(adapter);
2750-
panic("error: unknown req_id (%lx) on adapter %s.\n",
2754+
panic("error: unknown req_id (%llx) on adapter %s.\n",
27512755
req_id, dev_name(&adapter->ccw_device->dev));
27522756
}
27532757

drivers/s390/scsi/zfcp_qdio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ zfcp_qdio_sbale_curr(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req)
115115
*/
116116
static inline
117117
void zfcp_qdio_req_init(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,
118-
unsigned long req_id, u8 sbtype, void *data, u32 len)
118+
u64 req_id, u8 sbtype, void *data, u32 len)
119119
{
120120
struct qdio_buffer_element *sbale;
121121
int count = min(atomic_read(&qdio->req_q_free),

drivers/s390/scsi/zfcp_reqlist.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
* Data structure and helper functions for tracking pending FSF
66
* requests.
77
*
8-
* Copyright IBM Corp. 2009, 2016
8+
* Copyright IBM Corp. 2009, 2023
99
*/
1010

1111
#ifndef ZFCP_REQLIST_H
1212
#define ZFCP_REQLIST_H
1313

14+
#include <linux/types.h>
15+
1416
/* number of hash buckets */
15-
#define ZFCP_REQ_LIST_BUCKETS 128
17+
#define ZFCP_REQ_LIST_BUCKETS 128u
1618

1719
/**
1820
* struct zfcp_reqlist - Container for request list (reqlist)
@@ -24,7 +26,7 @@ struct zfcp_reqlist {
2426
struct list_head buckets[ZFCP_REQ_LIST_BUCKETS];
2527
};
2628

27-
static inline int zfcp_reqlist_hash(unsigned long req_id)
29+
static inline size_t zfcp_reqlist_hash(u64 req_id)
2830
{
2931
return req_id % ZFCP_REQ_LIST_BUCKETS;
3032
}
@@ -37,7 +39,7 @@ static inline int zfcp_reqlist_hash(unsigned long req_id)
3739
*/
3840
static inline struct zfcp_reqlist *zfcp_reqlist_alloc(void)
3941
{
40-
unsigned int i;
42+
size_t i;
4143
struct zfcp_reqlist *rl;
4244

4345
rl = kzalloc(sizeof(struct zfcp_reqlist), GFP_KERNEL);
@@ -60,7 +62,7 @@ static inline struct zfcp_reqlist *zfcp_reqlist_alloc(void)
6062
*/
6163
static inline int zfcp_reqlist_isempty(struct zfcp_reqlist *rl)
6264
{
63-
unsigned int i;
65+
size_t i;
6466

6567
for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)
6668
if (!list_empty(&rl->buckets[i]))
@@ -81,10 +83,10 @@ static inline void zfcp_reqlist_free(struct zfcp_reqlist *rl)
8183
}
8284

8385
static inline struct zfcp_fsf_req *
84-
_zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
86+
_zfcp_reqlist_find(struct zfcp_reqlist *rl, u64 req_id)
8587
{
8688
struct zfcp_fsf_req *req;
87-
unsigned int i;
89+
size_t i;
8890

8991
i = zfcp_reqlist_hash(req_id);
9092
list_for_each_entry(req, &rl->buckets[i], list)
@@ -102,7 +104,7 @@ _zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
102104
* or NULL if there is no known FSF request with this id.
103105
*/
104106
static inline struct zfcp_fsf_req *
105-
zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
107+
zfcp_reqlist_find(struct zfcp_reqlist *rl, u64 req_id)
106108
{
107109
unsigned long flags;
108110
struct zfcp_fsf_req *req;
@@ -127,7 +129,7 @@ zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
127129
* NULL if it has not been found.
128130
*/
129131
static inline struct zfcp_fsf_req *
130-
zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, unsigned long req_id)
132+
zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, u64 req_id)
131133
{
132134
unsigned long flags;
133135
struct zfcp_fsf_req *req;
@@ -154,7 +156,7 @@ zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, unsigned long req_id)
154156
static inline void zfcp_reqlist_add(struct zfcp_reqlist *rl,
155157
struct zfcp_fsf_req *req)
156158
{
157-
unsigned int i;
159+
size_t i;
158160
unsigned long flags;
159161

160162
i = zfcp_reqlist_hash(req->req_id);
@@ -172,7 +174,7 @@ static inline void zfcp_reqlist_add(struct zfcp_reqlist *rl,
172174
static inline void zfcp_reqlist_move(struct zfcp_reqlist *rl,
173175
struct list_head *list)
174176
{
175-
unsigned int i;
177+
size_t i;
176178
unsigned long flags;
177179

178180
spin_lock_irqsave(&rl->lock, flags);
@@ -200,7 +202,7 @@ zfcp_reqlist_apply_for_all(struct zfcp_reqlist *rl,
200202
{
201203
struct zfcp_fsf_req *req;
202204
unsigned long flags;
203-
unsigned int i;
205+
size_t i;
204206

205207
spin_lock_irqsave(&rl->lock, flags);
206208
for (i = 0; i < ZFCP_REQ_LIST_BUCKETS; i++)

drivers/s390/scsi/zfcp_scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
170170
(struct zfcp_adapter *) scsi_host->hostdata[0];
171171
struct zfcp_fsf_req *old_req, *abrt_req;
172172
unsigned long flags;
173-
unsigned long old_reqid = (unsigned long) scpnt->host_scribble;
173+
u64 old_reqid = (u64) scpnt->host_scribble;
174174
int retval = SUCCESS, ret;
175175
int retry = 3;
176176
char *dbf_tag;

drivers/scsi/cxgbi/libcxgbi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <linux/scatterlist.h>
2525
#include <linux/skbuff.h>
2626
#include <linux/vmalloc.h>
27-
#include <linux/version.h>
2827
#include <scsi/scsi_device.h>
2928
#include <scsi/libiscsi_tcp.h>
3029

drivers/scsi/hosts.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ void scsi_remove_host(struct Scsi_Host *shost)
181181
scsi_forget_host(shost);
182182
mutex_unlock(&shost->scan_mutex);
183183
scsi_proc_host_rm(shost);
184+
scsi_proc_hostdir_rm(shost->hostt);
184185

185186
/*
186187
* New SCSI devices cannot be attached anymore because of the SCSI host
@@ -340,6 +341,7 @@ static void scsi_host_dev_release(struct device *dev)
340341
struct Scsi_Host *shost = dev_to_shost(dev);
341342
struct device *parent = dev->parent;
342343

344+
/* In case scsi_remove_host() has not been called. */
343345
scsi_proc_hostdir_rm(shost->hostt);
344346

345347
/* Wait for functions invoked through call_rcu(&scmd->rcu, ...) */
@@ -356,7 +358,7 @@ static void scsi_host_dev_release(struct device *dev)
356358
/*
357359
* Free the shost_dev device name here if scsi_host_alloc()
358360
* and scsi_host_put() have been called but neither
359-
* scsi_host_add() nor scsi_host_remove() has been called.
361+
* scsi_host_add() nor scsi_remove_host() has been called.
360362
* This avoids that the memory allocated for the shost_dev
361363
* name is leaked.
362364
*/

0 commit comments

Comments
 (0)