Home Home > GIT Browse > SLE12-SP3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2018-12-14 13:53:25 -0500
committerMichal Koutný <mkoutny@suse.com>2019-01-14 19:22:09 +0100
commit515b604ea81ae5bdf46205e9242391e0b0d48070 (patch)
tree5160db9a006a57ab315b06b3f5c6e8578dcb17bc
parent119a27d3a6fd637662278eaf0cb553c213205539 (diff)
housekeeping: fold fixes into patches.fixes/libfc-Fixup-disc_mutex-handling.patch.
There were bugs in the initial patch prior to upstreaming that were discovered and fixed.
-rw-r--r--patches.fixes/fcoe_ctlr-fix-potential-deadlock-when-re-adding-port.patch46
-rw-r--r--patches.fixes/libfc-Fixup-disc_mutex-handling.patch131
-rw-r--r--patches.fixes/libfc-Fixup-fixup-disc_mutex-handling.patch92
-rw-r--r--patches.fixes/libfc-fixup-locking-of-ptp_setup.patch44
-rw-r--r--series.conf3
5 files changed, 109 insertions, 207 deletions
diff --git a/patches.fixes/fcoe_ctlr-fix-potential-deadlock-when-re-adding-port.patch b/patches.fixes/fcoe_ctlr-fix-potential-deadlock-when-re-adding-port.patch
deleted file mode 100644
index b4b39d9888..0000000000
--- a/patches.fixes/fcoe_ctlr-fix-potential-deadlock-when-re-adding-port.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 8a5d02abb7fd065a1e60d7baec78e8494361cca5 Mon Sep 17 00:00:00 2001
-From: Hannes Reinecke <hare@suse.de>
-Date: Wed, 14 Sep 2016 16:54:24 +0200
-Subject: [PATCH] fcoe_ctlr: fix potential deadlock when re-adding ports
-References: bsc#962846
-Patch-Mainline: submitted to linux-scsi 2016/09/28
-
-If we detech a port WWPN change we need to drop the disc_mutex
-before calling rport_logoff.
-
-Signed-off-by: Hannes Reinecke <hare@suse.com>
----
- drivers/scsi/fcoe/fcoe_ctlr.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
-index e6557ea..a435206 100644
---- a/drivers/scsi/fcoe/fcoe_ctlr.c
-+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
-@@ -2491,6 +2491,8 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new)
- mutex_unlock(&lport->disc.disc_mutex);
- return;
- }
-+ mutex_lock(&rdata->rp_mutex);
-+ mutex_unlock(&lport->disc.disc_mutex);
-
- rdata->ops = &fcoe_ctlr_vn_rport_ops;
- rdata->disc_id = lport->disc.disc_id;
-@@ -2499,11 +2501,13 @@ static void fcoe_ctlr_vn_add(struct fcoe_ctlr *fip, struct fc_rport_priv *new)
- if ((ids->port_name != -1 && ids->port_name != new->ids.port_name) ||
- (ids->node_name != -1 && ids->node_name != new->ids.node_name)) {
- LIBFCOE_FIP_DBG(fip, "vn_add rport logoff %6.6x\n", port_id);
-+ mutex_unlock(&rdata->rp_mutex);
- lport->tt.rport_logoff(rdata);
-+ mutex_lock(&rdata->rp_mutex);
- }
- ids->port_name = new->ids.port_name;
- ids->node_name = new->ids.node_name;
-- mutex_unlock(&lport->disc.disc_mutex);
-+ mutex_unlock(&rdata->rp_mutex);
-
- frport = fcoe_ctlr_rport(rdata);
- LIBFCOE_FIP_DBG(fip, "vn_add rport %6.6x %s state %d\n",
---
-1.8.5.6
-
diff --git a/patches.fixes/libfc-Fixup-disc_mutex-handling.patch b/patches.fixes/libfc-Fixup-disc_mutex-handling.patch
index a0c909b9f6..1f4075c068 100644
--- a/patches.fixes/libfc-Fixup-disc_mutex-handling.patch
+++ b/patches.fixes/libfc-Fixup-disc_mutex-handling.patch
@@ -15,16 +15,15 @@ otherwise we risk clashes with list_add.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
- drivers/scsi/fcoe/fcoe_ctlr.c | 28 ++++++++++++++++++++++------
- drivers/scsi/libfc/fc_disc.c | 30 +++++++++++++++++++-----------
- drivers/scsi/libfc/fc_rport.c | 2 ++
- 3 files changed, 43 insertions(+), 17 deletions(-)
+ drivers/scsi/fcoe/fcoe_ctlr.c | 34 +++++++++++++++++++++++++++-------
+ drivers/scsi/libfc/fc_disc.c | 38 +++++++++++++++++++++++++-------------
+ drivers/scsi/libfc/fc_lport.c | 5 ++++-
+ drivers/scsi/libfc/fc_rport.c | 2 ++
+ 4 files changed, 58 insertions(+), 21 deletions(-)
-diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
-index 98cf0e3..e6557ea 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
-@@ -2147,9 +2147,15 @@ static void fcoe_ctlr_disc_stop_locked(struct fc_lport *lport)
+@@ -2147,9 +2147,15 @@ static void fcoe_ctlr_disc_stop_locked(s
{
struct fc_rport_priv *rdata;
@@ -42,7 +41,31 @@ index 98cf0e3..e6557ea 100644
lport->disc.disc_callback = NULL;
mutex_unlock(&lport->disc.disc_mutex);
}
-@@ -2674,11 +2680,15 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip)
+@@ -2485,6 +2491,8 @@ static void fcoe_ctlr_vn_add(struct fcoe
+ mutex_unlock(&lport->disc.disc_mutex);
+ return;
+ }
++ mutex_lock(&rdata->rp_mutex);
++ mutex_unlock(&lport->disc.disc_mutex);
+
+ rdata->ops = &fcoe_ctlr_vn_rport_ops;
+ rdata->disc_id = lport->disc.disc_id;
+@@ -2493,11 +2501,13 @@ static void fcoe_ctlr_vn_add(struct fcoe
+ if ((ids->port_name != -1 && ids->port_name != new->ids.port_name) ||
+ (ids->node_name != -1 && ids->node_name != new->ids.node_name)) {
+ LIBFCOE_FIP_DBG(fip, "vn_add rport logoff %6.6x\n", port_id);
++ mutex_unlock(&rdata->rp_mutex);
+ lport->tt.rport_logoff(rdata);
++ mutex_lock(&rdata->rp_mutex);
+ }
+ ids->port_name = new->ids.port_name;
+ ids->node_name = new->ids.node_name;
+- mutex_unlock(&lport->disc.disc_mutex);
++ mutex_unlock(&rdata->rp_mutex);
+
+ frport = fcoe_ctlr_rport(rdata);
+ LIBFCOE_FIP_DBG(fip, "vn_add rport %6.6x %s state %d\n",
+@@ -2674,11 +2684,15 @@ static unsigned long fcoe_ctlr_vn_age(st
unsigned long deadline;
next_time = jiffies + msecs_to_jiffies(FIP_VN_BEACON_INT * 10);
@@ -60,7 +83,7 @@ index 98cf0e3..e6557ea 100644
deadline = frport->time +
msecs_to_jiffies(FIP_VN_BEACON_INT * 25 / 10);
if (time_after_eq(jiffies, deadline)) {
-@@ -2689,8 +2699,9 @@ static unsigned long fcoe_ctlr_vn_age(struct fcoe_ctlr *fip)
+@@ -2689,8 +2703,9 @@ static unsigned long fcoe_ctlr_vn_age(st
lport->tt.rport_logoff(rdata);
} else if (time_before(deadline, next_time))
next_time = deadline;
@@ -71,7 +94,7 @@ index 98cf0e3..e6557ea 100644
return next_time;
}
-@@ -3037,12 +3048,17 @@ static void fcoe_ctlr_vn_disc(struct fcoe_ctlr *fip)
+@@ -3037,12 +3052,17 @@ static void fcoe_ctlr_vn_disc(struct fco
mutex_lock(&disc->disc_mutex);
callback = disc->pending ? disc->disc_callback : NULL;
disc->pending = 0;
@@ -90,11 +113,9 @@ index 98cf0e3..e6557ea 100644
if (callback)
callback(lport, DISC_EV_SUCCESS);
}
-diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
-index 880a906..351022a 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
-@@ -68,10 +68,14 @@ static void fc_disc_stop_rports(struct fc_disc *disc)
+@@ -68,10 +68,14 @@ static void fc_disc_stop_rports(struct f
lport = fc_disc_lport(disc);
@@ -113,11 +134,10 @@ index 880a906..351022a 100644
}
/**
-@@ -289,16 +293,20 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
+@@ -289,15 +293,19 @@ static void fc_disc_done(struct fc_disc
* Skip ports which were never discovered. These are the dNS port
* and ports which were created by PLOGI.
*/
-+ mutex_unlock(&disc->disc_mutex);
+ rcu_read_lock();
list_for_each_entry_rcu(rdata, &disc->rports, peers) {
- if (!rdata->disc_id)
@@ -136,16 +156,86 @@ index 880a906..351022a 100644
+ kref_put(&rdata->kref, lport->tt.rport_destroy);
}
-
-- mutex_unlock(&disc->disc_mutex);
+ rcu_read_unlock();
+ mutex_unlock(&disc->disc_mutex);
disc->disc_callback(lport, event);
mutex_lock(&disc->disc_mutex);
+@@ -592,7 +600,6 @@ static void fc_disc_gpn_id_resp(struct f
+ lport = rdata->local_port;
+ disc = &lport->disc;
+
+- mutex_lock(&disc->disc_mutex);
+ if (PTR_ERR(fp) == -FC_EX_CLOSED)
+ goto out;
+ if (IS_ERR(fp))
+@@ -607,16 +614,19 @@ static void fc_disc_gpn_id_resp(struct f
+ goto redisc;
+ pn = (struct fc_ns_gid_pn *)(cp + 1);
+ port_name = get_unaligned_be64(&pn->fn_wwpn);
++ mutex_lock(&rdata->rp_mutex);
+ if (rdata->ids.port_name == -1)
+ rdata->ids.port_name = port_name;
+ else if (rdata->ids.port_name != port_name) {
+ FC_DISC_DBG(disc, "GPN_ID accepted. WWPN changed. "
+ "Port-id %6.6x wwpn %16.16llx\n",
+ rdata->ids.port_id, port_name);
++ mutex_unlock(&rdata->rp_mutex);
+ lport->tt.rport_logoff(rdata);
+-
++ mutex_lock(&lport->disc.disc_mutex);
+ new_rdata = lport->tt.rport_create(lport,
+ rdata->ids.port_id);
++ mutex_unlock(&lport->disc.disc_mutex);
+ if (new_rdata) {
+ new_rdata->disc_id = disc->disc_id;
+ lport->tt.rport_login(new_rdata);
+@@ -624,6 +634,7 @@ static void fc_disc_gpn_id_resp(struct f
+ goto out;
+ }
+ rdata->disc_id = disc->disc_id;
++ mutex_unlock(&rdata->rp_mutex);
+ lport->tt.rport_login(rdata);
+ } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) {
+ FC_DISC_DBG(disc, "GPN_ID rejected reason %x exp %x\n",
+@@ -633,10 +644,11 @@ static void fc_disc_gpn_id_resp(struct f
+ FC_DISC_DBG(disc, "GPN_ID unexpected response code %x\n",
+ ntohs(cp->ct_cmd));
+ redisc:
++ mutex_lock(&disc->disc_mutex);
+ fc_disc_restart(disc);
++ mutex_unlock(&disc->disc_mutex);
+ }
+ out:
+- mutex_unlock(&disc->disc_mutex);
+ kref_put(&rdata->kref, lport->tt.rport_destroy);
}
-diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
-index fa6ef35..ccb7620 100644
+
+--- a/drivers/scsi/libfc/fc_lport.c
++++ b/drivers/scsi/libfc/fc_lport.c
+@@ -237,16 +237,19 @@ static const char *fc_lport_state(struct
+ * @remote_fid: The FID of the ptp rport
+ * @remote_wwpn: The WWPN of the ptp rport
+ * @remote_wwnn: The WWNN of the ptp rport
++ *
++ * Locking Note: The lport lock is expected to be held before calling
++ * this routine.
+ */
+ static void fc_lport_ptp_setup(struct fc_lport *lport,
+ u32 remote_fid, u64 remote_wwpn,
+ u64 remote_wwnn)
+ {
+- mutex_lock(&lport->disc.disc_mutex);
+ if (lport->ptp_rdata) {
+ lport->tt.rport_logoff(lport->ptp_rdata);
+ kref_put(&lport->ptp_rdata->kref, lport->tt.rport_destroy);
+ }
++ mutex_lock(&lport->disc.disc_mutex);
+ lport->ptp_rdata = lport->tt.rport_create(lport, remote_fid);
+ kref_get(&lport->ptp_rdata->kref);
+ lport->ptp_rdata->ids.port_name = remote_wwpn;
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
-@@ -378,7 +378,9 @@ static void fc_rport_work(struct work_struct *work)
+@@ -378,7 +378,9 @@ static void fc_rport_work(struct work_st
mutex_unlock(&rdata->rp_mutex);
} else {
FC_RPORT_DBG(rdata, "work delete\n");
@@ -155,6 +245,3 @@ index fa6ef35..ccb7620 100644
mutex_unlock(&rdata->rp_mutex);
kref_put(&rdata->kref, lport->tt.rport_destroy);
}
---
-1.8.5.6
-
diff --git a/patches.fixes/libfc-Fixup-fixup-disc_mutex-handling.patch b/patches.fixes/libfc-Fixup-fixup-disc_mutex-handling.patch
deleted file mode 100644
index fa2461e244..0000000000
--- a/patches.fixes/libfc-Fixup-fixup-disc_mutex-handling.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 0497f9b0f22265aabe3774011a59b47150a4ae2a Mon Sep 17 00:00:00 2001
-From: Hannes Reinecke <hare@suse.de>
-Date: Wed, 14 Sep 2016 16:55:36 +0200
-Subject: [PATCH] libfc: Fixup 'Fixup disc_mutex handling'
-References: bsc#962846
-Patch-Mainline: submitted to linux-scsi 2016/09/28
-
-The disc mutex only should be held when calling rport_create().
-Everything else should be protected by the rp_mutex. Most notably
-holding the disc_mutex when calling rport_logoff() might lead to
-a deadlock.
-This is fixes a regression introduced by the earlier patch
-'Fixup disc_mutex handling'
-
-Signed-off-by: Hannes Reinecke <hare@suse.com>
----
- drivers/scsi/libfc/fc_disc.c | 12 ++++++++----
- 1 file changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
-index 351022a..ad3965f 100644
---- a/drivers/scsi/libfc/fc_disc.c
-+++ b/drivers/scsi/libfc/fc_disc.c
-@@ -293,7 +293,6 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
- * Skip ports which were never discovered. These are the dNS port
- * and ports which were created by PLOGI.
- */
-- mutex_unlock(&disc->disc_mutex);
- rcu_read_lock();
- list_for_each_entry_rcu(rdata, &disc->rports, peers) {
- if (!kref_get_unless_zero(&rdata->kref))
-@@ -307,6 +306,7 @@ static void fc_disc_done(struct fc_disc *disc, enum fc_disc_event event)
- kref_put(&rdata->kref, lport->tt.rport_destroy);
- }
- rcu_read_unlock();
-+ mutex_unlock(&disc->disc_mutex);
- disc->disc_callback(lport, event);
- mutex_lock(&disc->disc_mutex);
- }
-@@ -600,7 +600,6 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
- lport = rdata->local_port;
- disc = &lport->disc;
-
-- mutex_lock(&disc->disc_mutex);
- if (PTR_ERR(fp) == -FC_EX_CLOSED)
- goto out;
- if (IS_ERR(fp))
-@@ -615,16 +614,19 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
- goto redisc;
- pn = (struct fc_ns_gid_pn *)(cp + 1);
- port_name = get_unaligned_be64(&pn->fn_wwpn);
-+ mutex_lock(&rdata->rp_mutex);
- if (rdata->ids.port_name == -1)
- rdata->ids.port_name = port_name;
- else if (rdata->ids.port_name != port_name) {
- FC_DISC_DBG(disc, "GPN_ID accepted. WWPN changed. "
- "Port-id %6.6x wwpn %16.16llx\n",
- rdata->ids.port_id, port_name);
-+ mutex_unlock(&rdata->rp_mutex);
- lport->tt.rport_logoff(rdata);
--
-+ mutex_lock(&lport->disc.disc_mutex);
- new_rdata = lport->tt.rport_create(lport,
- rdata->ids.port_id);
-+ mutex_unlock(&lport->disc.disc_mutex);
- if (new_rdata) {
- new_rdata->disc_id = disc->disc_id;
- lport->tt.rport_login(new_rdata);
-@@ -632,6 +634,7 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
- goto out;
- }
- rdata->disc_id = disc->disc_id;
-+ mutex_unlock(&rdata->rp_mutex);
- lport->tt.rport_login(rdata);
- } else if (ntohs(cp->ct_cmd) == FC_FS_RJT) {
- FC_DISC_DBG(disc, "GPN_ID rejected reason %x exp %x\n",
-@@ -641,10 +644,11 @@ static void fc_disc_gpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
- FC_DISC_DBG(disc, "GPN_ID unexpected response code %x\n",
- ntohs(cp->ct_cmd));
- redisc:
-+ mutex_lock(&disc->disc_mutex);
- fc_disc_restart(disc);
-+ mutex_unlock(&disc->disc_mutex);
- }
- out:
-- mutex_unlock(&disc->disc_mutex);
- kref_put(&rdata->kref, lport->tt.rport_destroy);
- }
-
---
-1.8.5.6
-
diff --git a/patches.fixes/libfc-fixup-locking-of-ptp_setup.patch b/patches.fixes/libfc-fixup-locking-of-ptp_setup.patch
deleted file mode 100644
index a09030b654..0000000000
--- a/patches.fixes/libfc-fixup-locking-of-ptp_setup.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From b37f459ff6fc4d10f2fdfe8b6ffcec5ef4b00fae Mon Sep 17 00:00:00 2001
-From: Hannes Reinecke <hare@suse.de>
-Date: Wed, 14 Sep 2016 09:59:05 +0200
-Subject: [PATCH] libfc: fixup locking of ptp_setup()
-References: bsc#962846
-Patch-Mainline: submitted to linux-scsi 2016/09/28
-
-Assigning the ptp port is already protected by the lport mutex,
-so we only need to take the disc_mutex for the actual port
-allocation.
-
-Signed-off-by: Hannes Reinecke <hare@suse.com>
----
- drivers/scsi/libfc/fc_lport.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
-index 74c0aac..72c9d48 100644
---- a/drivers/scsi/libfc/fc_lport.c
-+++ b/drivers/scsi/libfc/fc_lport.c
-@@ -237,16 +237,19 @@ static const char *fc_lport_state(struct fc_lport *lport)
- * @remote_fid: The FID of the ptp rport
- * @remote_wwpn: The WWPN of the ptp rport
- * @remote_wwnn: The WWNN of the ptp rport
-+ *
-+ * Locking Note: The lport lock is expected to be held before calling
-+ * this routine.
- */
- static void fc_lport_ptp_setup(struct fc_lport *lport,
- u32 remote_fid, u64 remote_wwpn,
- u64 remote_wwnn)
- {
-- mutex_lock(&lport->disc.disc_mutex);
- if (lport->ptp_rdata) {
- lport->tt.rport_logoff(lport->ptp_rdata);
- kref_put(&lport->ptp_rdata->kref, lport->tt.rport_destroy);
- }
-+ mutex_lock(&lport->disc.disc_mutex);
- lport->ptp_rdata = lport->tt.rport_create(lport, remote_fid);
- kref_get(&lport->ptp_rdata->kref);
- lport->ptp_rdata->ids.port_name = remote_wwpn;
---
-1.8.5.6
-
diff --git a/series.conf b/series.conf
index 67a082b21a..c3ece780d5 100644
--- a/series.conf
+++ b/series.conf
@@ -3406,9 +3406,6 @@
patches.fixes/libfc-Correctly-set-E_D_TOV-and-R_A_TOV-values-in-RT.patch
patches.fixes/libfc-Do-not-take-rdata-rp_mutex-when-processing-a-F.patch
patches.fixes/libfc-Fix-PRLI-response-handling-yet-again.patch
- patches.fixes/libfc-fixup-locking-of-ptp_setup.patch
- patches.fixes/libfc-Fixup-fixup-disc_mutex-handling.patch
- patches.fixes/fcoe_ctlr-fix-potential-deadlock-when-re-adding-port.patch
patches.drivers/scsi_transport_fc-return-EBUSY-for-deleted-vport.patch
patches.fixes/scsi-Add-STARGET_CREATE_REMOVE-state-to-scsi_target.patch
patches.kabi/scsi-kABI-fix-for-new-state-STARGET_CREATED_REMOVE.patch