+++ /dev/null
-From 67f38b87a3720b72751f38d633893d5a1927f409 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 14:14:12 +0000
-Subject: scsi: libsas: Add a helper sas_get_sas_addr_and_dev_type()
-
-From: Xingui Yang <yangxingui@huawei.com>
-
-[ Upstream commit a57345279fd311ba679b8083feb0eec5272c7729 ]
-
-Add a helper to get attached_sas_addr and device type from disc_resp.
-
-Suggested-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Xingui Yang <yangxingui@huawei.com>
-Link: https://lore.kernel.org/r/20240307141413.48049-2-yangxingui@huawei.com
-Reviewed-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 8e68a458bcf5 ("scsi: libsas: Fix disk not being scanned in after being removed")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 19 ++++++++++++-------
- 1 file changed, 12 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index aaa3bc79517db..8c7c970274c9c 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -1719,6 +1719,16 @@ int sas_discover_root_expander(struct domain_device *dev)
-
- /* ---------- Domain revalidation ---------- */
-
-+static void sas_get_sas_addr_and_dev_type(struct smp_disc_resp *disc_resp,
-+ u8 *sas_addr,
-+ enum sas_device_type *type)
-+{
-+ memcpy(sas_addr, disc_resp->disc.attached_sas_addr, SAS_ADDR_SIZE);
-+ *type = to_dev_type(&disc_resp->disc);
-+ if (*type == SAS_PHY_UNUSED)
-+ memset(sas_addr, 0, SAS_ADDR_SIZE);
-+}
-+
- static int sas_get_phy_discover(struct domain_device *dev,
- int phy_id, struct smp_disc_resp *disc_resp)
- {
-@@ -1772,13 +1782,8 @@ static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
- return -ENOMEM;
-
- res = sas_get_phy_discover(dev, phy_id, disc_resp);
-- if (res == 0) {
-- memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
-- SAS_ADDR_SIZE);
-- *type = to_dev_type(&disc_resp->disc);
-- if (*type == 0)
-- memset(sas_addr, 0, SAS_ADDR_SIZE);
-- }
-+ if (res == 0)
-+ sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, type);
- kfree(disc_resp);
- return res;
- }
---
-2.43.0
-
+++ /dev/null
-From cf25330b61d2c9d4a3879e831dfa9c0a7e2411b4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 14:14:13 +0000
-Subject: scsi: libsas: Fix disk not being scanned in after being removed
-
-From: Xingui Yang <yangxingui@huawei.com>
-
-[ Upstream commit 8e68a458bcf5b5cb9c3624598bae28f08251601f ]
-
-As of commit d8649fc1c5e4 ("scsi: libsas: Do discovery on empty PHY to
-update PHY info"), do discovery will send a new SMP_DISCOVER and update
-phy->phy_change_count. We found that if the disk is reconnected and phy
-change_count changes at this time, the disk scanning process will not be
-triggered.
-
-Therefore, call sas_set_ex_phy() to update the PHY info with the results of
-the last query. And because the previous phy info will be used when calling
-sas_unregister_devs_sas_addr(), sas_unregister_devs_sas_addr() should be
-called before sas_set_ex_phy().
-
-Fixes: d8649fc1c5e4 ("scsi: libsas: Do discovery on empty PHY to update PHY info")
-Signed-off-by: Xingui Yang <yangxingui@huawei.com>
-Link: https://lore.kernel.org/r/20240307141413.48049-3-yangxingui@huawei.com
-Reviewed-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 32 ++++++++++++++++++++----------
- 1 file changed, 22 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index 8c7c970274c9c..988c0db37458d 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -2046,37 +2046,46 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
- struct expander_device *ex = &dev->ex_dev;
- struct ex_phy *phy = &ex->ex_phy[phy_id];
- enum sas_device_type type = SAS_PHY_UNUSED;
-+ struct smp_disc_resp *disc_resp;
- u8 sas_addr[SAS_ADDR_SIZE];
- int res;
-
- memset(sas_addr, 0, SAS_ADDR_SIZE);
-- res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
-+ disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
-+ if (!disc_resp)
-+ return -ENOMEM;
-+
-+ res = sas_get_phy_discover(dev, phy_id, disc_resp);
- switch (res) {
- case SMP_RESP_NO_PHY:
- phy->phy_state = PHY_NOT_PRESENT;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-- return res;
-+ goto out_free_resp;
- case SMP_RESP_PHY_VACANT:
- phy->phy_state = PHY_VACANT;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-- return res;
-+ goto out_free_resp;
- case SMP_RESP_FUNC_ACC:
- break;
- case -ECOMM:
- break;
- default:
-- return res;
-+ goto out_free_resp;
- }
-
-+ if (res == 0)
-+ sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, &type);
-+
- if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
- phy->phy_state = PHY_EMPTY;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
- /*
-- * Even though the PHY is empty, for convenience we discover
-- * the PHY to update the PHY info, like negotiated linkrate.
-+ * Even though the PHY is empty, for convenience we update
-+ * the PHY info, like negotiated linkrate.
- */
-- sas_ex_phy_discover(dev, phy_id);
-- return res;
-+ if (res == 0)
-+ sas_set_ex_phy(dev, phy_id, disc_resp);
-+ goto out_free_resp;
- } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) &&
- dev_type_flutter(type, phy->attached_dev_type)) {
- struct domain_device *ata_dev = sas_ex_to_ata(dev, phy_id);
-@@ -2088,7 +2097,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
- action = ", needs recovery";
- SAS_DPRINTK("ex %016llx phy 0x%x broadcast flutter%s\n",
- SAS_ADDR(dev->sas_addr), phy_id, action);
-- return res;
-+ goto out_free_resp;
- }
-
- /* we always have to delete the old device when we went here */
-@@ -2097,7 +2106,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
- SAS_ADDR(phy->attached_sas_addr));
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-
-- return sas_discover_new(dev, phy_id);
-+ res = sas_discover_new(dev, phy_id);
-+out_free_resp:
-+ kfree(disc_resp);
-+ return res;
- }
-
- /**
---
-2.43.0
-
+++ /dev/null
-From e7769bc15d1cb9dc507bc0d38a0d8b34fded9bce Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 Jun 2022 11:24:54 +0900
-Subject: scsi: libsas: Introduce struct smp_disc_resp
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-
-[ Upstream commit c3752f44604f3bc4f3ce6e169fa32d16943ff70b ]
-
-When compiling with gcc 12, several warnings are thrown by gcc when
-compiling drivers/scsi/libsas/sas_expander.c, e.g.:
-
-In function ‘sas_get_phy_change_count’,
- inlined from ‘sas_find_bcast_phy.constprop’ at
-drivers/scsi/libsas/sas_expander.c:1737:9:
-drivers/scsi/libsas/sas_expander.c:1697:39: warning: array subscript
-‘struct smp_resp[0]’ is partly outside array bounds of ‘unsigned
-char[56]’ [-Warray-bounds]
- 1697 | *pcc = disc_resp->disc.change_count;
- | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
-
-This is due to the use of the struct smp_resp to aggregate all possible
-response types using a union but allocating a response buffer with a size
-exactly equal to the size of the response type needed. This leads to access
-to fields of struct smp_resp from an allocated memory area that is smaller
-than the size of struct smp_resp.
-
-Fix this by defining struct smp_disc_resp for sas discovery operations.
-Since this structure and the generic struct smp_resp are identical for
-the little endian and big endian archs, move the definition of these
-structures at the end of include/scsi/sas.h to avoid repeating their
-definition.
-
-Link: https://lore.kernel.org/r/20220609022456.409087-2-damien.lemoal@opensource.wdc.com
-Reviewed-by: John Garry <john.garry@huawei.com>
-Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 8e68a458bcf5 ("scsi: libsas: Fix disk not being scanned in after being removed")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 32 +++++++++++++-----------------
- include/scsi/sas.h | 28 +++++++++++---------------
- 2 files changed, 26 insertions(+), 34 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index dd21d1331db31..aaa3bc79517db 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -205,13 +205,13 @@ static enum sas_device_type to_dev_type(struct discover_resp *dr)
- return dr->attached_dev_type;
- }
-
--static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
-+static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
-+ struct smp_disc_resp *disc_resp)
- {
- enum sas_device_type dev_type;
- enum sas_linkrate linkrate;
- u8 sas_addr[SAS_ADDR_SIZE];
-- struct smp_resp *resp = rsp;
-- struct discover_resp *dr = &resp->disc;
-+ struct discover_resp *dr = &disc_resp->disc;
- struct sas_ha_struct *ha = dev->port->ha;
- struct expander_device *ex = &dev->ex_dev;
- struct ex_phy *phy = &ex->ex_phy[phy_id];
-@@ -228,7 +228,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
- BUG_ON(!phy->phy);
- }
-
-- switch (resp->result) {
-+ switch (disc_resp->result) {
- case SMP_RESP_PHY_VACANT:
- phy->phy_state = PHY_VACANT;
- break;
-@@ -377,12 +377,13 @@ struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id)
- }
-
- #define DISCOVER_REQ_SIZE 16
--#define DISCOVER_RESP_SIZE 56
-+#define DISCOVER_RESP_SIZE sizeof(struct smp_disc_resp)
-
- static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req,
-- u8 *disc_resp, int single)
-+ struct smp_disc_resp *disc_resp,
-+ int single)
- {
-- struct discover_resp *dr;
-+ struct discover_resp *dr = &disc_resp->disc;
- int res;
-
- disc_req[9] = single;
-@@ -391,7 +392,6 @@ static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req,
- disc_resp, DISCOVER_RESP_SIZE);
- if (res)
- return res;
-- dr = &((struct smp_resp *)disc_resp)->disc;
- if (memcmp(dev->sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE) == 0) {
- sas_printk("Found loopback topology, just ignore it!\n");
- return 0;
-@@ -405,7 +405,7 @@ int sas_ex_phy_discover(struct domain_device *dev, int single)
- struct expander_device *ex = &dev->ex_dev;
- int res = 0;
- u8 *disc_req;
-- u8 *disc_resp;
-+ struct smp_disc_resp *disc_resp;
-
- disc_req = alloc_smp_req(DISCOVER_REQ_SIZE);
- if (!disc_req)
-@@ -1720,7 +1720,7 @@ int sas_discover_root_expander(struct domain_device *dev)
- /* ---------- Domain revalidation ---------- */
-
- static int sas_get_phy_discover(struct domain_device *dev,
-- int phy_id, struct smp_resp *disc_resp)
-+ int phy_id, struct smp_disc_resp *disc_resp)
- {
- int res;
- u8 *disc_req;
-@@ -1736,10 +1736,8 @@ static int sas_get_phy_discover(struct domain_device *dev,
- disc_resp, DISCOVER_RESP_SIZE);
- if (res)
- goto out;
-- else if (disc_resp->result != SMP_RESP_FUNC_ACC) {
-+ if (disc_resp->result != SMP_RESP_FUNC_ACC)
- res = disc_resp->result;
-- goto out;
-- }
- out:
- kfree(disc_req);
- return res;
-@@ -1749,7 +1747,7 @@ static int sas_get_phy_change_count(struct domain_device *dev,
- int phy_id, int *pcc)
- {
- int res;
-- struct smp_resp *disc_resp;
-+ struct smp_disc_resp *disc_resp;
-
- disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
- if (!disc_resp)
-@@ -1767,19 +1765,17 @@ static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
- u8 *sas_addr, enum sas_device_type *type)
- {
- int res;
-- struct smp_resp *disc_resp;
-- struct discover_resp *dr;
-+ struct smp_disc_resp *disc_resp;
-
- disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
- if (!disc_resp)
- return -ENOMEM;
-- dr = &disc_resp->disc;
-
- res = sas_get_phy_discover(dev, phy_id, disc_resp);
- if (res == 0) {
- memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
- SAS_ADDR_SIZE);
-- *type = to_dev_type(dr);
-+ *type = to_dev_type(&disc_resp->disc);
- if (*type == 0)
- memset(sas_addr, 0, SAS_ADDR_SIZE);
- }
-diff --git a/include/scsi/sas.h b/include/scsi/sas.h
-index 42a84ef42683a..f3a68b6464f36 100644
---- a/include/scsi/sas.h
-+++ b/include/scsi/sas.h
-@@ -477,18 +477,6 @@ struct report_phy_sata_resp {
- __be32 crc;
- } __attribute__ ((packed));
-
--struct smp_resp {
-- u8 frame_type;
-- u8 function;
-- u8 result;
-- u8 reserved;
-- union {
-- struct report_general_resp rg;
-- struct discover_resp disc;
-- struct report_phy_sata_resp rps;
-- };
--} __attribute__ ((packed));
--
- #elif defined(__BIG_ENDIAN_BITFIELD)
- struct sas_identify_frame {
- /* Byte 0 */
-@@ -708,6 +696,18 @@ struct report_phy_sata_resp {
- __be32 crc;
- } __attribute__ ((packed));
-
-+#else
-+#error "Bitfield order not defined!"
-+#endif
-+
-+struct smp_disc_resp {
-+ u8 frame_type;
-+ u8 function;
-+ u8 result;
-+ u8 reserved;
-+ struct discover_resp disc;
-+} __attribute__ ((packed));
-+
- struct smp_resp {
- u8 frame_type;
- u8 function;
-@@ -720,8 +720,4 @@ struct smp_resp {
- };
- } __attribute__ ((packed));
-
--#else
--#error "Bitfield order not defined!"
--#endif
--
- #endif /* _SAS_H_ */
---
-2.43.0
-
+++ /dev/null
-From 6e6a45a7df69b2b9793a9ca748eb4a1cd8bd1a24 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2019 16:57:52 +0800
-Subject: scsi: libsas: Stop hardcoding SAS address length
-
-From: John Garry <john.garry@huawei.com>
-
-[ Upstream commit 7b27c5fe247b4288f41551ced5bf458f58dc77b8 ]
-
-Many times we use 8 for SAS address length, while we already have a macro
-for this - SAS_ADDR_SIZE.
-
-Replace instances of this with the macro. However, don't touch the SAS
-address array sizes sas.h, as these are defined according to the SAS spec.
-
-Some missing whitespaces are also added, and whitespace indentation
-in sas_hash_addr() is also fixed (see sas_hash_addr()).
-
-Signed-off-by: John Garry <john.garry@huawei.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 8e68a458bcf5 ("scsi: libsas: Fix disk not being scanned in after being removed")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 15 +++++------
- drivers/scsi/libsas/sas_init.c | 40 ++++++++++++++++--------------
- include/scsi/libsas.h | 6 ++---
- 3 files changed, 32 insertions(+), 29 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index 3e74fe9257617..dd21d1331db31 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -1158,7 +1158,7 @@ static int sas_find_sub_addr(struct domain_device *dev, u8 *sub_addr)
- phy->attached_dev_type == SAS_FANOUT_EXPANDER_DEVICE) &&
- phy->routing_attr == SUBTRACTIVE_ROUTING) {
-
-- memcpy(sub_addr, phy->attached_sas_addr,SAS_ADDR_SIZE);
-+ memcpy(sub_addr, phy->attached_sas_addr, SAS_ADDR_SIZE);
-
- return 1;
- }
-@@ -1170,7 +1170,7 @@ static int sas_check_level_subtractive_boundary(struct domain_device *dev)
- {
- struct expander_device *ex = &dev->ex_dev;
- struct domain_device *child;
-- u8 sub_addr[8] = {0, };
-+ u8 sub_addr[SAS_ADDR_SIZE] = {0, };
-
- list_for_each_entry(child, &ex->children, siblings) {
- if (child->dev_type != SAS_EDGE_EXPANDER_DEVICE &&
-@@ -1180,7 +1180,7 @@ static int sas_check_level_subtractive_boundary(struct domain_device *dev)
- sas_find_sub_addr(child, sub_addr);
- continue;
- } else {
-- u8 s2[8];
-+ u8 s2[SAS_ADDR_SIZE];
-
- if (sas_find_sub_addr(child, s2) &&
- (SAS_ADDR(sub_addr) != SAS_ADDR(s2))) {
-@@ -1777,10 +1777,11 @@ static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
-
- res = sas_get_phy_discover(dev, phy_id, disc_resp);
- if (res == 0) {
-- memcpy(sas_addr, disc_resp->disc.attached_sas_addr, 8);
-+ memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
-+ SAS_ADDR_SIZE);
- *type = to_dev_type(dr);
- if (*type == 0)
-- memset(sas_addr, 0, 8);
-+ memset(sas_addr, 0, SAS_ADDR_SIZE);
- }
- kfree(disc_resp);
- return res;
-@@ -2044,10 +2045,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
- struct expander_device *ex = &dev->ex_dev;
- struct ex_phy *phy = &ex->ex_phy[phy_id];
- enum sas_device_type type = SAS_PHY_UNUSED;
-- u8 sas_addr[8];
-+ u8 sas_addr[SAS_ADDR_SIZE];
- int res;
-
-- memset(sas_addr, 0, 8);
-+ memset(sas_addr, 0, SAS_ADDR_SIZE);
- res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
- switch (res) {
- case SMP_RESP_NO_PHY:
-diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
-index ede0af78144f8..89bdd0c1a779e 100644
---- a/drivers/scsi/libsas/sas_init.c
-+++ b/drivers/scsi/libsas/sas_init.c
-@@ -87,25 +87,27 @@ EXPORT_SYMBOL_GPL(sas_free_task);
- /*------------ SAS addr hash -----------*/
- void sas_hash_addr(u8 *hashed, const u8 *sas_addr)
- {
-- const u32 poly = 0x00DB2777;
-- u32 r = 0;
-- int i;
--
-- for (i = 0; i < 8; i++) {
-- int b;
-- for (b = 7; b >= 0; b--) {
-- r <<= 1;
-- if ((1 << b) & sas_addr[i]) {
-- if (!(r & 0x01000000))
-- r ^= poly;
-- } else if (r & 0x01000000)
-- r ^= poly;
-- }
-- }
--
-- hashed[0] = (r >> 16) & 0xFF;
-- hashed[1] = (r >> 8) & 0xFF ;
-- hashed[2] = r & 0xFF;
-+ const u32 poly = 0x00DB2777;
-+ u32 r = 0;
-+ int i;
-+
-+ for (i = 0; i < SAS_ADDR_SIZE; i++) {
-+ int b;
-+
-+ for (b = (SAS_ADDR_SIZE - 1); b >= 0; b--) {
-+ r <<= 1;
-+ if ((1 << b) & sas_addr[i]) {
-+ if (!(r & 0x01000000))
-+ r ^= poly;
-+ } else if (r & 0x01000000) {
-+ r ^= poly;
-+ }
-+ }
-+ }
-+
-+ hashed[0] = (r >> 16) & 0xFF;
-+ hashed[1] = (r >> 8) & 0xFF;
-+ hashed[2] = r & 0xFF;
- }
-
- int sas_register_ha(struct sas_ha_struct *sas_ha)
-diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
-index 3de3b10da19a9..4c8a89246798d 100644
---- a/include/scsi/libsas.h
-+++ b/include/scsi/libsas.h
-@@ -245,9 +245,9 @@ static inline struct sas_discovery_event *to_sas_discovery_event(struct work_str
- struct sas_discovery {
- struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
- unsigned long pending;
-- u8 fanout_sas_addr[8];
-- u8 eeds_a[8];
-- u8 eeds_b[8];
-+ u8 fanout_sas_addr[SAS_ADDR_SIZE];
-+ u8 eeds_a[SAS_ADDR_SIZE];
-+ u8 eeds_b[SAS_ADDR_SIZE];
- int max_level;
- };
-
---
-2.43.0
-
+++ /dev/null
-From e4069043e43a4eef4a9c5aa3014e8aef307208f1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 15 Nov 2018 18:20:29 +0800
-Subject: scsi: libsas: Use pr_fmt(fmt)
-
-From: John Garry <john.garry@huawei.com>
-
-[ Upstream commit d188e5db9d274db4c183861438f883c1d74b0f16 ]
-
-In preparation for dropping the libsas printk wrappers, use pr_fmt(fmt)
-declaration to add the framework log prefix - "sas".
-
-Suggested-by: Joe Perches <joe@perches.com>
-Signed-off-by: John Garry <john.garry@huawei.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 8e68a458bcf5 ("scsi: libsas: Fix disk not being scanned in after being removed")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_ata.c | 2 +-
- drivers/scsi/libsas/sas_internal.h | 13 +++++++++++--
- drivers/scsi/libsas/sas_task.c | 3 +++
- 3 files changed, 15 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
-index 685d7a16bcd4c..b6d6020a5345e 100644
---- a/drivers/scsi/libsas/sas_ata.c
-+++ b/drivers/scsi/libsas/sas_ata.c
-@@ -377,7 +377,7 @@ static int sas_ata_printk(const char *level, const struct domain_device *ddev,
- vaf.fmt = fmt;
- vaf.va = &args;
-
-- r = printk("%ssas: ata%u: %s: %pV",
-+ r = printk("%s" SAS_FMT "ata%u: %s: %pV",
- level, ap->print_id, dev_name(dev), &vaf);
-
- va_end(args);
-diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
-index 50e12d662ffe3..94ebf4183717c 100644
---- a/drivers/scsi/libsas/sas_internal.h
-+++ b/drivers/scsi/libsas/sas_internal.h
-@@ -32,9 +32,18 @@
- #include <scsi/libsas.h>
- #include <scsi/sas_ata.h>
-
--#define sas_printk(fmt, ...) printk(KERN_NOTICE "sas: " fmt, ## __VA_ARGS__)
-+#ifdef pr_fmt
-+#undef pr_fmt
-+#endif
-+
-+#define SAS_FMT "sas: "
-+
-+#define pr_fmt(fmt) SAS_FMT fmt
-+
-+#define sas_printk(fmt, ...) printk(KERN_NOTICE fmt, ## __VA_ARGS__)
-+
-+#define SAS_DPRINTK(fmt, ...) printk(KERN_DEBUG fmt, ## __VA_ARGS__)
-
--#define SAS_DPRINTK(fmt, ...) printk(KERN_DEBUG "sas: " fmt, ## __VA_ARGS__)
-
- #define TO_SAS_TASK(_scsi_cmd) ((void *)(_scsi_cmd)->host_scribble)
- #define ASSIGN_SAS_TASK(_sc, _t) do { (_sc)->host_scribble = (void *) _t; } while (0)
-diff --git a/drivers/scsi/libsas/sas_task.c b/drivers/scsi/libsas/sas_task.c
-index a78e5bd3e5145..d305c8f90ee9b 100644
---- a/drivers/scsi/libsas/sas_task.c
-+++ b/drivers/scsi/libsas/sas_task.c
-@@ -1,3 +1,6 @@
-+
-+#include "sas_internal.h"
-+
- #include <linux/kernel.h>
- #include <linux/export.h>
- #include <scsi/sas.h>
---
-2.43.0
-
nfc-nci-fix-uninit-value-in-nci_dev_up-and-nci_ntf_p.patch
mptcp-add-sk_stop_timer_sync-helper.patch
tcp-properly-terminate-timers-for-kernel-sockets.patch
-scsi-libsas-use-pr_fmt-fmt.patch
-scsi-libsas-stop-hardcoding-sas-address-length.patch
-scsi-libsas-introduce-struct-smp_disc_resp.patch
-scsi-libsas-add-a-helper-sas_get_sas_addr_and_dev_ty.patch
-scsi-libsas-fix-disk-not-being-scanned-in-after-bein.patch
r8169-fix-issue-caused-by-buggy-bios-on-certain-boards-with-rtl8168d.patch
bluetooth-hci_event-set-the-conn-encrypted-before-conn-establishes.patch
bluetooth-fix-toctou-in-hci-debugfs-implementation.patch
+++ /dev/null
-From e2e6c1ea15d971a9a50863782b72e934c2ff46b5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 14:14:12 +0000
-Subject: scsi: libsas: Add a helper sas_get_sas_addr_and_dev_type()
-
-From: Xingui Yang <yangxingui@huawei.com>
-
-[ Upstream commit a57345279fd311ba679b8083feb0eec5272c7729 ]
-
-Add a helper to get attached_sas_addr and device type from disc_resp.
-
-Suggested-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Xingui Yang <yangxingui@huawei.com>
-Link: https://lore.kernel.org/r/20240307141413.48049-2-yangxingui@huawei.com
-Reviewed-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 8e68a458bcf5 ("scsi: libsas: Fix disk not being scanned in after being removed")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 19 ++++++++++++-------
- 1 file changed, 12 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index 8b061347a8ac7..a673a08c72126 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -1672,6 +1672,16 @@ int sas_discover_root_expander(struct domain_device *dev)
-
- /* ---------- Domain revalidation ---------- */
-
-+static void sas_get_sas_addr_and_dev_type(struct smp_disc_resp *disc_resp,
-+ u8 *sas_addr,
-+ enum sas_device_type *type)
-+{
-+ memcpy(sas_addr, disc_resp->disc.attached_sas_addr, SAS_ADDR_SIZE);
-+ *type = to_dev_type(&disc_resp->disc);
-+ if (*type == SAS_PHY_UNUSED)
-+ memset(sas_addr, 0, SAS_ADDR_SIZE);
-+}
-+
- static int sas_get_phy_discover(struct domain_device *dev,
- int phy_id, struct smp_disc_resp *disc_resp)
- {
-@@ -1725,13 +1735,8 @@ static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
- return -ENOMEM;
-
- res = sas_get_phy_discover(dev, phy_id, disc_resp);
-- if (res == 0) {
-- memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
-- SAS_ADDR_SIZE);
-- *type = to_dev_type(&disc_resp->disc);
-- if (*type == 0)
-- memset(sas_addr, 0, SAS_ADDR_SIZE);
-- }
-+ if (res == 0)
-+ sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, type);
- kfree(disc_resp);
- return res;
- }
---
-2.43.0
-
+++ /dev/null
-From 1aa0b9877f985f580d3f7d3e43050ed25faca5cd Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 14:14:13 +0000
-Subject: scsi: libsas: Fix disk not being scanned in after being removed
-
-From: Xingui Yang <yangxingui@huawei.com>
-
-[ Upstream commit 8e68a458bcf5b5cb9c3624598bae28f08251601f ]
-
-As of commit d8649fc1c5e4 ("scsi: libsas: Do discovery on empty PHY to
-update PHY info"), do discovery will send a new SMP_DISCOVER and update
-phy->phy_change_count. We found that if the disk is reconnected and phy
-change_count changes at this time, the disk scanning process will not be
-triggered.
-
-Therefore, call sas_set_ex_phy() to update the PHY info with the results of
-the last query. And because the previous phy info will be used when calling
-sas_unregister_devs_sas_addr(), sas_unregister_devs_sas_addr() should be
-called before sas_set_ex_phy().
-
-Fixes: d8649fc1c5e4 ("scsi: libsas: Do discovery on empty PHY to update PHY info")
-Signed-off-by: Xingui Yang <yangxingui@huawei.com>
-Link: https://lore.kernel.org/r/20240307141413.48049-3-yangxingui@huawei.com
-Reviewed-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 32 ++++++++++++++++++++----------
- 1 file changed, 22 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index a673a08c72126..2c857ccf33a21 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -1998,6 +1998,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
- struct expander_device *ex = &dev->ex_dev;
- struct ex_phy *phy = &ex->ex_phy[phy_id];
- enum sas_device_type type = SAS_PHY_UNUSED;
-+ struct smp_disc_resp *disc_resp;
- u8 sas_addr[SAS_ADDR_SIZE];
- char msg[80] = "";
- int res;
-@@ -2009,33 +2010,41 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
- SAS_ADDR(dev->sas_addr), phy_id, msg);
-
- memset(sas_addr, 0, SAS_ADDR_SIZE);
-- res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
-+ disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
-+ if (!disc_resp)
-+ return -ENOMEM;
-+
-+ res = sas_get_phy_discover(dev, phy_id, disc_resp);
- switch (res) {
- case SMP_RESP_NO_PHY:
- phy->phy_state = PHY_NOT_PRESENT;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-- return res;
-+ goto out_free_resp;
- case SMP_RESP_PHY_VACANT:
- phy->phy_state = PHY_VACANT;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-- return res;
-+ goto out_free_resp;
- case SMP_RESP_FUNC_ACC:
- break;
- case -ECOMM:
- break;
- default:
-- return res;
-+ goto out_free_resp;
- }
-
-+ if (res == 0)
-+ sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, &type);
-+
- if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
- phy->phy_state = PHY_EMPTY;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
- /*
-- * Even though the PHY is empty, for convenience we discover
-- * the PHY to update the PHY info, like negotiated linkrate.
-+ * Even though the PHY is empty, for convenience we update
-+ * the PHY info, like negotiated linkrate.
- */
-- sas_ex_phy_discover(dev, phy_id);
-- return res;
-+ if (res == 0)
-+ sas_set_ex_phy(dev, phy_id, disc_resp);
-+ goto out_free_resp;
- } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) &&
- dev_type_flutter(type, phy->attached_dev_type)) {
- struct domain_device *ata_dev = sas_ex_to_ata(dev, phy_id);
-@@ -2047,7 +2056,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
- action = ", needs recovery";
- pr_debug("ex %016llx phy%02d broadcast flutter%s\n",
- SAS_ADDR(dev->sas_addr), phy_id, action);
-- return res;
-+ goto out_free_resp;
- }
-
- /* we always have to delete the old device when we went here */
-@@ -2056,7 +2065,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
- SAS_ADDR(phy->attached_sas_addr));
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-
-- return sas_discover_new(dev, phy_id);
-+ res = sas_discover_new(dev, phy_id);
-+out_free_resp:
-+ kfree(disc_resp);
-+ return res;
- }
-
- /**
---
-2.43.0
-
+++ /dev/null
-From 36d4f026f1c3be3035578fee0174d23528d57b02 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 Jun 2022 11:24:54 +0900
-Subject: scsi: libsas: Introduce struct smp_disc_resp
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-
-[ Upstream commit c3752f44604f3bc4f3ce6e169fa32d16943ff70b ]
-
-When compiling with gcc 12, several warnings are thrown by gcc when
-compiling drivers/scsi/libsas/sas_expander.c, e.g.:
-
-In function ‘sas_get_phy_change_count’,
- inlined from ‘sas_find_bcast_phy.constprop’ at
-drivers/scsi/libsas/sas_expander.c:1737:9:
-drivers/scsi/libsas/sas_expander.c:1697:39: warning: array subscript
-‘struct smp_resp[0]’ is partly outside array bounds of ‘unsigned
-char[56]’ [-Warray-bounds]
- 1697 | *pcc = disc_resp->disc.change_count;
- | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
-
-This is due to the use of the struct smp_resp to aggregate all possible
-response types using a union but allocating a response buffer with a size
-exactly equal to the size of the response type needed. This leads to access
-to fields of struct smp_resp from an allocated memory area that is smaller
-than the size of struct smp_resp.
-
-Fix this by defining struct smp_disc_resp for sas discovery operations.
-Since this structure and the generic struct smp_resp are identical for
-the little endian and big endian archs, move the definition of these
-structures at the end of include/scsi/sas.h to avoid repeating their
-definition.
-
-Link: https://lore.kernel.org/r/20220609022456.409087-2-damien.lemoal@opensource.wdc.com
-Reviewed-by: John Garry <john.garry@huawei.com>
-Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 8e68a458bcf5 ("scsi: libsas: Fix disk not being scanned in after being removed")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 32 +++++++++++++-----------------
- include/scsi/sas.h | 28 +++++++++++---------------
- 2 files changed, 26 insertions(+), 34 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index 8444a4287ac1c..8b061347a8ac7 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -192,13 +192,13 @@ static enum sas_device_type to_dev_type(struct discover_resp *dr)
- return dr->attached_dev_type;
- }
-
--static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
-+static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
-+ struct smp_disc_resp *disc_resp)
- {
- enum sas_device_type dev_type;
- enum sas_linkrate linkrate;
- u8 sas_addr[SAS_ADDR_SIZE];
-- struct smp_resp *resp = rsp;
-- struct discover_resp *dr = &resp->disc;
-+ struct discover_resp *dr = &disc_resp->disc;
- struct sas_ha_struct *ha = dev->port->ha;
- struct expander_device *ex = &dev->ex_dev;
- struct ex_phy *phy = &ex->ex_phy[phy_id];
-@@ -215,7 +215,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
- BUG_ON(!phy->phy);
- }
-
-- switch (resp->result) {
-+ switch (disc_resp->result) {
- case SMP_RESP_PHY_VACANT:
- phy->phy_state = PHY_VACANT;
- break;
-@@ -364,12 +364,13 @@ struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id)
- }
-
- #define DISCOVER_REQ_SIZE 16
--#define DISCOVER_RESP_SIZE 56
-+#define DISCOVER_RESP_SIZE sizeof(struct smp_disc_resp)
-
- static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req,
-- u8 *disc_resp, int single)
-+ struct smp_disc_resp *disc_resp,
-+ int single)
- {
-- struct discover_resp *dr;
-+ struct discover_resp *dr = &disc_resp->disc;
- int res;
-
- disc_req[9] = single;
-@@ -378,7 +379,6 @@ static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req,
- disc_resp, DISCOVER_RESP_SIZE);
- if (res)
- return res;
-- dr = &((struct smp_resp *)disc_resp)->disc;
- if (memcmp(dev->sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE) == 0) {
- pr_notice("Found loopback topology, just ignore it!\n");
- return 0;
-@@ -392,7 +392,7 @@ int sas_ex_phy_discover(struct domain_device *dev, int single)
- struct expander_device *ex = &dev->ex_dev;
- int res = 0;
- u8 *disc_req;
-- u8 *disc_resp;
-+ struct smp_disc_resp *disc_resp;
-
- disc_req = alloc_smp_req(DISCOVER_REQ_SIZE);
- if (!disc_req)
-@@ -1673,7 +1673,7 @@ int sas_discover_root_expander(struct domain_device *dev)
- /* ---------- Domain revalidation ---------- */
-
- static int sas_get_phy_discover(struct domain_device *dev,
-- int phy_id, struct smp_resp *disc_resp)
-+ int phy_id, struct smp_disc_resp *disc_resp)
- {
- int res;
- u8 *disc_req;
-@@ -1689,10 +1689,8 @@ static int sas_get_phy_discover(struct domain_device *dev,
- disc_resp, DISCOVER_RESP_SIZE);
- if (res)
- goto out;
-- else if (disc_resp->result != SMP_RESP_FUNC_ACC) {
-+ if (disc_resp->result != SMP_RESP_FUNC_ACC)
- res = disc_resp->result;
-- goto out;
-- }
- out:
- kfree(disc_req);
- return res;
-@@ -1702,7 +1700,7 @@ static int sas_get_phy_change_count(struct domain_device *dev,
- int phy_id, int *pcc)
- {
- int res;
-- struct smp_resp *disc_resp;
-+ struct smp_disc_resp *disc_resp;
-
- disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
- if (!disc_resp)
-@@ -1720,19 +1718,17 @@ static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
- u8 *sas_addr, enum sas_device_type *type)
- {
- int res;
-- struct smp_resp *disc_resp;
-- struct discover_resp *dr;
-+ struct smp_disc_resp *disc_resp;
-
- disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
- if (!disc_resp)
- return -ENOMEM;
-- dr = &disc_resp->disc;
-
- res = sas_get_phy_discover(dev, phy_id, disc_resp);
- if (res == 0) {
- memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
- SAS_ADDR_SIZE);
-- *type = to_dev_type(dr);
-+ *type = to_dev_type(&disc_resp->disc);
- if (*type == 0)
- memset(sas_addr, 0, SAS_ADDR_SIZE);
- }
-diff --git a/include/scsi/sas.h b/include/scsi/sas.h
-index 4726c1bbec659..2f73c24d4c9b9 100644
---- a/include/scsi/sas.h
-+++ b/include/scsi/sas.h
-@@ -460,18 +460,6 @@ struct report_phy_sata_resp {
- __be32 crc;
- } __attribute__ ((packed));
-
--struct smp_resp {
-- u8 frame_type;
-- u8 function;
-- u8 result;
-- u8 reserved;
-- union {
-- struct report_general_resp rg;
-- struct discover_resp disc;
-- struct report_phy_sata_resp rps;
-- };
--} __attribute__ ((packed));
--
- #elif defined(__BIG_ENDIAN_BITFIELD)
- struct sas_identify_frame {
- /* Byte 0 */
-@@ -691,6 +679,18 @@ struct report_phy_sata_resp {
- __be32 crc;
- } __attribute__ ((packed));
-
-+#else
-+#error "Bitfield order not defined!"
-+#endif
-+
-+struct smp_disc_resp {
-+ u8 frame_type;
-+ u8 function;
-+ u8 result;
-+ u8 reserved;
-+ struct discover_resp disc;
-+} __attribute__ ((packed));
-+
- struct smp_resp {
- u8 frame_type;
- u8 function;
-@@ -703,8 +703,4 @@ struct smp_resp {
- };
- } __attribute__ ((packed));
-
--#else
--#error "Bitfield order not defined!"
--#endif
--
- #endif /* _SAS_H_ */
---
-2.43.0
-
pci-dpc-quirk-pio-log-size-for-intel-ice-lake-root-ports.patch
scsi-lpfc-correct-size-for-wqe-for-memset.patch
usb-core-fix-deadlock-in-usb_deauthorize_interface.patch
-scsi-libsas-introduce-struct-smp_disc_resp.patch
-scsi-libsas-add-a-helper-sas_get_sas_addr_and_dev_ty.patch
-scsi-libsas-fix-disk-not-being-scanned-in-after-bein.patch
nfc-nci-fix-uninit-value-in-nci_dev_up-and-nci_ntf_p.patch
ixgbe-avoid-sleeping-allocation-in-ixgbe_ipsec_vf_ad.patch
tcp-properly-terminate-timers-for-kernel-sockets.patch
+++ /dev/null
-From 761d7a30a7e838b3108865a78e7134a18b77ee54 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 18 Jul 2023 16:38:08 +1000
-Subject: nfsd: don't allow nfsd threads to be signalled.
-
-From: NeilBrown <neilb@suse.de>
-
-[ Upstream commit 3903902401451b1cd9d797a8c79769eb26ac7fe5 ]
-
-The original implementation of nfsd used signals to stop threads during
-shutdown.
-In Linux 2.3.46pre5 nfsd gained the ability to shutdown threads
-internally it if was asked to run "0" threads. After this user-space
-transitioned to using "rpc.nfsd 0" to stop nfsd and sending signals to
-threads was no longer an important part of the API.
-
-In commit 3ebdbe5203a8 ("SUNRPC: discard svo_setup and rename
-svc_set_num_threads_sync()") (v5.17-rc1~75^2~41) we finally removed the
-use of signals for stopping threads, using kthread_stop() instead.
-
-This patch makes the "obvious" next step and removes the ability to
-signal nfsd threads - or any svc threads. nfsd stops allowing signals
-and we don't check for their delivery any more.
-
-This will allow for some simplification in later patches.
-
-A change worth noting is in nfsd4_ssc_setup_dul(). There was previously
-a signal_pending() check which would only succeed when the thread was
-being shut down. It should really have tested kthread_should_stop() as
-well. Now it just does the latter, not the former.
-
-Signed-off-by: NeilBrown <neilb@suse.de>
-Reviewed-by: Jeff Layton <jlayton@kernel.org>
-Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
----
- fs/nfs/callback.c | 9 +--------
- fs/nfsd/nfs4proc.c | 5 ++---
- fs/nfsd/nfssvc.c | 12 ------------
- net/sunrpc/svc_xprt.c | 16 ++++++----------
- 4 files changed, 9 insertions(+), 33 deletions(-)
-
-diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
-index 456af7d230cf1..46a0a2d6962e1 100644
---- a/fs/nfs/callback.c
-+++ b/fs/nfs/callback.c
-@@ -80,9 +80,6 @@ nfs4_callback_svc(void *vrqstp)
- set_freezable();
-
- while (!kthread_freezable_should_stop(NULL)) {
--
-- if (signal_pending(current))
-- flush_signals(current);
- /*
- * Listen for a request on the socket
- */
-@@ -112,11 +109,7 @@ nfs41_callback_svc(void *vrqstp)
- set_freezable();
-
- while (!kthread_freezable_should_stop(NULL)) {
--
-- if (signal_pending(current))
-- flush_signals(current);
--
-- prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
-+ prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_IDLE);
- spin_lock_bh(&serv->sv_cb_lock);
- if (!list_empty(&serv->sv_cb_list)) {
- req = list_first_entry(&serv->sv_cb_list,
-diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
-index ba53cd89ec62c..b6d768bd5ccca 100644
---- a/fs/nfsd/nfs4proc.c
-+++ b/fs/nfsd/nfs4proc.c
-@@ -1313,12 +1313,11 @@ static __be32 nfsd4_ssc_setup_dul(struct nfsd_net *nn, char *ipaddr,
- /* found a match */
- if (ni->nsui_busy) {
- /* wait - and try again */
-- prepare_to_wait(&nn->nfsd_ssc_waitq, &wait,
-- TASK_INTERRUPTIBLE);
-+ prepare_to_wait(&nn->nfsd_ssc_waitq, &wait, TASK_IDLE);
- spin_unlock(&nn->nfsd_ssc_lock);
-
- /* allow 20secs for mount/unmount for now - revisit */
-- if (signal_pending(current) ||
-+ if (kthread_should_stop() ||
- (schedule_timeout(20*HZ) == 0)) {
- finish_wait(&nn->nfsd_ssc_waitq, &wait);
- kfree(work);
-diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
-index a0ecec54d3d7d..8063fab2c0279 100644
---- a/fs/nfsd/nfssvc.c
-+++ b/fs/nfsd/nfssvc.c
-@@ -952,15 +952,6 @@ nfsd(void *vrqstp)
-
- current->fs->umask = 0;
-
-- /*
-- * thread is spawned with all signals set to SIG_IGN, re-enable
-- * the ones that will bring down the thread
-- */
-- allow_signal(SIGKILL);
-- allow_signal(SIGHUP);
-- allow_signal(SIGINT);
-- allow_signal(SIGQUIT);
--
- atomic_inc(&nfsdstats.th_cnt);
-
- set_freezable();
-@@ -985,9 +976,6 @@ nfsd(void *vrqstp)
- validate_process_creds();
- }
-
-- /* Clear signals before calling svc_exit_thread() */
-- flush_signals(current);
--
- atomic_dec(&nfsdstats.th_cnt);
-
- out:
-diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
-index 67ccf1a6459ae..b19592673eef2 100644
---- a/net/sunrpc/svc_xprt.c
-+++ b/net/sunrpc/svc_xprt.c
-@@ -700,8 +700,8 @@ static int svc_alloc_arg(struct svc_rqst *rqstp)
- /* Made progress, don't sleep yet */
- continue;
-
-- set_current_state(TASK_INTERRUPTIBLE);
-- if (signalled() || kthread_should_stop()) {
-+ set_current_state(TASK_IDLE);
-+ if (kthread_should_stop()) {
- set_current_state(TASK_RUNNING);
- return -EINTR;
- }
-@@ -736,7 +736,7 @@ rqst_should_sleep(struct svc_rqst *rqstp)
- return false;
-
- /* are we shutting down? */
-- if (signalled() || kthread_should_stop())
-+ if (kthread_should_stop())
- return false;
-
- /* are we freezing? */
-@@ -758,11 +758,7 @@ static struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout)
- if (rqstp->rq_xprt)
- goto out_found;
-
-- /*
-- * We have to be able to interrupt this wait
-- * to bring down the daemons ...
-- */
-- set_current_state(TASK_INTERRUPTIBLE);
-+ set_current_state(TASK_IDLE);
- smp_mb__before_atomic();
- clear_bit(SP_CONGESTED, &pool->sp_flags);
- clear_bit(RQ_BUSY, &rqstp->rq_flags);
-@@ -784,7 +780,7 @@ static struct svc_xprt *svc_get_next_xprt(struct svc_rqst *rqstp, long timeout)
- if (!time_left)
- atomic_long_inc(&pool->sp_stats.threads_timedout);
-
-- if (signalled() || kthread_should_stop())
-+ if (kthread_should_stop())
- return ERR_PTR(-EINTR);
- return ERR_PTR(-EAGAIN);
- out_found:
-@@ -882,7 +878,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
- try_to_freeze();
- cond_resched();
- err = -EINTR;
-- if (signalled() || kthread_should_stop())
-+ if (kthread_should_stop())
- goto out;
-
- xprt = svc_get_next_xprt(rqstp, timeout);
---
-2.43.0
-
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
- fs/nfsd/nfssvc.c | 5 +++--
+ fs/nfsd/nfssvc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
-diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
-index ee5713fca1870..2a1dd580dfb94 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
-@@ -1084,11 +1084,12 @@ int nfsd_pool_stats_open(struct inode *inode, struct file *file)
+@@ -1096,11 +1096,12 @@ int nfsd_pool_stats_open(struct inode *i
int nfsd_pool_stats_release(struct inode *inode, struct file *file)
{
mutex_unlock(&nfsd_mutex);
return ret;
}
---
-2.43.0
-
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
- fs/nfsd/nfssvc.c | 23 -----------------------
- include/linux/sunrpc/svc.h | 13 -------------
+ fs/nfsd/nfssvc.c | 23 -----------------------
+ include/linux/sunrpc/svc.h | 13 -------------
2 files changed, 36 deletions(-)
-diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
-index 8063fab2c0279..8907dba22c3f2 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
-@@ -979,31 +979,8 @@ nfsd(void *vrqstp)
+@@ -991,31 +991,8 @@ nfsd(void *vrqstp)
atomic_dec(&nfsdstats.th_cnt);
out:
return 0;
}
-diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
-index 53405c282209f..6e48c1c88f1bb 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
-@@ -123,19 +123,6 @@ static inline void svc_put(struct svc_serv *serv)
+@@ -123,19 +123,6 @@ static inline void svc_put(struct svc_se
kref_put(&serv->sv_refcnt, svc_destroy);
}
/*
* Maximum payload size supported by a kernel RPC server.
* This is use to determine the max number of pages nfsd is
---
-2.43.0
-
lockd-drop-inappropriate-svc_get-from-locked_get.patch
nfsd-add-an-nfsd4_encode_nfstime4-helper.patch
nfsd-fix-creation-time-serialization-order.patch
-nfsd-don-t-allow-nfsd-threads-to-be-signalled.patch
nfsd-simplify-code-around-svc_exit_thread-call-in-nf.patch
nfsd-separate-nfsd_last_thread-from-nfsd_put.patch
documentation-add-missing-documentation-for-export_o.patch
+++ /dev/null
-From ef0d8f9db4d00b22a968c7a95002183fccb8728e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 14:14:12 +0000
-Subject: scsi: libsas: Add a helper sas_get_sas_addr_and_dev_type()
-
-From: Xingui Yang <yangxingui@huawei.com>
-
-[ Upstream commit a57345279fd311ba679b8083feb0eec5272c7729 ]
-
-Add a helper to get attached_sas_addr and device type from disc_resp.
-
-Suggested-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Xingui Yang <yangxingui@huawei.com>
-Link: https://lore.kernel.org/r/20240307141413.48049-2-yangxingui@huawei.com
-Reviewed-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 8e68a458bcf5 ("scsi: libsas: Fix disk not being scanned in after being removed")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 19 ++++++++++++-------
- 1 file changed, 12 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index 09a78db60ac55..91902799b7352 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -1672,6 +1672,16 @@ int sas_discover_root_expander(struct domain_device *dev)
-
- /* ---------- Domain revalidation ---------- */
-
-+static void sas_get_sas_addr_and_dev_type(struct smp_disc_resp *disc_resp,
-+ u8 *sas_addr,
-+ enum sas_device_type *type)
-+{
-+ memcpy(sas_addr, disc_resp->disc.attached_sas_addr, SAS_ADDR_SIZE);
-+ *type = to_dev_type(&disc_resp->disc);
-+ if (*type == SAS_PHY_UNUSED)
-+ memset(sas_addr, 0, SAS_ADDR_SIZE);
-+}
-+
- static int sas_get_phy_discover(struct domain_device *dev,
- int phy_id, struct smp_disc_resp *disc_resp)
- {
-@@ -1725,13 +1735,8 @@ static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
- return -ENOMEM;
-
- res = sas_get_phy_discover(dev, phy_id, disc_resp);
-- if (res == 0) {
-- memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
-- SAS_ADDR_SIZE);
-- *type = to_dev_type(&disc_resp->disc);
-- if (*type == 0)
-- memset(sas_addr, 0, SAS_ADDR_SIZE);
-- }
-+ if (res == 0)
-+ sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, type);
- kfree(disc_resp);
- return res;
- }
---
-2.43.0
-
+++ /dev/null
-From 4f65b7d8406529393017ab6273d143b5aee829ed Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 14:14:13 +0000
-Subject: scsi: libsas: Fix disk not being scanned in after being removed
-
-From: Xingui Yang <yangxingui@huawei.com>
-
-[ Upstream commit 8e68a458bcf5b5cb9c3624598bae28f08251601f ]
-
-As of commit d8649fc1c5e4 ("scsi: libsas: Do discovery on empty PHY to
-update PHY info"), do discovery will send a new SMP_DISCOVER and update
-phy->phy_change_count. We found that if the disk is reconnected and phy
-change_count changes at this time, the disk scanning process will not be
-triggered.
-
-Therefore, call sas_set_ex_phy() to update the PHY info with the results of
-the last query. And because the previous phy info will be used when calling
-sas_unregister_devs_sas_addr(), sas_unregister_devs_sas_addr() should be
-called before sas_set_ex_phy().
-
-Fixes: d8649fc1c5e4 ("scsi: libsas: Do discovery on empty PHY to update PHY info")
-Signed-off-by: Xingui Yang <yangxingui@huawei.com>
-Link: https://lore.kernel.org/r/20240307141413.48049-3-yangxingui@huawei.com
-Reviewed-by: John Garry <john.g.garry@oracle.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 32 ++++++++++++++++++++----------
- 1 file changed, 22 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index 91902799b7352..cf1df38a189c5 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -1998,6 +1998,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
- struct expander_device *ex = &dev->ex_dev;
- struct ex_phy *phy = &ex->ex_phy[phy_id];
- enum sas_device_type type = SAS_PHY_UNUSED;
-+ struct smp_disc_resp *disc_resp;
- u8 sas_addr[SAS_ADDR_SIZE];
- char msg[80] = "";
- int res;
-@@ -2009,33 +2010,41 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
- SAS_ADDR(dev->sas_addr), phy_id, msg);
-
- memset(sas_addr, 0, SAS_ADDR_SIZE);
-- res = sas_get_phy_attached_dev(dev, phy_id, sas_addr, &type);
-+ disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
-+ if (!disc_resp)
-+ return -ENOMEM;
-+
-+ res = sas_get_phy_discover(dev, phy_id, disc_resp);
- switch (res) {
- case SMP_RESP_NO_PHY:
- phy->phy_state = PHY_NOT_PRESENT;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-- return res;
-+ goto out_free_resp;
- case SMP_RESP_PHY_VACANT:
- phy->phy_state = PHY_VACANT;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-- return res;
-+ goto out_free_resp;
- case SMP_RESP_FUNC_ACC:
- break;
- case -ECOMM:
- break;
- default:
-- return res;
-+ goto out_free_resp;
- }
-
-+ if (res == 0)
-+ sas_get_sas_addr_and_dev_type(disc_resp, sas_addr, &type);
-+
- if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) {
- phy->phy_state = PHY_EMPTY;
- sas_unregister_devs_sas_addr(dev, phy_id, last);
- /*
-- * Even though the PHY is empty, for convenience we discover
-- * the PHY to update the PHY info, like negotiated linkrate.
-+ * Even though the PHY is empty, for convenience we update
-+ * the PHY info, like negotiated linkrate.
- */
-- sas_ex_phy_discover(dev, phy_id);
-- return res;
-+ if (res == 0)
-+ sas_set_ex_phy(dev, phy_id, disc_resp);
-+ goto out_free_resp;
- } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) &&
- dev_type_flutter(type, phy->attached_dev_type)) {
- struct domain_device *ata_dev = sas_ex_to_ata(dev, phy_id);
-@@ -2047,7 +2056,7 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
- action = ", needs recovery";
- pr_debug("ex %016llx phy%02d broadcast flutter%s\n",
- SAS_ADDR(dev->sas_addr), phy_id, action);
-- return res;
-+ goto out_free_resp;
- }
-
- /* we always have to delete the old device when we went here */
-@@ -2056,7 +2065,10 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id,
- SAS_ADDR(phy->attached_sas_addr));
- sas_unregister_devs_sas_addr(dev, phy_id, last);
-
-- return sas_discover_new(dev, phy_id);
-+ res = sas_discover_new(dev, phy_id);
-+out_free_resp:
-+ kfree(disc_resp);
-+ return res;
- }
-
- /**
---
-2.43.0
-
+++ /dev/null
-From 7d999ec184189bfbd157a086f5e863bc7cff1439 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 Jun 2022 11:24:54 +0900
-Subject: scsi: libsas: Introduce struct smp_disc_resp
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-
-[ Upstream commit c3752f44604f3bc4f3ce6e169fa32d16943ff70b ]
-
-When compiling with gcc 12, several warnings are thrown by gcc when
-compiling drivers/scsi/libsas/sas_expander.c, e.g.:
-
-In function ‘sas_get_phy_change_count’,
- inlined from ‘sas_find_bcast_phy.constprop’ at
-drivers/scsi/libsas/sas_expander.c:1737:9:
-drivers/scsi/libsas/sas_expander.c:1697:39: warning: array subscript
-‘struct smp_resp[0]’ is partly outside array bounds of ‘unsigned
-char[56]’ [-Warray-bounds]
- 1697 | *pcc = disc_resp->disc.change_count;
- | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
-
-This is due to the use of the struct smp_resp to aggregate all possible
-response types using a union but allocating a response buffer with a size
-exactly equal to the size of the response type needed. This leads to access
-to fields of struct smp_resp from an allocated memory area that is smaller
-than the size of struct smp_resp.
-
-Fix this by defining struct smp_disc_resp for sas discovery operations.
-Since this structure and the generic struct smp_resp are identical for
-the little endian and big endian archs, move the definition of these
-structures at the end of include/scsi/sas.h to avoid repeating their
-definition.
-
-Link: https://lore.kernel.org/r/20220609022456.409087-2-damien.lemoal@opensource.wdc.com
-Reviewed-by: John Garry <john.garry@huawei.com>
-Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Stable-dep-of: 8e68a458bcf5 ("scsi: libsas: Fix disk not being scanned in after being removed")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/libsas/sas_expander.c | 32 +++++++++++++-----------------
- include/scsi/sas.h | 28 +++++++++++---------------
- 2 files changed, 26 insertions(+), 34 deletions(-)
-
-diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
-index 173f91ae38f02..09a78db60ac55 100644
---- a/drivers/scsi/libsas/sas_expander.c
-+++ b/drivers/scsi/libsas/sas_expander.c
-@@ -192,13 +192,13 @@ static enum sas_device_type to_dev_type(struct discover_resp *dr)
- return dr->attached_dev_type;
- }
-
--static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
-+static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
-+ struct smp_disc_resp *disc_resp)
- {
- enum sas_device_type dev_type;
- enum sas_linkrate linkrate;
- u8 sas_addr[SAS_ADDR_SIZE];
-- struct smp_resp *resp = rsp;
-- struct discover_resp *dr = &resp->disc;
-+ struct discover_resp *dr = &disc_resp->disc;
- struct sas_ha_struct *ha = dev->port->ha;
- struct expander_device *ex = &dev->ex_dev;
- struct ex_phy *phy = &ex->ex_phy[phy_id];
-@@ -215,7 +215,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
- BUG_ON(!phy->phy);
- }
-
-- switch (resp->result) {
-+ switch (disc_resp->result) {
- case SMP_RESP_PHY_VACANT:
- phy->phy_state = PHY_VACANT;
- break;
-@@ -364,12 +364,13 @@ struct domain_device *sas_ex_to_ata(struct domain_device *ex_dev, int phy_id)
- }
-
- #define DISCOVER_REQ_SIZE 16
--#define DISCOVER_RESP_SIZE 56
-+#define DISCOVER_RESP_SIZE sizeof(struct smp_disc_resp)
-
- static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req,
-- u8 *disc_resp, int single)
-+ struct smp_disc_resp *disc_resp,
-+ int single)
- {
-- struct discover_resp *dr;
-+ struct discover_resp *dr = &disc_resp->disc;
- int res;
-
- disc_req[9] = single;
-@@ -378,7 +379,6 @@ static int sas_ex_phy_discover_helper(struct domain_device *dev, u8 *disc_req,
- disc_resp, DISCOVER_RESP_SIZE);
- if (res)
- return res;
-- dr = &((struct smp_resp *)disc_resp)->disc;
- if (memcmp(dev->sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE) == 0) {
- pr_notice("Found loopback topology, just ignore it!\n");
- return 0;
-@@ -392,7 +392,7 @@ int sas_ex_phy_discover(struct domain_device *dev, int single)
- struct expander_device *ex = &dev->ex_dev;
- int res = 0;
- u8 *disc_req;
-- u8 *disc_resp;
-+ struct smp_disc_resp *disc_resp;
-
- disc_req = alloc_smp_req(DISCOVER_REQ_SIZE);
- if (!disc_req)
-@@ -1673,7 +1673,7 @@ int sas_discover_root_expander(struct domain_device *dev)
- /* ---------- Domain revalidation ---------- */
-
- static int sas_get_phy_discover(struct domain_device *dev,
-- int phy_id, struct smp_resp *disc_resp)
-+ int phy_id, struct smp_disc_resp *disc_resp)
- {
- int res;
- u8 *disc_req;
-@@ -1689,10 +1689,8 @@ static int sas_get_phy_discover(struct domain_device *dev,
- disc_resp, DISCOVER_RESP_SIZE);
- if (res)
- goto out;
-- else if (disc_resp->result != SMP_RESP_FUNC_ACC) {
-+ if (disc_resp->result != SMP_RESP_FUNC_ACC)
- res = disc_resp->result;
-- goto out;
-- }
- out:
- kfree(disc_req);
- return res;
-@@ -1702,7 +1700,7 @@ static int sas_get_phy_change_count(struct domain_device *dev,
- int phy_id, int *pcc)
- {
- int res;
-- struct smp_resp *disc_resp;
-+ struct smp_disc_resp *disc_resp;
-
- disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
- if (!disc_resp)
-@@ -1720,19 +1718,17 @@ static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id,
- u8 *sas_addr, enum sas_device_type *type)
- {
- int res;
-- struct smp_resp *disc_resp;
-- struct discover_resp *dr;
-+ struct smp_disc_resp *disc_resp;
-
- disc_resp = alloc_smp_resp(DISCOVER_RESP_SIZE);
- if (!disc_resp)
- return -ENOMEM;
-- dr = &disc_resp->disc;
-
- res = sas_get_phy_discover(dev, phy_id, disc_resp);
- if (res == 0) {
- memcpy(sas_addr, disc_resp->disc.attached_sas_addr,
- SAS_ADDR_SIZE);
-- *type = to_dev_type(dr);
-+ *type = to_dev_type(&disc_resp->disc);
- if (*type == 0)
- memset(sas_addr, 0, SAS_ADDR_SIZE);
- }
-diff --git a/include/scsi/sas.h b/include/scsi/sas.h
-index a5d8ae49198cb..d9a09ca957594 100644
---- a/include/scsi/sas.h
-+++ b/include/scsi/sas.h
-@@ -460,18 +460,6 @@ struct report_phy_sata_resp {
- __be32 crc;
- } __attribute__ ((packed));
-
--struct smp_resp {
-- u8 frame_type;
-- u8 function;
-- u8 result;
-- u8 reserved;
-- union {
-- struct report_general_resp rg;
-- struct discover_resp disc;
-- struct report_phy_sata_resp rps;
-- };
--} __attribute__ ((packed));
--
- #elif defined(__BIG_ENDIAN_BITFIELD)
- struct sas_identify_frame {
- /* Byte 0 */
-@@ -691,6 +679,18 @@ struct report_phy_sata_resp {
- __be32 crc;
- } __attribute__ ((packed));
-
-+#else
-+#error "Bitfield order not defined!"
-+#endif
-+
-+struct smp_disc_resp {
-+ u8 frame_type;
-+ u8 function;
-+ u8 result;
-+ u8 reserved;
-+ struct discover_resp disc;
-+} __attribute__ ((packed));
-+
- struct smp_resp {
- u8 frame_type;
- u8 function;
-@@ -703,8 +703,4 @@ struct smp_resp {
- };
- } __attribute__ ((packed));
-
--#else
--#error "Bitfield order not defined!"
--#endif
--
- #endif /* _SAS_H_ */
---
-2.43.0
-
x86-cpu-enable-stibp-on-amd-if-automatic-ibrs-is-enabled.patch
scsi-lpfc-correct-size-for-wqe-for-memset.patch
usb-core-fix-deadlock-in-usb_deauthorize_interface.patch
-scsi-libsas-introduce-struct-smp_disc_resp.patch
-scsi-libsas-add-a-helper-sas_get_sas_addr_and_dev_ty.patch
-scsi-libsas-fix-disk-not-being-scanned-in-after-bein.patch
nfc-nci-fix-uninit-value-in-nci_dev_up-and-nci_ntf_p.patch
ixgbe-avoid-sleeping-allocation-in-ixgbe_ipsec_vf_ad.patch
tcp-properly-terminate-timers-for-kernel-sockets.patch