* [PATCH 0/2] zfcp: small changes for 5.10
@ 2020-09-10 19:49 Benjamin Block
2020-09-10 19:49 ` [PATCH 1/2] zfcp: use list_first_entry_or_null() in zfcp_erp_thread() Benjamin Block
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Benjamin Block @ 2020-09-10 19:49 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: Benjamin Block, Steffen Maier, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Fedor Loshakov, Julian Wiedmann,
linux-scsi, linux-s390
Hello Martin, James,
here are some small changes for zfcp I'd like to include in 5.10 if
possible. They apply cleanly on Martin's `scsi-queue`, and James' `misc`
branches.
Both patches make the driver a bit cleaner, and hopefully easier to
maintain.
Both have been in our CI for quite a while now, running every night. I
also gave them a separate regression run just now with I/O and
error-injects such as cable pulls and other external error sources. So I
am rather confident that they don't break anything for us - apart from
that they're straight forward code changes.
As always, feedback and further reviews are appreciated :-)
Julian Wiedmann (2):
zfcp: use list_first_entry_or_null() in zfcp_erp_thread()
zfcp: clarify access to erp_action in zfcp_fsf_req_complete()
drivers/s390/scsi/zfcp_erp.c | 8 +++-----
drivers/s390/scsi/zfcp_fsf.c | 10 ++++++++--
2 files changed, 11 insertions(+), 7 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] zfcp: use list_first_entry_or_null() in zfcp_erp_thread()
2020-09-10 19:49 [PATCH 0/2] zfcp: small changes for 5.10 Benjamin Block
@ 2020-09-10 19:49 ` Benjamin Block
2020-09-10 19:49 ` [PATCH 2/2] zfcp: clarify access to erp_action in zfcp_fsf_req_complete() Benjamin Block
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Benjamin Block @ 2020-09-10 19:49 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: Julian Wiedmann, Benjamin Block, Steffen Maier, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger, Fedor Loshakov, linux-scsi,
linux-s390
From: Julian Wiedmann <jwi@linux.ibm.com>
Use the right helper to avoid poking around in the list's internals.
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
---
drivers/s390/scsi/zfcp_erp.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 59e662df5774..78d52a4c55f5 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -1607,7 +1607,6 @@ static enum zfcp_erp_act_result zfcp_erp_strategy(
static int zfcp_erp_thread(void *data)
{
struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
- struct list_head *next;
struct zfcp_erp_action *act;
unsigned long flags;
@@ -1620,12 +1619,11 @@ static int zfcp_erp_thread(void *data)
break;
write_lock_irqsave(&adapter->erp_lock, flags);
- next = adapter->erp_ready_head.next;
+ act = list_first_entry_or_null(&adapter->erp_ready_head,
+ struct zfcp_erp_action, list);
write_unlock_irqrestore(&adapter->erp_lock, flags);
- if (next != &adapter->erp_ready_head) {
- act = list_entry(next, struct zfcp_erp_action, list);
-
+ if (act) {
/* there is more to come after dismission, no notify */
if (zfcp_erp_strategy(act) != ZFCP_ERP_DISMISSED)
zfcp_erp_wakeup(adapter);
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] zfcp: clarify access to erp_action in zfcp_fsf_req_complete()
2020-09-10 19:49 [PATCH 0/2] zfcp: small changes for 5.10 Benjamin Block
2020-09-10 19:49 ` [PATCH 1/2] zfcp: use list_first_entry_or_null() in zfcp_erp_thread() Benjamin Block
@ 2020-09-10 19:49 ` Benjamin Block
2020-09-15 22:03 ` [PATCH 0/2] zfcp: small changes for 5.10 Martin K. Petersen
2020-09-22 3:56 ` Martin K. Petersen
3 siblings, 0 replies; 7+ messages in thread
From: Benjamin Block @ 2020-09-10 19:49 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen
Cc: Julian Wiedmann, Benjamin Block, Steffen Maier, Heiko Carstens,
Vasily Gorbik, Christian Borntraeger, Fedor Loshakov, linux-scsi,
linux-s390
From: Julian Wiedmann <jwi@linux.ibm.com>
While reviewing
commit 936e6b85da04 ("scsi: zfcp: Fix panic on ERP timeout for previously
dismissed ERP action"),
I stumbled over zfcp_fsf_req_complete() and wondered whether it has
similar issues wrt concurrent modification of req->erp_action
by zfcp_erp_strategy_check_fsfreq().
But a closer look shows that both its two callers
[zfcp_fsf_reqid_check(), zfcp_fsf_req_dismiss_all()] remove the request
from the adapter's req_list under the req_list's lock.
Hence we can trust that if zfcp_erp_strategy_check_fsfreq() concurrently
looks up the corresponding req_id, it won't find this request and is thus
unable to modify it while it's being processed by zfcp_fsf_req_complete().
Add a code comment that hopefully makes this easier for future readers,
and condense the two accesses to ->erp_action that made me trip over
this code path in the first place.
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
---
drivers/s390/scsi/zfcp_fsf.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index c795f22249d8..d9de26157da2 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -426,9 +426,14 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
* or it has been dismissed due to a queue shutdown, this function
* is called to process the completion status and trigger further
* events related to the FSF request.
+ * Caller must ensure that the request has been removed from
+ * adapter->req_list, to protect against concurrent modification
+ * by zfcp_erp_strategy_check_fsfreq().
*/
static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req)
{
+ struct zfcp_erp_action *erp_action;
+
if (unlikely(zfcp_fsf_req_is_status_read_buffer(req))) {
zfcp_fsf_status_read_handler(req);
return;
@@ -439,8 +444,9 @@ static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req)
zfcp_fsf_fsfstatus_eval(req);
req->handler(req);
- if (req->erp_action)
- zfcp_erp_notify(req->erp_action, 0);
+ erp_action = req->erp_action;
+ if (erp_action)
+ zfcp_erp_notify(erp_action, 0);
if (likely(req->status & ZFCP_STATUS_FSFREQ_CLEANUP))
zfcp_fsf_req_free(req);
--
2.26.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] zfcp: small changes for 5.10
2020-09-10 19:49 [PATCH 0/2] zfcp: small changes for 5.10 Benjamin Block
2020-09-10 19:49 ` [PATCH 1/2] zfcp: use list_first_entry_or_null() in zfcp_erp_thread() Benjamin Block
2020-09-10 19:49 ` [PATCH 2/2] zfcp: clarify access to erp_action in zfcp_fsf_req_complete() Benjamin Block
@ 2020-09-15 22:03 ` Martin K. Petersen
2020-09-22 3:56 ` Martin K. Petersen
3 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2020-09-15 22:03 UTC (permalink / raw)
To: Benjamin Block
Cc: James E.J. Bottomley, Martin K. Petersen, Steffen Maier,
Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
Fedor Loshakov, Julian Wiedmann, linux-scsi, linux-s390
Benjamin,
> here are some small changes for zfcp I'd like to include in 5.10 if
> possible.
Applied to 5.10/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] zfcp: small changes for 5.10
2020-09-10 19:49 [PATCH 0/2] zfcp: small changes for 5.10 Benjamin Block
` (2 preceding siblings ...)
2020-09-15 22:03 ` [PATCH 0/2] zfcp: small changes for 5.10 Martin K. Petersen
@ 2020-09-22 3:56 ` Martin K. Petersen
2020-09-22 10:05 ` Benjamin Block
3 siblings, 1 reply; 7+ messages in thread
From: Martin K. Petersen @ 2020-09-22 3:56 UTC (permalink / raw)
To: Benjamin Block, James E.J. Bottomley
Cc: Martin K . Petersen, linux-scsi, Steffen Maier, linux-s390,
Christian Borntraeger, Heiko Carstens, Julian Wiedmann,
Fedor Loshakov, Vasily Gorbik
On Thu, 10 Sep 2020 21:49:14 +0200, Benjamin Block wrote:
> here are some small changes for zfcp I'd like to include in 5.10 if
> possible. They apply cleanly on Martin's `scsi-queue`, and James' `misc`
> branches.
>
> Both patches make the driver a bit cleaner, and hopefully easier to
> maintain.
>
> [...]
Applied to 5.10/scsi-queue, thanks!
[1/2] scsi: zfcp: Use list_first_entry_or_null() in zfcp_erp_thread()
https://git.kernel.org/mkp/scsi/c/addf13729615
[2/2] scsi: zfcp: Clarify access to erp_action in zfcp_fsf_req_complete()
https://git.kernel.org/mkp/scsi/c/d251193d1732
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] zfcp: small changes for 5.10
2020-09-22 3:56 ` Martin K. Petersen
@ 2020-09-22 10:05 ` Benjamin Block
0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Block @ 2020-09-22 10:05 UTC (permalink / raw)
To: Martin K. Petersen
Cc: James E.J. Bottomley, linux-scsi, Steffen Maier, linux-s390,
Christian Borntraeger, Heiko Carstens, Julian Wiedmann,
Fedor Loshakov, Vasily Gorbik
On Mon, Sep 21, 2020 at 11:56:45PM -0400, Martin K. Petersen wrote:
> On Thu, 10 Sep 2020 21:49:14 +0200, Benjamin Block wrote:
>
> > here are some small changes for zfcp I'd like to include in 5.10 if
> > possible. They apply cleanly on Martin's `scsi-queue`, and James' `misc`
> > branches.
> >
> > Both patches make the driver a bit cleaner, and hopefully easier to
> > maintain.
> >
> > [...]
>
> Applied to 5.10/scsi-queue, thanks!
>
> [1/2] scsi: zfcp: Use list_first_entry_or_null() in zfcp_erp_thread()
> https://git.kernel.org/mkp/scsi/c/addf13729615
> [2/2] scsi: zfcp: Clarify access to erp_action in zfcp_fsf_req_complete()
> https://git.kernel.org/mkp/scsi/c/d251193d1732
>
Thanks Martin!
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Gesch�ftsf�hrung: Dirk Wittkopp
Sitz der Gesellschaft: B�blingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] zfcp: small changes for 5.10
@ 2020-09-22 10:05 ` Benjamin Block
0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Block @ 2020-09-22 10:05 UTC (permalink / raw)
To: Martin K. Petersen
Cc: James E.J. Bottomley, linux-scsi, Steffen Maier, linux-s390,
Christian Borntraeger, Heiko Carstens, Julian Wiedmann,
Fedor Loshakov, Vasily Gorbik
On Mon, Sep 21, 2020 at 11:56:45PM -0400, Martin K. Petersen wrote:
> On Thu, 10 Sep 2020 21:49:14 +0200, Benjamin Block wrote:
>
> > here are some small changes for zfcp I'd like to include in 5.10 if
> > possible. They apply cleanly on Martin's `scsi-queue`, and James' `misc`
> > branches.
> >
> > Both patches make the driver a bit cleaner, and hopefully easier to
> > maintain.
> >
> > [...]
>
> Applied to 5.10/scsi-queue, thanks!
>
> [1/2] scsi: zfcp: Use list_first_entry_or_null() in zfcp_erp_thread()
> https://git.kernel.org/mkp/scsi/c/addf13729615
> [2/2] scsi: zfcp: Clarify access to erp_action in zfcp_fsf_req_complete()
> https://git.kernel.org/mkp/scsi/c/d251193d1732
>
Thanks Martin!
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen / Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-22 10:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 19:49 [PATCH 0/2] zfcp: small changes for 5.10 Benjamin Block
2020-09-10 19:49 ` [PATCH 1/2] zfcp: use list_first_entry_or_null() in zfcp_erp_thread() Benjamin Block
2020-09-10 19:49 ` [PATCH 2/2] zfcp: clarify access to erp_action in zfcp_fsf_req_complete() Benjamin Block
2020-09-15 22:03 ` [PATCH 0/2] zfcp: small changes for 5.10 Martin K. Petersen
2020-09-22 3:56 ` Martin K. Petersen
2020-09-22 10:05 ` Benjamin Block
2020-09-22 10:05 ` Benjamin Block
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.