This is a note to let you know that I've just added the patch titled
scsi: qla2xxx: Fix NPIV host cleanup in target mode
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scsi-qla2xxx-fix-npiv-host-cleanup-in-target-mode.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 3be63b1e1838e35ce93e83f19573e949f4b389b4 Mon Sep 17 00:00:00 2001
From: Sawan Chandak <sawan.chandak(a)cavium.com>
Date: Mon, 4 Dec 2017 14:45:04 -0800
Subject: scsi: qla2xxx: Fix NPIV host cleanup in target mode
From: Sawan Chandak <sawan.chandak(a)cavium.com>
commit 3be63b1e1838e35ce93e83f19573e949f4b389b4 upstream.
Add check to make sure we are cleaning up global target host list only
for NPIV hosts
Fixes: bdbe24de281e2 ("scsi: qla2xxx: Cleanup NPIV host in target mode during config teardown")
Cc: <stable(a)vger.kernel.org> # 4.10+
Signed-off-by: Sawan Chandak <sawan.chandak(a)cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani(a)cavium.com>
Reviewed-by: Hannes Reinecke <hare(a)suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/scsi/qla2xxx/qla_target.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1561,8 +1561,11 @@ static void qlt_release(struct qla_tgt *
btree_destroy64(&tgt->lun_qpair_map);
- if (ha->tgt.tgt_ops && ha->tgt.tgt_ops->remove_target)
- ha->tgt.tgt_ops->remove_target(vha);
+ if (vha->vp_idx)
+ if (ha->tgt.tgt_ops &&
+ ha->tgt.tgt_ops->remove_target &&
+ vha->vha_tgt.target_lport_ptr)
+ ha->tgt.tgt_ops->remove_target(vha);
vha->vha_tgt.qla_tgt = NULL;
Patches currently in stable-queue which might be from sawan.chandak(a)cavium.com are
queue-4.14/scsi-qla2xxx-fix-npiv-host-cleanup-in-target-mode.patch
This is a note to let you know that I've just added the patch titled
scsi: qla2xxx: Fix login state machine stuck at GPDB
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 414d9ff3f8039f85d23f619dcbbd1ba2628a1a67 Mon Sep 17 00:00:00 2001
From: Quinn Tran <quinn.tran(a)cavium.com>
Date: Mon, 4 Dec 2017 14:45:03 -0800
Subject: scsi: qla2xxx: Fix login state machine stuck at GPDB
From: Quinn Tran <quinn.tran(a)cavium.com>
commit 414d9ff3f8039f85d23f619dcbbd1ba2628a1a67 upstream.
This patch returns discovery state machine back to Login Complete.
Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
Cc: <stable(a)vger.kernel.org> # 4.10+
Signed-off-by: Quinn Tran <quinn.tran(a)cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani(a)cavium.com>
Reviewed-by: Hannes Reinecke <hare(a)suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/scsi/qla2xxx/qla_init.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -864,6 +864,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_
int rval = ea->rc;
fc_port_t *fcport = ea->fcport;
unsigned long flags;
+ u16 opt = ea->sp->u.iocb_cmd.u.mbx.out_mb[10];
fcport->flags &= ~FCF_ASYNC_SENT;
@@ -894,7 +895,8 @@ void qla24xx_handle_gpdb_event(scsi_qla_
}
spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
- ea->fcport->login_gen++;
+ if (opt != PDO_FORCE_ADISC)
+ ea->fcport->login_gen++;
ea->fcport->deleted = 0;
ea->fcport->logout_on_delete = 1;
@@ -918,6 +920,13 @@ void qla24xx_handle_gpdb_event(scsi_qla_
qla24xx_post_gpsc_work(vha, fcport);
}
+ } else if (ea->fcport->login_succ) {
+ /*
+ * We have an existing session. A late RSCN delivery
+ * must have triggered the session to be re-validate.
+ * session is still valid.
+ */
+ fcport->disc_state = DSC_LOGIN_COMPLETE;
}
spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
} /* gpdb event */
Patches currently in stable-queue which might be from quinn.tran(a)cavium.com are
queue-4.14/scsi-qla2xxx-retry-switch-command-on-time-out.patch
queue-4.14/scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch
queue-4.14/scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch
queue-4.14/scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch
queue-4.14/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch
queue-4.14/scsi-qla2xxx-clear-loop-id-after-delete.patch
queue-4.14/scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch
queue-4.14/scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch
queue-4.14/scsi-qla2xxx-fix-scan-state-field-for-fcport.patch
queue-4.14/scsi-qla2xxx-fix-prli-state-check.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch
queue-4.14/scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch
queue-4.14/scsi-qla2xxx-fix-gpnid-error-processing.patch
queue-4.14/scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch
This is a note to let you know that I've just added the patch titled
scsi: qla2xxx: Fix gpnid error processing
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scsi-qla2xxx-fix-gpnid-error-processing.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 22e786ea47f8795c561e1a01b6a66bb2cae2fc20 Mon Sep 17 00:00:00 2001
From: Quinn Tran <quinn.tran(a)cavium.com>
Date: Mon, 4 Dec 2017 14:44:57 -0800
Subject: scsi: qla2xxx: Fix gpnid error processing
From: Quinn Tran <quinn.tran(a)cavium.com>
commit 22e786ea47f8795c561e1a01b6a66bb2cae2fc20 upstream.
Stop GPNID command from advancing if command has failed.
Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
Cc: <stable(a)vger.kernel.org> # 4.10+
Signed-off-by: Quinn Tran <quinn.tran(a)cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani(a)cavium.com>
Reviewed-by: Hannes Reinecke <hare(a)suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/scsi/qla2xxx/qla_gs.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -3211,6 +3211,11 @@ static void qla2x00_async_gpnid_sp_done(
sp->name, res, ct_req->req.port_id.port_id,
ct_rsp->rsp.gpn_id.port_name);
+ if (res) {
+ sp->free(sp);
+ return;
+ }
+
memset(&ea, 0, sizeof(ea));
memcpy(ea.port_name, ct_rsp->rsp.gpn_id.port_name, WWN_SIZE);
ea.sp = sp;
Patches currently in stable-queue which might be from quinn.tran(a)cavium.com are
queue-4.14/scsi-qla2xxx-retry-switch-command-on-time-out.patch
queue-4.14/scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch
queue-4.14/scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch
queue-4.14/scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch
queue-4.14/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch
queue-4.14/scsi-qla2xxx-clear-loop-id-after-delete.patch
queue-4.14/scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch
queue-4.14/scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch
queue-4.14/scsi-qla2xxx-fix-scan-state-field-for-fcport.patch
queue-4.14/scsi-qla2xxx-fix-prli-state-check.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch
queue-4.14/scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch
queue-4.14/scsi-qla2xxx-fix-gpnid-error-processing.patch
queue-4.14/scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch
This is a note to let you know that I've just added the patch titled
scsi: qla2xxx: Clear loop id after delete
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scsi-qla2xxx-clear-loop-id-after-delete.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From ba743f9148e951abe1c94f89c174ec8e44fb145b Mon Sep 17 00:00:00 2001
From: Quinn Tran <quinn.tran(a)cavium.com>
Date: Mon, 4 Dec 2017 14:45:12 -0800
Subject: scsi: qla2xxx: Clear loop id after delete
From: Quinn Tran <quinn.tran(a)cavium.com>
commit ba743f9148e951abe1c94f89c174ec8e44fb145b upstream.
Clear loop id after delete to prevent session invalidation of stale
session.
Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
Cc: <stable(a)vger.kernel.org> # 4.10+
Signed-off-by: Quinn Tran <quinn.tran(a)cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani(a)cavium.com>
Reviewed-by: Hannes Reinecke <hare(a)suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/scsi/qla2xxx/qla_target.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -974,7 +974,7 @@ static void qlt_free_session_done(struct
qlt_send_first_logo(vha, &logo);
}
- if (sess->logout_on_delete) {
+ if (sess->logout_on_delete && sess->loop_id != FC_NO_LOOP_ID) {
int rc;
rc = qla2x00_post_async_logout_work(vha, sess, NULL);
@@ -1033,8 +1033,7 @@ static void qlt_free_session_done(struct
sess->login_succ = 0;
}
- if (sess->chip_reset != ha->base_qpair->chip_reset)
- qla2x00_clear_loop_id(sess);
+ qla2x00_clear_loop_id(sess);
if (sess->conflict) {
sess->conflict->login_pause = 0;
@@ -4588,9 +4587,9 @@ qlt_find_sess_invalidate_other(scsi_qla_
"Invalidating sess %p loop_id %d wwn %llx.\n",
other_sess, other_sess->loop_id, other_wwn);
-
other_sess->keep_nport_handle = 1;
- *conflict_sess = other_sess;
+ if (other_sess->disc_state != DSC_DELETED)
+ *conflict_sess = other_sess;
qlt_schedule_sess_for_deletion(other_sess,
true);
}
Patches currently in stable-queue which might be from quinn.tran(a)cavium.com are
queue-4.14/scsi-qla2xxx-retry-switch-command-on-time-out.patch
queue-4.14/scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch
queue-4.14/scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch
queue-4.14/scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch
queue-4.14/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch
queue-4.14/scsi-qla2xxx-clear-loop-id-after-delete.patch
queue-4.14/scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch
queue-4.14/scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch
queue-4.14/scsi-qla2xxx-fix-scan-state-field-for-fcport.patch
queue-4.14/scsi-qla2xxx-fix-prli-state-check.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch
queue-4.14/scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch
queue-4.14/scsi-qla2xxx-fix-gpnid-error-processing.patch
queue-4.14/scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch
This is a note to let you know that I've just added the patch titled
scsi: qla2xxx: Defer processing of GS IOCB calls
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scsi-qla2xxx-defer-processing-of-gs-iocb-calls.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 5d3300a9b8b122b4743aed5a178bf12c87e2b8c9 Mon Sep 17 00:00:00 2001
From: Giridhar Malavali <giridhar.malavali(a)cavium.com>
Date: Mon, 4 Dec 2017 14:45:13 -0800
Subject: scsi: qla2xxx: Defer processing of GS IOCB calls
From: Giridhar Malavali <giridhar.malavali(a)cavium.com>
commit 5d3300a9b8b122b4743aed5a178bf12c87e2b8c9 upstream.
This patch defers processing of GS IOCB calls from interrupt context to
avoid hardware spinlock recursion.
Following stack trace is seen
? mod_timer+0x193/0x330
? ql_dbg+0xa7/0xf0 [qla2xxx]
_raw_spin_lock_irqsave+0x31/0x40
qla2x00_start_sp+0x3b/0x250 [qla2xxx]
qla24xx_async_gnl+0x1d3/0x240 [qla2xxx]
qla24xx_fcport_handle_login+0x285/0x290 [qla2xxx]
? vprintk_func+0x20/0x50
Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
Cc: <stable(a)vger.kernel.org> # 4.10+
Signed-off-by: Giridhar Malavali <giridhar.malavali(a)cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani(a)cavium.com>
Reviewed-by: Hannes Reinecke <hare(a)suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/scsi/qla2xxx/qla_init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -973,7 +973,7 @@ int qla24xx_fcport_handle_login(struct s
ql_dbg(ql_dbg_disc, vha, 0x20bd,
"%s %d %8phC post gnl\n",
__func__, __LINE__, fcport->port_name);
- qla24xx_async_gnl(vha, fcport);
+ qla24xx_post_gnl_work(vha, fcport);
} else {
ql_dbg(ql_dbg_disc, vha, 0x20bf,
"%s %d %8phC post login\n",
@@ -1142,7 +1142,7 @@ void qla24xx_handle_relogin_event(scsi_q
ql_dbg(ql_dbg_disc, vha, 0x20e9, "%s %d %8phC post gidpn\n",
__func__, __LINE__, fcport->port_name);
- qla24xx_async_gidpn(vha, fcport);
+ qla24xx_post_gidpn_work(vha, fcport);
return;
}
Patches currently in stable-queue which might be from giridhar.malavali(a)cavium.com are
queue-4.14/scsi-qla2xxx-defer-processing-of-gs-iocb-calls.patch
queue-4.14/scsi-qla2xxx-remove-aborting-els-iocb-call-issued-as-part-of-timeout.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch
This is a note to let you know that I've just added the patch titled
scsi: qla2xxx: Fix abort command deadlock due to spinlock
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From b0dcce746b32ac573343ad39cb3dc485030de95e Mon Sep 17 00:00:00 2001
From: Quinn Tran <quinn.tran(a)cavium.com>
Date: Mon, 4 Dec 2017 14:45:09 -0800
Subject: scsi: qla2xxx: Fix abort command deadlock due to spinlock
From: Quinn Tran <quinn.tran(a)cavium.com>
commit b0dcce746b32ac573343ad39cb3dc485030de95e upstream.
Original code acquires hardware_lock to add Abort IOCB onto driver
request queue for processing. However, abort_command() will also acquire
hardware lock to look up sp pointer before issuing abort IOCB command
resulting into a deadlock. This patch safely removes the possible
deadlock scenario by removing extra spinlock.
Fixes: 6eb54715b54bb ("qla2xxx: Added interface to send explicit LOGO.")
Cc: <stable(a)vger.kernel.org> # 4.10+
Signed-off-by: Quinn Tran <quinn.tran(a)cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani(a)cavium.com>
Reviewed-by: Hannes Reinecke <hare(a)suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/scsi/qla2xxx/qla_iocb.c | 3 ---
1 file changed, 3 deletions(-)
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -2394,7 +2394,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data
struct scsi_qla_host *vha = sp->vha;
struct qla_hw_data *ha = vha->hw;
struct srb_iocb *lio = &sp->u.iocb_cmd;
- unsigned long flags = 0;
ql_dbg(ql_dbg_io, vha, 0x3069,
"%s Timeout, hdl=%x, portid=%02x%02x%02x\n",
@@ -2402,7 +2401,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data
fcport->d_id.b.al_pa);
/* Abort the exchange */
- spin_lock_irqsave(&ha->hardware_lock, flags);
if (ha->isp_ops->abort_command(sp)) {
ql_dbg(ql_dbg_io, vha, 0x3070,
"mbx abort_command failed.\n");
@@ -2410,7 +2408,6 @@ qla2x00_els_dcmd_iocb_timeout(void *data
ql_dbg(ql_dbg_io, vha, 0x3071,
"mbx abort_command success.\n");
}
- spin_unlock_irqrestore(&ha->hardware_lock, flags);
complete(&lio->u.els_logo.comp);
}
Patches currently in stable-queue which might be from quinn.tran(a)cavium.com are
queue-4.14/scsi-qla2xxx-retry-switch-command-on-time-out.patch
queue-4.14/scsi-qla2xxx-fix-abort-command-deadlock-due-to-spinlock.patch
queue-4.14/scsi-qla2xxx-fix-re-login-for-nport-handle-in-use.patch
queue-4.14/scsi-qla2xxx-fix-login-state-machine-stuck-at-gpdb.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-for-notify-ack-timeout-handling.patch
queue-4.14/scsi-qla2xxx-replace-fcport-alloc-with-qla2x00_alloc_fcport.patch
queue-4.14/scsi-qla2xxx-clear-loop-id-after-delete.patch
queue-4.14/scsi-qla2xxx-fix-relogin-being-triggered-too-fast.patch
queue-4.14/scsi-qla2xxx-skip-irq-affinity-for-target-qpairs.patch
queue-4.14/scsi-qla2xxx-fix-scan-state-field-for-fcport.patch
queue-4.14/scsi-qla2xxx-fix-prli-state-check.patch
queue-4.14/scsi-qla2xxx-fix-system-crash-in-qlt_plogi_ack_unref.patch
queue-4.14/scsi-qla2xxx-serialize-gpnid-for-multiple-rscn.patch
queue-4.14/scsi-qla2xxx-fix-gpnid-error-processing.patch
queue-4.14/scsi-qla2xxx-move-session-delete-to-driver-work-queue.patch
This is a note to let you know that I've just added the patch titled
pNFS: Prevent the layout header refcount going to zero in pnfs_roc()
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From 9c6376ebddad585da4238532dd6d90ae23ffee67 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust(a)primarydata.com>
Date: Wed, 7 Mar 2018 14:49:06 -0500
Subject: pNFS: Prevent the layout header refcount going to zero in pnfs_roc()
From: Trond Myklebust <trond.myklebust(a)primarydata.com>
commit 9c6376ebddad585da4238532dd6d90ae23ffee67 upstream.
Ensure that we hold a reference to the layout header when processing
the pNFS return-on-close so that the refcount value does not inadvertently
go to zero.
Reported-by: Tigran Mkrtchyan <tigran.mkrtchyan(a)desy.de>
Signed-off-by: Trond Myklebust <trond.myklebust(a)primarydata.com>
Cc: stable(a)vger.kernel.org # v4.10+
Tested-by: Tigran Mkrtchyan <tigran.mkrtchyan(a)desy.de>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
fs/nfs/pnfs.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -292,8 +292,11 @@ pnfs_detach_layout_hdr(struct pnfs_layou
void
pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo)
{
- struct inode *inode = lo->plh_inode;
+ struct inode *inode;
+ if (!lo)
+ return;
+ inode = lo->plh_inode;
pnfs_layoutreturn_before_put_layout_hdr(lo);
if (atomic_dec_and_lock(&lo->plh_refcount, &inode->i_lock)) {
@@ -1223,10 +1226,12 @@ retry:
spin_lock(&ino->i_lock);
lo = nfsi->layout;
if (!lo || !pnfs_layout_is_valid(lo) ||
- test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags))
+ test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) {
+ lo = NULL;
goto out_noroc;
+ }
+ pnfs_get_layout_hdr(lo);
if (test_bit(NFS_LAYOUT_RETURN_LOCK, &lo->plh_flags)) {
- pnfs_get_layout_hdr(lo);
spin_unlock(&ino->i_lock);
wait_on_bit(&lo->plh_flags, NFS_LAYOUT_RETURN,
TASK_UNINTERRUPTIBLE);
@@ -1294,10 +1299,12 @@ out_noroc:
struct pnfs_layoutdriver_type *ld = NFS_SERVER(ino)->pnfs_curr_ld;
if (ld->prepare_layoutreturn)
ld->prepare_layoutreturn(args);
+ pnfs_put_layout_hdr(lo);
return true;
}
if (layoutreturn)
pnfs_send_layoutreturn(lo, &stateid, iomode, true);
+ pnfs_put_layout_hdr(lo);
return false;
}
Patches currently in stable-queue which might be from trond.myklebust(a)primarydata.com are
queue-4.14/nfs-fix-unstable-write-completion.patch
queue-4.14/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch
queue-4.14/pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch
This is a note to let you know that I've just added the patch titled
NFS: Fix unstable write completion
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
nfs-fix-unstable-write-completion.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From c4f24df942a181699c5bab01b8e5e82b925f77f3 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust(a)primarydata.com>
Date: Wed, 7 Mar 2018 15:22:31 -0500
Subject: NFS: Fix unstable write completion
From: Trond Myklebust <trond.myklebust(a)primarydata.com>
commit c4f24df942a181699c5bab01b8e5e82b925f77f3 upstream.
We do want to respect the FLUSH_SYNC argument to nfs_commit_inode() to
ensure that all outstanding COMMIT requests to the inode in question are
complete. Currently we may exit early from both nfs_commit_inode() and
nfs_write_inode() even if there are COMMIT requests in flight, or unstable
writes on the commit list.
In order to get the right semantics w.r.t. sync_inode(), we don't need
to have nfs_commit_inode() reset the inode dirty flags when called from
nfs_wb_page() and/or nfs_wb_all(). We just need to ensure that
nfs_write_inode() leaves them in the right state if there are outstanding
commits, or stable pages.
Reported-by: Scott Mayhew <smayhew(a)redhat.com>
Fixes: dc4fd9ab01ab ("nfs: don't wait on commit in nfs_commit_inode()...")
Cc: stable(a)vger.kernel.org # v4.14+
Signed-off-by: Trond Myklebust <trond.myklebust(a)primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
fs/nfs/write.c | 83 +++++++++++++++++++++++++++++----------------------------
1 file changed, 43 insertions(+), 40 deletions(-)
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1877,40 +1877,43 @@ int nfs_generic_commit_list(struct inode
return status;
}
-int nfs_commit_inode(struct inode *inode, int how)
+static int __nfs_commit_inode(struct inode *inode, int how,
+ struct writeback_control *wbc)
{
LIST_HEAD(head);
struct nfs_commit_info cinfo;
int may_wait = how & FLUSH_SYNC;
- int error = 0;
- int res;
+ int ret, nscan;
nfs_init_cinfo_from_inode(&cinfo, inode);
nfs_commit_begin(cinfo.mds);
- res = nfs_scan_commit(inode, &head, &cinfo);
- if (res)
- error = nfs_generic_commit_list(inode, &head, how, &cinfo);
+ for (;;) {
+ ret = nscan = nfs_scan_commit(inode, &head, &cinfo);
+ if (ret <= 0)
+ break;
+ ret = nfs_generic_commit_list(inode, &head, how, &cinfo);
+ if (ret < 0)
+ break;
+ ret = 0;
+ if (wbc && wbc->sync_mode == WB_SYNC_NONE) {
+ if (nscan < wbc->nr_to_write)
+ wbc->nr_to_write -= nscan;
+ else
+ wbc->nr_to_write = 0;
+ }
+ if (nscan < INT_MAX)
+ break;
+ cond_resched();
+ }
nfs_commit_end(cinfo.mds);
- if (res == 0)
- return res;
- if (error < 0)
- goto out_error;
- if (!may_wait)
- goto out_mark_dirty;
- error = wait_on_commit(cinfo.mds);
- if (error < 0)
- return error;
- return res;
-out_error:
- res = error;
- /* Note: If we exit without ensuring that the commit is complete,
- * we must mark the inode as dirty. Otherwise, future calls to
- * sync_inode() with the WB_SYNC_ALL flag set will fail to ensure
- * that the data is on the disk.
- */
-out_mark_dirty:
- __mark_inode_dirty(inode, I_DIRTY_DATASYNC);
- return res;
+ if (ret || !may_wait)
+ return ret;
+ return wait_on_commit(cinfo.mds);
+}
+
+int nfs_commit_inode(struct inode *inode, int how)
+{
+ return __nfs_commit_inode(inode, how, NULL);
}
EXPORT_SYMBOL_GPL(nfs_commit_inode);
@@ -1920,11 +1923,11 @@ int nfs_write_inode(struct inode *inode,
int flags = FLUSH_SYNC;
int ret = 0;
- /* no commits means nothing needs to be done */
- if (!atomic_long_read(&nfsi->commit_info.ncommit))
- return ret;
-
if (wbc->sync_mode == WB_SYNC_NONE) {
+ /* no commits means nothing needs to be done */
+ if (!atomic_long_read(&nfsi->commit_info.ncommit))
+ goto check_requests_outstanding;
+
/* Don't commit yet if this is a non-blocking flush and there
* are a lot of outstanding writes for this mapping.
*/
@@ -1935,16 +1938,16 @@ int nfs_write_inode(struct inode *inode,
flags = 0;
}
- ret = nfs_commit_inode(inode, flags);
- if (ret >= 0) {
- if (wbc->sync_mode == WB_SYNC_NONE) {
- if (ret < wbc->nr_to_write)
- wbc->nr_to_write -= ret;
- else
- wbc->nr_to_write = 0;
- }
- return 0;
- }
+ ret = __nfs_commit_inode(inode, flags, wbc);
+ if (!ret) {
+ if (flags & FLUSH_SYNC)
+ return 0;
+ } else if (atomic_long_read(&nfsi->commit_info.ncommit))
+ goto out_mark_dirty;
+
+check_requests_outstanding:
+ if (!atomic_read(&nfsi->commit_info.rpcs_out))
+ return ret;
out_mark_dirty:
__mark_inode_dirty(inode, I_DIRTY_DATASYNC);
return ret;
Patches currently in stable-queue which might be from trond.myklebust(a)primarydata.com are
queue-4.14/nfs-fix-unstable-write-completion.patch
queue-4.14/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch
queue-4.14/pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch
This is a note to let you know that I've just added the patch titled
NFS: Fix an incorrect type in struct nfs_direct_req
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From d9ee65539d3eabd9ade46cca1780e3309ad0f907 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust(a)primarydata.com>
Date: Tue, 6 Mar 2018 12:47:08 -0500
Subject: NFS: Fix an incorrect type in struct nfs_direct_req
From: Trond Myklebust <trond.myklebust(a)primarydata.com>
commit d9ee65539d3eabd9ade46cca1780e3309ad0f907 upstream.
The start offset needs to be of type loff_t.
Fixed: 5fadeb47dcc5c ("nfs: count DIO good bytes correctly with mirroring")
Cc: stable(a)vger.kernel.org # v4.0+
Signed-off-by: Trond Myklebust <trond.myklebust(a)primarydata.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
fs/nfs/direct.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -86,10 +86,10 @@ struct nfs_direct_req {
struct nfs_direct_mirror mirrors[NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX];
int mirror_count;
+ loff_t io_start; /* Start offset for I/O */
ssize_t count, /* bytes actually processed */
max_count, /* max expected count */
bytes_left, /* bytes left to be sent */
- io_start, /* start of IO */
error; /* any reported error */
struct completion completion; /* wait for i/o completion */
Patches currently in stable-queue which might be from trond.myklebust(a)primarydata.com are
queue-4.14/nfs-fix-unstable-write-completion.patch
queue-4.14/nfs-fix-an-incorrect-type-in-struct-nfs_direct_req.patch
queue-4.14/pnfs-prevent-the-layout-header-refcount-going-to-zero-in-pnfs_roc.patch
This is a note to let you know that I've just added the patch titled
ubi: Fix race condition between ubi volume creation and udev
to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=sum…
The filename of the patch is:
ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch
and it can be found in the queue-3.18 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable(a)vger.kernel.org> know about it.
>From a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6 Mon Sep 17 00:00:00 2001
From: Clay McClure <clay(a)daemons.net>
Date: Thu, 21 Sep 2017 19:01:34 -0700
Subject: ubi: Fix race condition between ubi volume creation and udev
From: Clay McClure <clay(a)daemons.net>
commit a51a0c8d213594bc094cb8e54aad0cb6d7f7b9a6 upstream.
Similar to commit 714fb87e8bc0 ("ubi: Fix race condition between ubi
device creation and udev"), we should make the volume active before
registering it.
Signed-off-by: Clay McClure <clay(a)daemons.net>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Richard Weinberger <richard(a)nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
drivers/mtd/ubi/vmt.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -308,6 +308,12 @@ int ubi_create_volume(struct ubi_device
vol->last_eb_bytes = vol->usable_leb_size;
}
+ /* Make volume "available" before it becomes accessible via sysfs */
+ spin_lock(&ubi->volumes_lock);
+ ubi->volumes[vol_id] = vol;
+ ubi->vol_count += 1;
+ spin_unlock(&ubi->volumes_lock);
+
/* Register character device for the volume */
cdev_init(&vol->cdev, &ubi_vol_cdev_operations);
vol->cdev.owner = THIS_MODULE;
@@ -350,11 +356,6 @@ int ubi_create_volume(struct ubi_device
if (err)
goto out_sysfs;
- spin_lock(&ubi->volumes_lock);
- ubi->volumes[vol_id] = vol;
- ubi->vol_count += 1;
- spin_unlock(&ubi->volumes_lock);
-
ubi_volume_notify(ubi, vol, UBI_VOLUME_ADDED);
self_check_volumes(ubi);
return err;
@@ -374,6 +375,10 @@ out_sysfs:
out_cdev:
cdev_del(&vol->cdev);
out_mapping:
+ spin_lock(&ubi->volumes_lock);
+ ubi->volumes[vol_id] = NULL;
+ ubi->vol_count -= 1;
+ spin_unlock(&ubi->volumes_lock);
if (do_free)
kfree(vol->eba_tbl);
out_acc:
Patches currently in stable-queue which might be from clay(a)daemons.net are
queue-3.18/ubi-fix-race-condition-between-ubi-volume-creation-and-udev.patch