Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlaf Hering <ohering@suse.de>2019-10-23 08:48:52 +0200
committerOlaf Hering <ohering@suse.de>2019-10-23 08:48:52 +0200
commitdbd0817821b93e4a3eb1d67e726cc71aab7fc81e (patch)
treebe001f92633c0472a265fa8200f113e16d868d2e
parent20d06bbf8c4d73d5a1e6d54d6085c4e7c4491d7e (diff)
parent43485a9549d322d988c85419f52f6d1f53eff4fe (diff)
Merge remote-tracking branch 'kerncvs/SLE15' into SLE15-AZURESLE15-AZURE
-rw-r--r--patches.suse/NFSv4-Check-the-return-value-of-update_open_stateid.patch16
-rw-r--r--patches.suse/dasd_fba-Display-00000000-for-zero-page-when-dumping.patch2
-rw-r--r--patches.suse/rtlwifi-Fix-potential-overflow-on-P2P-code.patch38
-rw-r--r--patches.suse/scsi-lpfc-Remove-bg-debugfs-buffers.patch439
-rw-r--r--patches.suse/scsi-qedf-Modify-abort-and-tmf-handler-to-handle-edg.patch703
-rw-r--r--patches.suse/scsi-qedf-decrease-the-ll2-mtu-size-to-25006
-rw-r--r--patches.suse/scsi-qedf-fc_rport_priv-reference-counting-fixes.patch175
-rw-r--r--patches.suse/scsi-qedf-print-message-during-bailout-conditions66
-rw-r--r--patches.suse/scsi_transport_fc-return-EBUSY-for-deleted-vport.patch14
-rw-r--r--patches.suse/tuntap-correctly-set-SOCKWQ_ASYNC_NOSPACE.patch64
-rw-r--r--patches.suse/vhost_net-conditionally-enable-tx-polling.patch44
-rwxr-xr-xrpm/arch-symbols2
-rwxr-xr-xrpm/check-module-license2
-rw-r--r--rpm/config.sh2
-rw-r--r--rpm/dtb.spec.in.in4
-rw-r--r--rpm/gitlog-excludes1
-rw-r--r--rpm/kernel-binary.spec.in100
-rw-r--r--rpm/kernel-module-subpackage2
-rw-r--r--rpm/kernel-obs-build.spec.in2
-rw-r--r--rpm/kernel-subpackage-build4
-rwxr-xr-xrpm/klp-symbols18
-rw-r--r--rpm/macros.kernel-source5
-rwxr-xr-xrpm/mergedep2
-rwxr-xr-xrpm/mkspec21
-rwxr-xr-xrpm/mkspec-dtb12
-rwxr-xr-xrpm/modflist2
-rw-r--r--rpm/preun.sh2
-rwxr-xr-xrpm/split-modules6
-rwxr-xr-xscripts/git_sort/git_sort.py2
-rwxr-xr-xscripts/install-git-hooks4
-rw-r--r--series.conf8
31 files changed, 1656 insertions, 112 deletions
diff --git a/patches.suse/NFSv4-Check-the-return-value-of-update_open_stateid.patch b/patches.suse/NFSv4-Check-the-return-value-of-update_open_stateid.patch
index 1c26a33187..c3c551c60a 100644
--- a/patches.suse/NFSv4-Check-the-return-value-of-update_open_stateid.patch
+++ b/patches.suse/NFSv4-Check-the-return-value-of-update_open_stateid.patch
@@ -3,24 +3,27 @@ Date: Mon, 29 Jul 2019 18:25:00 +0100
Subject: [PATCH] NFSv4: Check the return value of update_open_stateid()
Git-commit: e3c8dc761ead061da2220ee8f8132f729ac3ddfe
Patch-mainline: v5.3
-References: git-fixes
+References: git-fixes boo#1154189 bsc#1154747
Ensure that we always check the return value of update_open_stateid()
so that we can retry if the update of local state failed. This fixes
infinite looping on state recovery.
+(Bug references are for a previous version of this patch which introduced
+ a regression)
+
Fixes: e23008ec81ef3 ("NFSv4 reduce attribute requests for open reclaim")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v3.7+
Acked-by: NeilBrown <neilb@suse.com>
---
- fs/nfs/nfs4proc.c | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
+ fs/nfs/nfs4proc.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
-@@ -1814,8 +1814,9 @@ _nfs4_opendata_reclaim_to_nfs4_state(str
+@@ -1813,8 +1813,9 @@ _nfs4_opendata_reclaim_to_nfs4_state(str
if (data->o_res.delegation_type != 0)
nfs4_opendata_check_deleg(data, state);
update:
@@ -32,18 +35,17 @@ Acked-by: NeilBrown <neilb@suse.com>
atomic_inc(&state->count);
return state;
-@@ -1847,9 +1848,11 @@ _nfs4_opendata_to_nfs4_state(struct nfs4
+@@ -1846,8 +1847,11 @@ _nfs4_opendata_to_nfs4_state(struct nfs4
goto err_put_inode;
if (data->o_res.delegation_type != 0)
nfs4_opendata_check_deleg(data, state);
- update_open_stateid(state, &data->o_res.stateid, NULL,
- data->o_arg.fmode);
-- iput(inode);
+ if (!update_open_stateid(state, &data->o_res.stateid,
+ NULL, data->o_arg.fmode)) {
+ nfs4_put_open_state(state);
+ state = ERR_PTR(-EAGAIN);
+ }
+ iput(inode);
out:
nfs_release_seqid(data->o_arg.seqid);
- return state;
diff --git a/patches.suse/dasd_fba-Display-00000000-for-zero-page-when-dumping.patch b/patches.suse/dasd_fba-Display-00000000-for-zero-page-when-dumping.patch
index 8b5f4aa828..4b30572438 100644
--- a/patches.suse/dasd_fba-Display-00000000-for-zero-page-when-dumping.patch
+++ b/patches.suse/dasd_fba-Display-00000000-for-zero-page-when-dumping.patch
@@ -3,7 +3,7 @@ From: Hannes Reinecke <hare@suse.de>
Date: Wed, 20 Feb 2019 08:19:13 +0100
Subject: [PATCH] dasd_fba: Display '00000000' for zero page when dumping sense
-References: bsc#11123080
+References: bsc#1123080
Patch-mainline: no, test patch for now
When a discard I/O fails, dasd_fba_dump_sense() will crash as it
diff --git a/patches.suse/rtlwifi-Fix-potential-overflow-on-P2P-code.patch b/patches.suse/rtlwifi-Fix-potential-overflow-on-P2P-code.patch
new file mode 100644
index 0000000000..33cee0caf3
--- /dev/null
+++ b/patches.suse/rtlwifi-Fix-potential-overflow-on-P2P-code.patch
@@ -0,0 +1,38 @@
+From: Laura Abbott <labbott@redhat.com>
+Date: Fri, 18 Oct 2019 07:43:21 -0400
+Subject: [PATCH] rtlwifi: Fix potential overflow on P2P code
+Patch-mainline: Submitted, https://lkml.org/lkml/2019/10/18/557
+References: bsc#1154372 CVE-2019-17666
+
+Nicolas Waisman noticed that even though noa_len is checked for
+a compatible length it's still possible to overrun the buffers
+of p2pinfo since there's no check on the upper bound of noa_num.
+Bound noa_num against P2P_MAX_NOA_NUM.
+
+Reported-by: Nicolas Waisman <nico@semmle.com>
+Signed-off-by: Laura Abbott <labbott@redhat.com>
+Acked-by: Cho, Yu-Chen <acho@suse.com>
+---
+ drivers/net/wireless/realtek/rtlwifi/ps.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/net/wireless/realtek/rtlwifi/ps.c
++++ b/drivers/net/wireless/realtek/rtlwifi/ps.c
+@@ -772,6 +772,8 @@ static void rtl_p2p_noa_ie(struct ieee80
+ return;
+ } else {
+ noa_num = (noa_len - 2) / 13;
++ if (noa_num > P2P_MAX_NOA_NUM)
++ noa_num = P2P_MAX_NOA_NUM;
+ }
+ noa_index = ie[3];
+ if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==
+@@ -866,6 +868,8 @@ static void rtl_p2p_action_ie(struct iee
+ return;
+ } else {
+ noa_num = (noa_len - 2) / 13;
++ if (noa_num > P2P_MAX_NOA_NUM)
++ noa_num = P2P_MAX_NOA_NUM;
+ }
+ noa_index = ie[3];
+ if (rtlpriv->psc.p2p_ps_info.p2p_ps_mode ==
diff --git a/patches.suse/scsi-lpfc-Remove-bg-debugfs-buffers.patch b/patches.suse/scsi-lpfc-Remove-bg-debugfs-buffers.patch
new file mode 100644
index 0000000000..df3c266583
--- /dev/null
+++ b/patches.suse/scsi-lpfc-Remove-bg-debugfs-buffers.patch
@@ -0,0 +1,439 @@
+From: James Smart <jsmart2021@gmail.com>
+Date: Tue, 27 Aug 2019 14:28:05 -0700
+Subject: scsi: lpfc: Remove bg debugfs buffers
+Patch-mainline: v5.4-rc1
+Git-commit: 9db6c14c36fc8f7824ade95f53bcdad43df678b4
+References: bsc#1144375
+
+Capturing and downloading dif command data and dif data was done a dozen
+years ago and no longer being used. Also creates a potential security hole.
+
+Remove the debugfs buffer for dif debugging.
+
+Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
+Signed-off-by: James Smart <jsmart2021@gmail.com>
+CC: KyleMahlkuch <kmahlkuc@linux.vnet.ibm.com>
+CC: Hannes Reinecke <hare@suse.de>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Acked-by: Daniel Wagner <dwagner@suse.de>
+---
+ drivers/scsi/lpfc/lpfc.h | 2
+ drivers/scsi/lpfc/lpfc_crtn.h | 9 --
+ drivers/scsi/lpfc/lpfc_debugfs.c | 144 ---------------------------------------
+ drivers/scsi/lpfc/lpfc_init.c | 70 ------------------
+ drivers/scsi/lpfc/lpfc_scsi.c | 79 ---------------------
+ 5 files changed, 304 deletions(-)
+
+--- a/drivers/scsi/lpfc/lpfc.h
++++ b/drivers/scsi/lpfc/lpfc.h
+@@ -1036,8 +1036,6 @@ struct lpfc_hba {
+ struct dentry *debug_hbqinfo;
+ struct dentry *debug_dumpHostSlim;
+ struct dentry *debug_dumpHBASlim;
+- struct dentry *debug_dumpData; /* BlockGuard BPL */
+- struct dentry *debug_dumpDif; /* BlockGuard BPL */
+ struct dentry *debug_InjErrLBA; /* LBA to inject errors at */
+ struct dentry *debug_InjErrNPortID; /* NPortID to inject errors at */
+ struct dentry *debug_InjErrWWPN; /* WWPN to inject errors at */
+--- a/drivers/scsi/lpfc/lpfc_crtn.h
++++ b/drivers/scsi/lpfc/lpfc_crtn.h
+@@ -435,15 +435,6 @@ int lpfc_sli4_get_allocated_extnts(struc
+ int lpfc_sli4_get_avail_extnt_rsrc(struct lpfc_hba *, uint16_t,
+ uint16_t *, uint16_t *);
+
+-/* externs BlockGuard */
+-extern char *_dump_buf_data;
+-extern unsigned long _dump_buf_data_order;
+-extern char *_dump_buf_dif;
+-extern unsigned long _dump_buf_dif_order;
+-extern spinlock_t _dump_buf_lock;
+-extern int _dump_buf_done;
+-extern spinlock_t pgcnt_lock;
+-extern unsigned int pgcnt;
+ extern unsigned int lpfc_fcp_look_ahead;
+
+ /* Interface exported by fabric iocb scheduler */
+--- a/drivers/scsi/lpfc/lpfc_debugfs.c
++++ b/drivers/scsi/lpfc/lpfc_debugfs.c
+@@ -1705,89 +1705,6 @@ out:
+ return rc;
+ }
+
+-static int
+-lpfc_debugfs_dumpData_open(struct inode *inode, struct file *file)
+-{
+- struct lpfc_debug *debug;
+- int rc = -ENOMEM;
+-
+- if (!_dump_buf_data)
+- return -EBUSY;
+-
+- debug = kmalloc(sizeof(*debug), GFP_KERNEL);
+- if (!debug)
+- goto out;
+-
+- /* Round to page boundary */
+- pr_err("9059 BLKGRD: %s: _dump_buf_data=0x%p\n",
+- __func__, _dump_buf_data);
+- debug->buffer = _dump_buf_data;
+- if (!debug->buffer) {
+- kfree(debug);
+- goto out;
+- }
+-
+- debug->len = (1 << _dump_buf_data_order) << PAGE_SHIFT;
+- file->private_data = debug;
+-
+- rc = 0;
+-out:
+- return rc;
+-}
+-
+-static int
+-lpfc_debugfs_dumpDif_open(struct inode *inode, struct file *file)
+-{
+- struct lpfc_debug *debug;
+- int rc = -ENOMEM;
+-
+- if (!_dump_buf_dif)
+- return -EBUSY;
+-
+- debug = kmalloc(sizeof(*debug), GFP_KERNEL);
+- if (!debug)
+- goto out;
+-
+- /* Round to page boundary */
+- pr_err("9060 BLKGRD: %s: _dump_buf_dif=0x%p file=%pD\n",
+- __func__, _dump_buf_dif, file);
+- debug->buffer = _dump_buf_dif;
+- if (!debug->buffer) {
+- kfree(debug);
+- goto out;
+- }
+-
+- debug->len = (1 << _dump_buf_dif_order) << PAGE_SHIFT;
+- file->private_data = debug;
+-
+- rc = 0;
+-out:
+- return rc;
+-}
+-
+-static ssize_t
+-lpfc_debugfs_dumpDataDif_write(struct file *file, const char __user *buf,
+- size_t nbytes, loff_t *ppos)
+-{
+- /*
+- * The Data/DIF buffers only save one failing IO
+- * The write op is used as a reset mechanism after an IO has
+- * already been saved to the next one can be saved
+- */
+- spin_lock(&_dump_buf_lock);
+-
+- memset((void *)_dump_buf_data, 0,
+- ((1 << PAGE_SHIFT) << _dump_buf_data_order));
+- memset((void *)_dump_buf_dif, 0,
+- ((1 << PAGE_SHIFT) << _dump_buf_dif_order));
+-
+- _dump_buf_done = 0;
+-
+- spin_unlock(&_dump_buf_lock);
+-
+- return nbytes;
+-}
+-
+ static ssize_t
+ lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
+ size_t nbytes, loff_t *ppos)
+@@ -1999,17 +1916,6 @@ lpfc_debugfs_release(struct inode *inode
+ return 0;
+ }
+
+-static int
+-lpfc_debugfs_dumpDataDif_release(struct inode *inode, struct file *file)
+-{
+- struct lpfc_debug *debug = file->private_data;
+-
+- debug->buffer = NULL;
+- kfree(debug);
+-
+- return 0;
+-}
+-
+
+ static int
+ lpfc_debugfs_nvmestat_open(struct inode *inode, struct file *file)
+@@ -4937,26 +4843,6 @@ static const struct file_operations lpfc
+ .release = lpfc_debugfs_release,
+ };
+
+-#undef lpfc_debugfs_op_dumpData
+-static const struct file_operations lpfc_debugfs_op_dumpData = {
+- .owner = THIS_MODULE,
+- .open = lpfc_debugfs_dumpData_open,
+- .llseek = lpfc_debugfs_lseek,
+- .read = lpfc_debugfs_read,
+- .write = lpfc_debugfs_dumpDataDif_write,
+- .release = lpfc_debugfs_dumpDataDif_release,
+-};
+-
+-#undef lpfc_debugfs_op_dumpDif
+-static const struct file_operations lpfc_debugfs_op_dumpDif = {
+- .owner = THIS_MODULE,
+- .open = lpfc_debugfs_dumpDif_open,
+- .llseek = lpfc_debugfs_lseek,
+- .read = lpfc_debugfs_read,
+- .write = lpfc_debugfs_dumpDataDif_write,
+- .release = lpfc_debugfs_dumpDataDif_release,
+-};
+-
+ #undef lpfc_debugfs_op_dif_err
+ static const struct file_operations lpfc_debugfs_op_dif_err = {
+ .owner = THIS_MODULE,
+@@ -5353,30 +5239,6 @@ lpfc_debugfs_initialize(struct lpfc_vpor
+ } else
+ phba->debug_dumpHostSlim = NULL;
+
+- /* Setup dumpData */
+- snprintf(name, sizeof(name), "dumpData");
+- phba->debug_dumpData =
+- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+- phba->hba_debugfs_root,
+- phba, &lpfc_debugfs_op_dumpData);
+- if (!phba->debug_dumpData) {
+- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+- "0800 Cannot create debugfs dumpData\n");
+- goto debug_failed;
+- }
+-
+- /* Setup dumpDif */
+- snprintf(name, sizeof(name), "dumpDif");
+- phba->debug_dumpDif =
+- debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+- phba->hba_debugfs_root,
+- phba, &lpfc_debugfs_op_dumpDif);
+- if (!phba->debug_dumpDif) {
+- lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+- "0801 Cannot create debugfs dumpDif\n");
+- goto debug_failed;
+- }
+-
+ /* Setup DIF Error Injections */
+ snprintf(name, sizeof(name), "InjErrLBA");
+ phba->debug_InjErrLBA =
+@@ -5869,12 +5731,6 @@ lpfc_debugfs_terminate(struct lpfc_vport
+ debugfs_remove(phba->debug_dumpHostSlim); /* HostSlim */
+ phba->debug_dumpHostSlim = NULL;
+
+- debugfs_remove(phba->debug_dumpData); /* dumpData */
+- phba->debug_dumpData = NULL;
+-
+- debugfs_remove(phba->debug_dumpDif); /* dumpDif */
+- phba->debug_dumpDif = NULL;
+-
+ debugfs_remove(phba->debug_InjErrLBA); /* InjErrLBA */
+ phba->debug_InjErrLBA = NULL;
+
+--- a/drivers/scsi/lpfc/lpfc_init.c
++++ b/drivers/scsi/lpfc/lpfc_init.c
+@@ -64,12 +64,6 @@
+ #include "lpfc_version.h"
+ #include "lpfc_ids.h"
+
+-char *_dump_buf_data;
+-unsigned long _dump_buf_data_order;
+-char *_dump_buf_dif;
+-unsigned long _dump_buf_dif_order;
+-spinlock_t _dump_buf_lock;
+-
+ /* Used when mapping IRQ vectors in a driver centric manner */
+ uint16_t *lpfc_used_cpu;
+ uint32_t lpfc_present_cpu;
+@@ -7215,7 +7209,6 @@ lpfc_setup_bg(struct lpfc_hba *phba, str
+ uint32_t old_mask;
+ uint32_t old_guard;
+
+- int pagecnt = 10;
+ if (phba->cfg_prot_mask && phba->cfg_prot_guard) {
+ lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
+ "1478 Registering BlockGuard with the "
+@@ -7252,56 +7245,6 @@ lpfc_setup_bg(struct lpfc_hba *phba, str
+ "layer, Bad protection parameters: %d %d\n",
+ old_mask, old_guard);
+ }
+-
+- if (!_dump_buf_data) {
+- while (pagecnt) {
+- spin_lock_init(&_dump_buf_lock);
+- _dump_buf_data =
+- (char *) __get_free_pages(GFP_KERNEL, pagecnt);
+- if (_dump_buf_data) {
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9043 BLKGRD: allocated %d pages for "
+- "_dump_buf_data at 0x%p\n",
+- (1 << pagecnt), _dump_buf_data);
+- _dump_buf_data_order = pagecnt;
+- memset(_dump_buf_data, 0,
+- ((1 << PAGE_SHIFT) << pagecnt));
+- break;
+- } else
+- --pagecnt;
+- }
+- if (!_dump_buf_data_order)
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9044 BLKGRD: ERROR unable to allocate "
+- "memory for hexdump\n");
+- } else
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9045 BLKGRD: already allocated _dump_buf_data=0x%p"
+- "\n", _dump_buf_data);
+- if (!_dump_buf_dif) {
+- while (pagecnt) {
+- _dump_buf_dif =
+- (char *) __get_free_pages(GFP_KERNEL, pagecnt);
+- if (_dump_buf_dif) {
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9046 BLKGRD: allocated %d pages for "
+- "_dump_buf_dif at 0x%p\n",
+- (1 << pagecnt), _dump_buf_dif);
+- _dump_buf_dif_order = pagecnt;
+- memset(_dump_buf_dif, 0,
+- ((1 << PAGE_SHIFT) << pagecnt));
+- break;
+- } else
+- --pagecnt;
+- }
+- if (!_dump_buf_dif_order)
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9047 BLKGRD: ERROR unable to allocate "
+- "memory for hexdump\n");
+- } else
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9048 BLKGRD: already allocated _dump_buf_dif=0x%p\n",
+- _dump_buf_dif);
+ }
+
+ /**
+@@ -12937,19 +12880,6 @@ lpfc_exit(void)
+ pci_unregister_driver(&lpfc_driver);
+ fc_release_transport(lpfc_transport_template);
+ fc_release_transport(lpfc_vport_transport_template);
+- if (_dump_buf_data) {
+- printk(KERN_ERR "9062 BLKGRD: freeing %lu pages for "
+- "_dump_buf_data at 0x%p\n",
+- (1L << _dump_buf_data_order), _dump_buf_data);
+- free_pages((unsigned long)_dump_buf_data, _dump_buf_data_order);
+- }
+-
+- if (_dump_buf_dif) {
+- printk(KERN_ERR "9049 BLKGRD: freeing %lu pages for "
+- "_dump_buf_dif at 0x%p\n",
+- (1L << _dump_buf_dif_order), _dump_buf_dif);
+- free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order);
+- }
+ kfree(lpfc_used_cpu);
+ idr_destroy(&lpfc_hba_index);
+ }
+--- a/drivers/scsi/lpfc/lpfc_scsi.c
++++ b/drivers/scsi/lpfc/lpfc_scsi.c
+@@ -53,8 +53,6 @@
+ #define LPFC_RESET_WAIT 2
+ #define LPFC_ABORT_WAIT 2
+
+-int _dump_buf_done = 1;
+-
+ static char *dif_op_str[] = {
+ "PROT_NORMAL",
+ "PROT_READ_INSERT",
+@@ -89,63 +87,6 @@ lpfc_release_scsi_buf_s3(struct lpfc_hba
+ static int
+ lpfc_prot_group_type(struct lpfc_hba *phba, struct scsi_cmnd *sc);
+
+-static void
+-lpfc_debug_save_data(struct lpfc_hba *phba, struct scsi_cmnd *cmnd)
+-{
+- void *src, *dst;
+- struct scatterlist *sgde = scsi_sglist(cmnd);
+-
+- if (!_dump_buf_data) {
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9050 BLKGRD: ERROR %s _dump_buf_data is NULL\n",
+- __func__);
+- return;
+- }
+-
+-
+- if (!sgde) {
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9051 BLKGRD: ERROR: data scatterlist is null\n");
+- return;
+- }
+-
+- dst = (void *) _dump_buf_data;
+- while (sgde) {
+- src = sg_virt(sgde);
+- memcpy(dst, src, sgde->length);
+- dst += sgde->length;
+- sgde = sg_next(sgde);
+- }
+-}
+-
+-static void
+-lpfc_debug_save_dif(struct lpfc_hba *phba, struct scsi_cmnd *cmnd)
+-{
+- void *src, *dst;
+- struct scatterlist *sgde = scsi_prot_sglist(cmnd);
+-
+- if (!_dump_buf_dif) {
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9052 BLKGRD: ERROR %s _dump_buf_data is NULL\n",
+- __func__);
+- return;
+- }
+-
+- if (!sgde) {
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG,
+- "9053 BLKGRD: ERROR: prot scatterlist is null\n");
+- return;
+- }
+-
+- dst = _dump_buf_dif;
+- while (sgde) {
+- src = sg_virt(sgde);
+- memcpy(dst, src, sgde->length);
+- dst += sgde->length;
+- sgde = sg_next(sgde);
+- }
+-}
+-
+ static inline unsigned
+ lpfc_cmd_blksize(struct scsi_cmnd *sc)
+ {
+@@ -3099,26 +3040,6 @@ lpfc_parse_bg_err(struct lpfc_hba *phba,
+ uint32_t bgstat = bgf->bgstat;
+ uint64_t failing_sector = 0;
+
+- spin_lock(&_dump_buf_lock);
+- if (!_dump_buf_done) {
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9070 BLKGRD: Saving"
+- " Data for %u blocks to debugfs\n",
+- (cmd->cmnd[7] << 8 | cmd->cmnd[8]));
+- lpfc_debug_save_data(phba, cmd);
+-
+- /* If we have a prot sgl, save the DIF buffer */
+- if (lpfc_prot_group_type(phba, cmd) ==
+- LPFC_PG_TYPE_DIF_BUF) {
+- lpfc_printf_log(phba, KERN_ERR, LOG_BG, "9071 BLKGRD: "
+- "Saving DIF for %u blocks to debugfs\n",
+- (cmd->cmnd[7] << 8 | cmd->cmnd[8]));
+- lpfc_debug_save_dif(phba, cmd);
+- }
+-
+- _dump_buf_done = 1;
+- }
+- spin_unlock(&_dump_buf_lock);
+-
+ if (lpfc_bgs_get_invalid_prof(bgstat)) {
+ cmd->result = ScsiResult(DID_ERROR, 0);
+ lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG,
diff --git a/patches.suse/scsi-qedf-Modify-abort-and-tmf-handler-to-handle-edg.patch b/patches.suse/scsi-qedf-Modify-abort-and-tmf-handler-to-handle-edg.patch
new file mode 100644
index 0000000000..9f064d9917
--- /dev/null
+++ b/patches.suse/scsi-qedf-Modify-abort-and-tmf-handler-to-handle-edg.patch
@@ -0,0 +1,703 @@
+From: Saurav Kashyap <skashyap@marvell.com>
+Date: Tue, 26 Mar 2019 00:38:38 -0700
+Subject: scsi: qedf: Modify abort and tmf handler to handle edge condition and
+ flush
+Patch-mainline: v5.2-rc1
+Git-commit: 69ef2c692510d5154c613569caeeed3c74806231
+References: bsc#1098291
+
+An I/O can be in any state when flush is called, it can be in abort,
+waiting for abort, RRQ send and waiting or TMF send.
+
+ - HZ can be different on different architecture, correctly set abort
+ timeout value.
+
+ - Flush can complete the I/Os prematurely, handle refcount for aborted
+ I/Os and for which RRQ is pending.
+
+ - Differentiate LUN/TARGET reset, as cleanup needs to be send to firmware
+ accordingly.
+
+ - Add flush mutex to sync cleanup call from abort and flush routine.
+
+ - Clear abort/outstanding bit on timeout.
+
+Signed-off-by: Shyam Sundar <shyam.sundar@marvell.com>
+Signed-off-by: Chad Dupuis <cdupuis@marvell.com>
+Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Acked-by: Daniel Wagner <dwagner@suse.de>
+---
+ drivers/scsi/qedf/qedf.h | 10 +-
+ drivers/scsi/qedf/qedf_els.c | 31 ++++++-
+ drivers/scsi/qedf/qedf_io.c | 178 +++++++++++++++++++++++++++++++++++-------
+ drivers/scsi/qedf/qedf_main.c | 124 +++++++++++++++++++++--------
+ 4 files changed, 276 insertions(+), 67 deletions(-)
+
+--- a/drivers/scsi/qedf/qedf.h
++++ b/drivers/scsi/qedf/qedf.h
+@@ -52,8 +52,8 @@
+ sizeof(struct fc_frame_header))
+ #define QEDF_MAX_NPIV 64
+ #define QEDF_TM_TIMEOUT 10
+-#define QEDF_ABORT_TIMEOUT 10
+-#define QEDF_CLEANUP_TIMEOUT 10
++#define QEDF_ABORT_TIMEOUT (10 * 1000)
++#define QEDF_CLEANUP_TIMEOUT 1
+ #define QEDF_MAX_CDB_LEN 16
+
+ #define UPSTREAM_REMOVE 1
+@@ -85,6 +85,7 @@ struct qedf_els_cb_arg {
+ };
+
+ enum qedf_ioreq_event {
++ QEDF_IOREQ_EV_NONE,
+ QEDF_IOREQ_EV_ABORT_SUCCESS,
+ QEDF_IOREQ_EV_ABORT_FAILED,
+ QEDF_IOREQ_EV_SEND_RRQ,
+@@ -181,7 +182,10 @@ struct qedf_rport {
+ #define QEDF_RPORT_SESSION_READY 1
+ #define QEDF_RPORT_UPLOADING_CONNECTION 2
+ #define QEDF_RPORT_IN_RESET 3
++#define QEDF_RPORT_IN_LUN_RESET 4
++#define QEDF_RPORT_IN_TARGET_RESET 5
+ unsigned long flags;
++ int lun_reset_lun;
+ unsigned long retry_delay_timestamp;
+ struct fc_rport *rport;
+ struct fc_rport_priv *rdata;
+@@ -396,6 +400,8 @@ struct qedf_ctx {
+ u8 target_resets;
+ u8 task_set_fulls;
+ u8 busy;
++ /* Used for flush routine */
++ struct mutex flush_mutex;
+ };
+
+ struct io_bdt {
+--- a/drivers/scsi/qedf/qedf_els.c
++++ b/drivers/scsi/qedf/qedf_els.c
+@@ -205,8 +205,12 @@ static void qedf_rrq_compl(struct qedf_e
+ " orig xid = 0x%x, rrq_xid = 0x%x, refcount=%d\n",
+ orig_io_req, orig_io_req->xid, rrq_req->xid, refcount);
+
+- /* This should return the aborted io_req to the command pool */
+- if (orig_io_req)
++ /*
++ * This should return the aborted io_req to the command pool. Note that
++ * we need to check the refcound in case the original request was
++ * flushed but we get a completion on this xid.
++ */
++ if (orig_io_req && refcount > 0)
+ kref_put(&orig_io_req->refcount, qedf_release_cmd);
+
+ out_free:
+@@ -233,6 +237,7 @@ int qedf_send_rrq(struct qedf_ioreq *abo
+ uint32_t sid;
+ uint32_t r_a_tov;
+ int rc;
++ int refcount;
+
+ if (!aborted_io_req) {
+ QEDF_ERR(NULL, "abort_io_req is NULL.\n");
+@@ -241,6 +246,15 @@ int qedf_send_rrq(struct qedf_ioreq *abo
+
+ fcport = aborted_io_req->fcport;
+
++ if (!fcport) {
++ refcount = kref_read(&aborted_io_req->refcount);
++ QEDF_ERR(NULL,
++ "RRQ work was queued prior to a flush xid=0x%x, refcount=%d.\n",
++ aborted_io_req->xid, refcount);
++ kref_put(&aborted_io_req->refcount, qedf_release_cmd);
++ return -EINVAL;
++ }
++
+ /* Check that fcport is still offloaded */
+ if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) {
+ QEDF_ERR(NULL, "fcport is no longer offloaded.\n");
+@@ -253,6 +267,19 @@ int qedf_send_rrq(struct qedf_ioreq *abo
+ }
+
+ qedf = fcport->qedf;
++
++ /*
++ * Sanity check that we can send a RRQ to make sure that refcount isn't
++ * 0
++ */
++ refcount = kref_read(&aborted_io_req->refcount);
++ if (refcount != 1) {
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS,
++ "refcount for xid=%x io_req=%p refcount=%d is not 1.\n",
++ aborted_io_req->xid, aborted_io_req, refcount);
++ return -EINVAL;
++ }
++
+ lport = qedf->lport;
+ sid = fcport->sid;
+ r_a_tov = lport->r_a_tov;
+--- a/drivers/scsi/qedf/qedf_io.c
++++ b/drivers/scsi/qedf/qedf_io.c
+@@ -43,8 +43,9 @@ static void qedf_cmd_timeout(struct work
+ switch (io_req->cmd_type) {
+ case QEDF_ABTS:
+ if (qedf == NULL) {
+- QEDF_INFO(NULL, QEDF_LOG_IO, "qedf is NULL for xid=0x%x.\n",
+- io_req->xid);
++ QEDF_INFO(NULL, QEDF_LOG_IO,
++ "qedf is NULL for ABTS xid=0x%x.\n",
++ io_req->xid);
+ return;
+ }
+
+@@ -61,6 +62,9 @@ static void qedf_cmd_timeout(struct work
+ */
+ kref_put(&io_req->refcount, qedf_release_cmd);
+
++ /* Clear in abort bit now that we're done with the command */
++ clear_bit(QEDF_CMD_IN_ABORT, &io_req->flags);
++
+ /*
+ * Now that the original I/O and the ABTS are complete see
+ * if we need to reconnect to the target.
+@@ -68,6 +72,15 @@ static void qedf_cmd_timeout(struct work
+ qedf_restart_rport(fcport);
+ break;
+ case QEDF_ELS:
++ if (!qedf) {
++ QEDF_INFO(NULL, QEDF_LOG_IO,
++ "qedf is NULL for ELS xid=0x%x.\n",
++ io_req->xid);
++ return;
++ }
++ /* ELS request no longer outstanding since it timed out */
++ clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags);
++
+ kref_get(&io_req->refcount);
+ /*
+ * Don't attempt to clean an ELS timeout as any subseqeunt
+@@ -1142,6 +1155,19 @@ void qedf_scsi_completion(struct qedf_ct
+
+ fcport = io_req->fcport;
+
++ /*
++ * When flush is active, let the cmds be completed from the cleanup
++ * context
++ */
++ if (test_bit(QEDF_RPORT_IN_TARGET_RESET, &fcport->flags) ||
++ (test_bit(QEDF_RPORT_IN_LUN_RESET, &fcport->flags) &&
++ sc_cmd->device->lun == (u64)fcport->lun_reset_lun)) {
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
++ "Dropping good completion xid=0x%x as fcport is flushing",
++ io_req->xid);
++ return;
++ }
++
+ qedf_parse_fcp_rsp(io_req, fcp_rsp);
+
+ qedf_unmap_sg_list(qedf, io_req);
+@@ -1552,15 +1578,23 @@ int qedf_initiate_abts(struct qedf_ioreq
+ unsigned long flags;
+ struct fcoe_wqe *sqe;
+ u16 sqe_idx;
++ int refcount = 0;
+
+ /* Sanity check qedf_rport before dereferencing any pointers */
+ if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) {
+ QEDF_ERR(NULL, "tgt not offloaded\n");
+ rc = 1;
+- goto abts_err;
++ goto out;
+ }
+
+ rdata = fcport->rdata;
++
++ if (!rdata || !kref_get_unless_zero(&rdata->kref)) {
++ QEDF_ERR(&qedf->dbg_ctx, "stale rport\n");
++ rc = 1;
++ goto out;
++ }
++
+ r_a_tov = rdata->r_a_tov;
+ qedf = fcport->qedf;
+ lport = qedf->lport;
+@@ -1568,20 +1602,20 @@ int qedf_initiate_abts(struct qedf_ioreq
+ if (lport->state != LPORT_ST_READY || !(lport->link_up)) {
+ QEDF_ERR(&(qedf->dbg_ctx), "link is not ready\n");
+ rc = 1;
+- goto abts_err;
++ goto out;
+ }
+
+ if (atomic_read(&qedf->link_down_tmo_valid) > 0) {
+ QEDF_ERR(&(qedf->dbg_ctx), "link_down_tmo active.\n");
+ rc = 1;
+- goto abts_err;
++ goto out;
+ }
+
+ /* Ensure room on SQ */
+ if (!atomic_read(&fcport->free_sqes)) {
+ QEDF_ERR(&(qedf->dbg_ctx), "No SQ entries available\n");
+ rc = 1;
+- goto abts_err;
++ goto out;
+ }
+
+ if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) {
+@@ -1606,18 +1640,17 @@ int qedf_initiate_abts(struct qedf_ioreq
+ qedf->control_requests++;
+ qedf->packet_aborts++;
+
+- /* Set the return CPU to be the same as the request one */
+- io_req->cpu = smp_processor_id();
+-
+ /* Set the command type to abort */
+ io_req->cmd_type = QEDF_ABTS;
+ io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts;
+
+ set_bit(QEDF_CMD_IN_ABORT, &io_req->flags);
+- QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "ABTS io_req xid = "
+- "0x%x\n", xid);
++ refcount = kref_read(&io_req->refcount);
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM,
++ "ABTS io_req xid = 0x%x refcount=%d\n",
++ xid, refcount);
+
+- qedf_cmd_timer_set(qedf, io_req, QEDF_ABORT_TIMEOUT * HZ);
++ qedf_cmd_timer_set(qedf, io_req, QEDF_ABORT_TIMEOUT);
+
+ spin_lock_irqsave(&fcport->rport_lock, flags);
+
+@@ -1631,13 +1664,6 @@ int qedf_initiate_abts(struct qedf_ioreq
+
+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
+
+- return rc;
+-abts_err:
+- /*
+- * If the ABTS task fails to queue then we need to cleanup the
+- * task at the firmware.
+- */
+- qedf_initiate_cleanup(io_req, return_scsi_cmd_on_abts);
+ out:
+ return rc;
+ }
+@@ -1647,25 +1673,59 @@ void qedf_process_abts_compl(struct qedf
+ {
+ uint32_t r_ctl;
+ uint16_t xid;
++ int rc;
++ struct qedf_rport *fcport = io_req->fcport;
+
+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "Entered with xid = "
+ "0x%x cmd_type = %d\n", io_req->xid, io_req->cmd_type);
+
+- cancel_delayed_work(&io_req->timeout_work);
+-
+ xid = io_req->xid;
+ r_ctl = cqe->cqe_info.abts_info.r_ctl;
+
++ /* This was added at a point when we were scheduling abts_compl &
++ * cleanup_compl on different CPUs and there was a possibility of
++ * the io_req to be freed from the other context before we got here.
++ */
++ if (!fcport) {
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
++ "Dropping ABTS completion xid=0x%x as fcport is NULL",
++ io_req->xid);
++ return;
++ }
++
++ /*
++ * When flush is active, let the cmds be completed from the cleanup
++ * context
++ */
++ if (test_bit(QEDF_RPORT_IN_TARGET_RESET, &fcport->flags) ||
++ test_bit(QEDF_RPORT_IN_LUN_RESET, &fcport->flags)) {
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
++ "Dropping ABTS completion xid=0x%x as fcport is flushing",
++ io_req->xid);
++ return;
++ }
++
++ if (!cancel_delayed_work(&io_req->timeout_work)) {
++ QEDF_ERR(&qedf->dbg_ctx,
++ "Wasn't able to cancel abts timeout work.\n");
++ }
++
+ switch (r_ctl) {
+ case FC_RCTL_BA_ACC:
+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM,
+ "ABTS response - ACC Send RRQ after R_A_TOV\n");
+ io_req->event = QEDF_IOREQ_EV_ABORT_SUCCESS;
++ rc = kref_get_unless_zero(&io_req->refcount);
++ if (!rc) {
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM,
++ "kref is already zero so ABTS was already completed or flushed xid=0x%x.\n",
++ io_req->xid);
++ return;
++ }
+ /*
+ * Dont release this cmd yet. It will be relesed
+ * after we get RRQ response
+ */
+- kref_get(&io_req->refcount);
+ queue_delayed_work(qedf->dpc_wq, &io_req->rrq_work,
+ msecs_to_jiffies(qedf->lport->r_a_tov));
+ break;
+@@ -1922,6 +1982,7 @@ static int qedf_execute_tmf(struct qedf_
+ int rc = 0;
+ uint16_t xid;
+ int tmo = 0;
++ int lun = 0;
+ unsigned long flags;
+ struct fcoe_wqe *sqe;
+ u16 sqe_idx;
+@@ -1931,6 +1992,7 @@ static int qedf_execute_tmf(struct qedf_
+ return FAILED;
+ }
+
++ lun = (int)sc_cmd->device->lun;
+ if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) {
+ QEDF_ERR(&(qedf->dbg_ctx), "fcport not offloaded\n");
+ rc = FAILED;
+@@ -1957,7 +2019,7 @@ static int qedf_execute_tmf(struct qedf_
+ io_req->fcport = fcport;
+ io_req->cmd_type = QEDF_TASK_MGMT_CMD;
+
+- /* Set the return CPU to be the same as the request one */
++ /* Record which cpu this request is associated with */
+ io_req->cpu = smp_processor_id();
+
+ /* Set TM flags */
+@@ -1966,7 +2028,7 @@ static int qedf_execute_tmf(struct qedf_
+ io_req->tm_flags = tm_flags;
+
+ /* Default is to return a SCSI command when an error occurs */
+- io_req->return_scsi_cmd_on_abts = true;
++ io_req->return_scsi_cmd_on_abts = false;
+
+ /* Obtain exchange id */
+ xid = io_req->xid;
+@@ -1990,12 +2052,16 @@ static int qedf_execute_tmf(struct qedf_
+
+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
+
++ set_bit(QEDF_CMD_OUTSTANDING, &io_req->flags);
+ tmo = wait_for_completion_timeout(&io_req->tm_done,
+ QEDF_TM_TIMEOUT * HZ);
+
+ if (!tmo) {
+ rc = FAILED;
+ QEDF_ERR(&(qedf->dbg_ctx), "wait for tm_cmpl timeout!\n");
++ /* Clear outstanding bit since command timed out */
++ clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags);
++ io_req->sc_cmd = NULL;
+ } else {
+ /* Check TMF response code */
+ if (io_req->fcp_rsp_code == 0)
+@@ -2003,14 +2069,25 @@ static int qedf_execute_tmf(struct qedf_
+ else
+ rc = FAILED;
+ }
++ /*
++ * Double check that fcport has not gone into an uploading state before
++ * executing the command flush for the LUN/target.
++ */
++ if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) {
++ QEDF_ERR(&qedf->dbg_ctx,
++ "fcport is uploading, not executing flush.\n");
++ goto no_flush;
++ }
++ /* We do not need this io_req any more */
++ kref_put(&io_req->refcount, qedf_release_cmd);
++
+
+ if (tm_flags == FCP_TMF_LUN_RESET)
+- qedf_flush_active_ios(fcport, (int)sc_cmd->device->lun);
++ qedf_flush_active_ios(fcport, lun);
+ else
+ qedf_flush_active_ios(fcport, -1);
+
+- kref_put(&io_req->refcount, qedf_release_cmd);
+-
++no_flush:
+ if (rc != SUCCESS) {
+ QEDF_ERR(&(qedf->dbg_ctx), "task mgmt command failed...\n");
+ rc = FAILED;
+@@ -2031,22 +2108,57 @@ int qedf_initiate_tmf(struct scsi_cmnd *
+ struct fc_lport *lport;
+ int rc = SUCCESS;
+ int rval;
++ struct qedf_ioreq *io_req = NULL;
++ int ref_cnt = 0;
++ struct fc_rport_priv *rdata = fcport->rdata;
+
+- rval = fc_remote_port_chkready(rport);
++ QEDF_ERR(NULL,
++ "tm_flags 0x%x sc_cmd %p op = 0x%02x target_id = 0x%x lun=%d\n",
++ tm_flags, sc_cmd, sc_cmd->cmnd[0], rport->scsi_target_id,
++ (int)sc_cmd->device->lun);
++
++ if (!rdata || !kref_get_unless_zero(&rdata->kref)) {
++ QEDF_ERR(NULL, "stale rport\n");
++ return FAILED;
++ }
++
++ QEDF_ERR(NULL, "portid=%06x tm_flags =%s\n", rdata->ids.port_id,
++ (tm_flags == FCP_TMF_TGT_RESET) ? "TARGET RESET" :
++ "LUN RESET");
++
++ if (sc_cmd->SCp.ptr) {
++ io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr;
++ ref_cnt = kref_read(&io_req->refcount);
++ QEDF_ERR(NULL,
++ "orig io_req = %p xid = 0x%x ref_cnt = %d.\n",
++ io_req, io_req->xid, ref_cnt);
++ }
+
++ rval = fc_remote_port_chkready(rport);
+ if (rval) {
+ QEDF_ERR(NULL, "device_reset rport not ready\n");
+ rc = FAILED;
+ goto tmf_err;
+ }
+
+- if (fcport == NULL) {
++ rc = fc_block_scsi_eh(sc_cmd);
++ if (rc)
++ return rc;
++
++ if (!fcport) {
+ QEDF_ERR(NULL, "device_reset: rport is NULL\n");
+ rc = FAILED;
+ goto tmf_err;
+ }
+
+ qedf = fcport->qedf;
++
++ if (!qedf) {
++ QEDF_ERR(NULL, "qedf is NULL.\n");
++ rc = FAILED;
++ goto tmf_err;
++ }
++
+ lport = qedf->lport;
+
+ if (test_bit(QEDF_UNLOADING, &qedf->flags) ||
+@@ -2061,6 +2173,12 @@ int qedf_initiate_tmf(struct scsi_cmnd *
+ goto tmf_err;
+ }
+
++ if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) {
++ QEDF_ERR(&qedf->dbg_ctx, "fcport is uploading.\n");
++ rc = FAILED;
++ goto tmf_err;
++ }
++
+ rc = qedf_execute_tmf(fcport, sc_cmd, tm_flags);
+
+ tmf_err:
+@@ -2072,6 +2190,8 @@ void qedf_process_tmf_compl(struct qedf_
+ {
+ struct fcoe_cqe_rsp_info *fcp_rsp;
+
++ clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags);
++
+ fcp_rsp = &cqe->cqe_info.rsp_info;
+ qedf_parse_fcp_rsp(io_req, fcp_rsp);
+
+--- a/drivers/scsi/qedf/qedf_main.c
++++ b/drivers/scsi/qedf/qedf_main.c
+@@ -615,50 +615,113 @@ static struct scsi_transport_template *q
+ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)
+ {
+ struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
+- struct fc_rport_libfc_priv *rp = rport->dd_data;
+- struct qedf_rport *fcport;
+ struct fc_lport *lport;
+ struct qedf_ctx *qedf;
+ struct qedf_ioreq *io_req;
++ struct fc_rport_libfc_priv *rp = rport->dd_data;
++ struct fc_rport_priv *rdata;
++ struct qedf_rport *fcport = NULL;
+ int rc = FAILED;
++ int wait_count = 100;
++ int refcount = 0;
+ int rval;
+-
+- if (fc_remote_port_chkready(rport)) {
+- QEDF_ERR(NULL, "rport not ready\n");
+- goto out;
+- }
++ int got_ref = 0;
+
+ lport = shost_priv(sc_cmd->device->host);
+ qedf = (struct qedf_ctx *)lport_priv(lport);
+
+- if ((lport->state != LPORT_ST_READY) || !(lport->link_up)) {
+- QEDF_ERR(&(qedf->dbg_ctx), "link not ready.\n");
++ /* rport and tgt are allocated together, so tgt should be non-NULL */
++ fcport = (struct qedf_rport *)&rp[1];
++ rdata = fcport->rdata;
++ if (!rdata || !kref_get_unless_zero(&rdata->kref)) {
++ QEDF_ERR(&qedf->dbg_ctx, "stale rport, sc_cmd=%p\n", sc_cmd);
++ rc = 1;
+ goto out;
+ }
+
+- fcport = (struct qedf_rport *)&rp[1];
+
+ io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr;
+ if (!io_req) {
+- QEDF_ERR(&(qedf->dbg_ctx), "io_req is NULL.\n");
++ QEDF_ERR(&qedf->dbg_ctx,
++ "sc_cmd not queued with lld, sc_cmd=%p op=0x%02x, port_id=%06x\n",
++ sc_cmd, sc_cmd->cmnd[0],
++ rdata->ids.port_id);
+ rc = SUCCESS;
+- goto out;
++ goto drop_rdata_kref;
++ }
++
++ rval = kref_get_unless_zero(&io_req->refcount); /* ID: 005 */
++ if (rval)
++ got_ref = 1;
++
++ /* If we got a valid io_req, confirm it belongs to this sc_cmd. */
++ if (!rval || io_req->sc_cmd != sc_cmd) {
++ QEDF_ERR(&qedf->dbg_ctx,
++ "Freed/Incorrect io_req, io_req->sc_cmd=%p, sc_cmd=%p, port_id=%06x, bailing out.\n",
++ io_req->sc_cmd, sc_cmd, rdata->ids.port_id);
++
++ goto drop_rdata_kref;
++ }
++
++ if (fc_remote_port_chkready(rport)) {
++ refcount = kref_read(&io_req->refcount);
++ QEDF_ERR(&qedf->dbg_ctx,
++ "rport not ready, io_req=%p, xid=0x%x sc_cmd=%p op=0x%02x, refcount=%d, port_id=%06x\n",
++ io_req, io_req->xid, sc_cmd, sc_cmd->cmnd[0],
++ refcount, rdata->ids.port_id);
++
++ goto drop_rdata_kref;
++ }
++
++ rc = fc_block_scsi_eh(sc_cmd);
++ if (rc)
++ goto drop_rdata_kref;
++
++ if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) {
++ QEDF_ERR(&qedf->dbg_ctx,
++ "Connection uploading, xid=0x%x., port_id=%06x\n",
++ io_req->xid, rdata->ids.port_id);
++ while (io_req->sc_cmd && (wait_count != 0)) {
++ msleep(100);
++ wait_count--;
++ }
++ if (wait_count) {
++ QEDF_ERR(&qedf->dbg_ctx, "ABTS succeeded\n");
++ rc = SUCCESS;
++ } else {
++ QEDF_ERR(&qedf->dbg_ctx, "ABTS failed\n");
++ rc = FAILED;
++ }
++ goto drop_rdata_kref;
+ }
+
+- QEDF_ERR(&(qedf->dbg_ctx), "Aborting io_req sc_cmd=%p xid=0x%x "
+- "fp_idx=%d.\n", sc_cmd, io_req->xid, io_req->fp_idx);
++ if (lport->state != LPORT_ST_READY || !(lport->link_up)) {
++ QEDF_ERR(&qedf->dbg_ctx, "link not ready.\n");
++ goto drop_rdata_kref;
++ }
++
++ QEDF_ERR(&qedf->dbg_ctx,
++ "Aborting io_req=%p sc_cmd=%p xid=0x%x fp_idx=%d, port_id=%06x.\n",
++ io_req, sc_cmd, io_req->xid, io_req->fp_idx,
++ rdata->ids.port_id);
+
+ if (qedf->stop_io_on_error) {
+ qedf_stop_all_io(qedf);
+ rc = SUCCESS;
+- goto out;
++ goto drop_rdata_kref;
+ }
+
+ init_completion(&io_req->abts_done);
+ rval = qedf_initiate_abts(io_req, true);
+ if (rval) {
+ QEDF_ERR(&(qedf->dbg_ctx), "Failed to queue ABTS.\n");
+- goto out;
++ /*
++ * If we fail to queue the ABTS then return this command to
++ * the SCSI layer as it will own and free the xid
++ */
++ rc = SUCCESS;
++ qedf_scsi_done(qedf, io_req, DID_ERROR);
++ goto drop_rdata_kref;
+ }
+
+ wait_for_completion(&io_req->abts_done);
+@@ -684,19 +747,27 @@ static int qedf_eh_abort(struct scsi_cmn
+ QEDF_ERR(&(qedf->dbg_ctx), "ABTS failed, xid=0x%x.\n",
+ io_req->xid);
+
++drop_rdata_kref:
++ kref_put(&rdata->kref, fc_rport_destroy);
+ out:
++ if (got_ref)
++ kref_put(&io_req->refcount, qedf_release_cmd);
+ return rc;
+ }
+
+ static int qedf_eh_target_reset(struct scsi_cmnd *sc_cmd)
+ {
+- QEDF_ERR(NULL, "TARGET RESET Issued...");
++ QEDF_ERR(NULL, "%d:0:%d:%lld: TARGET RESET Issued...",
++ sc_cmd->device->host->host_no, sc_cmd->device->id,
++ sc_cmd->device->lun);
+ return qedf_initiate_tmf(sc_cmd, FCP_TMF_TGT_RESET);
+ }
+
+ static int qedf_eh_device_reset(struct scsi_cmnd *sc_cmd)
+ {
+- QEDF_ERR(NULL, "LUN RESET Issued...\n");
++ QEDF_ERR(NULL, "%d:0:%d:%lld: LUN RESET Issued... ",
++ sc_cmd->device->host->host_no, sc_cmd->device->id,
++ sc_cmd->device->lun);
+ return qedf_initiate_tmf(sc_cmd, FCP_TMF_LUN_RESET);
+ }
+
+@@ -740,22 +811,6 @@ static int qedf_eh_host_reset(struct scs
+ {
+ struct fc_lport *lport;
+ struct qedf_ctx *qedf;
+- struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
+- struct fc_rport_libfc_priv *rp = rport->dd_data;
+- struct qedf_rport *fcport = (struct qedf_rport *)&rp[1];
+- int rval;
+-
+- rval = fc_remote_port_chkready(rport);
+-
+- if (rval) {
+- QEDF_ERR(NULL, "device_reset rport not ready\n");
+- return FAILED;
+- }
+-
+- if (fcport == NULL) {
+- QEDF_ERR(NULL, "device_reset: rport is NULL\n");
+- return FAILED;
+- }
+
+ lport = shost_priv(sc_cmd->device->host);
+ qedf = lport_priv(lport);
+@@ -3002,6 +3057,7 @@ static int __qedf_probe(struct pci_dev *
+ pci_set_drvdata(pdev, qedf);
+ init_completion(&qedf->fipvlan_compl);
+ mutex_init(&qedf->stats_mutex);
++ mutex_init(&qedf->flush_mutex);
+
+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO,
+ "QLogic FastLinQ FCoE Module qedf %s, "
diff --git a/patches.suse/scsi-qedf-decrease-the-ll2-mtu-size-to-2500 b/patches.suse/scsi-qedf-decrease-the-ll2-mtu-size-to-2500
index 1de64f6c38..7d3821108a 100644
--- a/patches.suse/scsi-qedf-decrease-the-ll2-mtu-size-to-2500
+++ b/patches.suse/scsi-qedf-decrease-the-ll2-mtu-size-to-2500
@@ -18,8 +18,8 @@ Acked-by: Lee Duncan <lduncan@suse.com>
--- a/drivers/scsi/qedf/qedf.h
+++ b/drivers/scsi/qedf/qedf.h
@@ -55,6 +55,7 @@
- #define QEDF_ABORT_TIMEOUT 10
- #define QEDF_CLEANUP_TIMEOUT 10
+ #define QEDF_ABORT_TIMEOUT (10 * 1000)
+ #define QEDF_CLEANUP_TIMEOUT 1
#define QEDF_MAX_CDB_LEN 16
+#define QEDF_LL2_BUF_SIZE 2500 /* Buffer size required for LL2 Rx */
@@ -27,7 +27,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
#define UPSTREAM_KEEP 1
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
-@@ -3309,7 +3309,7 @@ static int __qedf_probe(struct pci_dev *
+@@ -3331,7 +3331,7 @@ static int __qedf_probe(struct pci_dev *
}
memset(&params, 0, sizeof(params));
diff --git a/patches.suse/scsi-qedf-fc_rport_priv-reference-counting-fixes.patch b/patches.suse/scsi-qedf-fc_rport_priv-reference-counting-fixes.patch
new file mode 100644
index 0000000000..857bdad76c
--- /dev/null
+++ b/patches.suse/scsi-qedf-fc_rport_priv-reference-counting-fixes.patch
@@ -0,0 +1,175 @@
+From: Hannes Reinecke <hare@suse.com>
+Date: Tue, 26 Mar 2019 00:38:49 -0700
+Subject: scsi: qedf: fc_rport_priv reference counting fixes
+Patch-mainline: v5.2-rc1
+Git-commit: 56efc304b18cbfa4a2b355c0ae817f61acea38c4
+References: bsc#1098291
+
+The fc_rport_priv structure is reference counted, so we need to ensure that
+the reference is increased before accessing the structure.
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Acked-by: Daniel Wagner <dwagner@suse.de>
+---
+ drivers/scsi/qedf/qedf_els.c | 9 ++++++++-
+ drivers/scsi/qedf/qedf_io.c | 25 +++++++++++++++++--------
+ drivers/scsi/qedf/qedf_main.c | 5 +++++
+ 3 files changed, 30 insertions(+), 9 deletions(-)
+
+--- a/drivers/scsi/qedf/qedf_els.c
++++ b/drivers/scsi/qedf/qedf_els.c
+@@ -382,12 +382,18 @@ void qedf_restart_rport(struct qedf_rpor
+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
+
+ rdata = fcport->rdata;
+- if (rdata) {
++ if (rdata && !kref_get_unless_zero(&rdata->kref)) {
++ fcport->rdata = NULL;
++ rdata = NULL;
++ }
++
++ if (rdata && rdata->rp_state == RPORT_ST_READY) {
+ lport = fcport->qedf->lport;
+ port_id = rdata->ids.port_id;
+ QEDF_ERR(&(fcport->qedf->dbg_ctx),
+ "LOGO port_id=%x.\n", port_id);
+ fc_rport_logoff(rdata);
++ kref_put(&rdata->kref, fc_rport_destroy);
+ mutex_lock(&lport->disc.disc_mutex);
+ /* Recreate the rport and log back in */
+ rdata = fc_rport_create(lport, port_id);
+@@ -397,6 +403,7 @@ void qedf_restart_rport(struct qedf_rpor
+ fcport->rdata = rdata;
+ } else {
+ mutex_unlock(&lport->disc.disc_mutex);
++ fcport->rdata = NULL;
+ }
+ }
+ clear_bit(QEDF_RPORT_IN_RESET, &fcport->flags);
+--- a/drivers/scsi/qedf/qedf_io.c
++++ b/drivers/scsi/qedf/qedf_io.c
+@@ -1587,6 +1587,7 @@ int qedf_initiate_abts(struct qedf_ioreq
+ goto out;
+ }
+
++ qedf = fcport->qedf;
+ rdata = fcport->rdata;
+
+ if (!rdata || !kref_get_unless_zero(&rdata->kref)) {
+@@ -1596,32 +1597,31 @@ int qedf_initiate_abts(struct qedf_ioreq
+ }
+
+ r_a_tov = rdata->r_a_tov;
+- qedf = fcport->qedf;
+ lport = qedf->lport;
+
+ if (lport->state != LPORT_ST_READY || !(lport->link_up)) {
+ QEDF_ERR(&(qedf->dbg_ctx), "link is not ready\n");
+ rc = 1;
+- goto out;
++ goto drop_rdata_kref;
+ }
+
+ if (atomic_read(&qedf->link_down_tmo_valid) > 0) {
+ QEDF_ERR(&(qedf->dbg_ctx), "link_down_tmo active.\n");
+ rc = 1;
+- goto out;
++ goto drop_rdata_kref;
+ }
+
+ /* Ensure room on SQ */
+ if (!atomic_read(&fcport->free_sqes)) {
+ QEDF_ERR(&(qedf->dbg_ctx), "No SQ entries available\n");
+ rc = 1;
+- goto out;
++ goto drop_rdata_kref;
+ }
+
+ if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) {
+ QEDF_ERR(&qedf->dbg_ctx, "fcport is uploading.\n");
+ rc = 1;
+- goto out;
++ goto drop_rdata_kref;
+ }
+
+ if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags) ||
+@@ -1631,7 +1631,7 @@ int qedf_initiate_abts(struct qedf_ioreq
+ "cleanup or abort processing or already "
+ "completed.\n", io_req->xid);
+ rc = 1;
+- goto out;
++ goto drop_rdata_kref;
+ }
+
+ kref_get(&io_req->refcount);
+@@ -1664,6 +1664,8 @@ int qedf_initiate_abts(struct qedf_ioreq
+
+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
+
++drop_rdata_kref:
++ kref_put(&rdata->kref, fc_rport_destroy);
+ out:
+ return rc;
+ }
+@@ -1986,6 +1988,7 @@ static int qedf_execute_tmf(struct qedf_
+ unsigned long flags;
+ struct fcoe_wqe *sqe;
+ u16 sqe_idx;
++ struct fc_rport_priv *rdata = fcport->rdata;
+
+ if (!sc_cmd) {
+ QEDF_ERR(&(qedf->dbg_ctx), "invalid arg\n");
+@@ -1999,8 +2002,13 @@ static int qedf_execute_tmf(struct qedf_
+ return FAILED;
+ }
+
+- QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_SCSI_TM, "portid = 0x%x "
+- "tm_flags = %d\n", fcport->rdata->ids.port_id, tm_flags);
++ if (!rdata || !kref_get_unless_zero(&rdata->kref)) {
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM, "stale rport\n");
++ return FAILED;
++ }
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_SCSI_TM,
++ "portid = 0x%x tm_flags = %d\n",
++ rdata->ids.port_id, tm_flags);
+
+ io_req = qedf_alloc_cmd(fcport, QEDF_TASK_MGMT_CMD);
+ if (!io_req) {
+@@ -2096,6 +2104,7 @@ no_flush:
+ rc = SUCCESS;
+ }
+ reset_tmf_err:
++ kref_put(&rdata->kref, fc_rport_destroy);
+ return rc;
+ }
+
+--- a/drivers/scsi/qedf/qedf_main.c
++++ b/drivers/scsi/qedf/qedf_main.c
+@@ -1290,6 +1290,8 @@ static void qedf_upload_connection(struc
+ static void qedf_cleanup_fcport(struct qedf_ctx *qedf,
+ struct qedf_rport *fcport)
+ {
++ struct fc_rport_priv *rdata = fcport->rdata;
++
+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_CONN, "Cleaning up portid=%06x.\n",
+ fcport->rdata->ids.port_id);
+
+@@ -1301,6 +1303,7 @@ static void qedf_cleanup_fcport(struct q
+ qedf_free_sq(qedf, fcport);
+ fcport->rdata = NULL;
+ fcport->qedf = NULL;
++ kref_put(&rdata->kref, fc_rport_destroy);
+ }
+
+ /**
+@@ -1376,6 +1379,8 @@ static void qedf_rport_event_handler(str
+ break;
+ }
+
++ /* Initial reference held on entry, so this can't fail */
++ kref_get(&rdata->kref);
+ fcport->rdata = rdata;
+ fcport->rport = rport;
+
diff --git a/patches.suse/scsi-qedf-print-message-during-bailout-conditions b/patches.suse/scsi-qedf-print-message-during-bailout-conditions
index 304d419959..42d730f427 100644
--- a/patches.suse/scsi-qedf-print-message-during-bailout-conditions
+++ b/patches.suse/scsi-qedf-print-message-during-bailout-conditions
@@ -84,7 +84,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
if (rrq_req->event != QEDF_IOREQ_EV_ELS_TMO &&
rrq_req->event != QEDF_IOREQ_EV_ELS_ERR_DETECT)
-@@ -330,8 +333,10 @@ void qedf_restart_rport(struct qedf_rpor
+@@ -357,8 +360,10 @@ void qedf_restart_rport(struct qedf_rpor
u32 port_id;
unsigned long flags;
@@ -96,7 +96,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
spin_lock_irqsave(&fcport->rport_lock, flags);
if (test_bit(QEDF_RPORT_IN_RESET, &fcport->flags) ||
-@@ -391,8 +396,11 @@ static void qedf_l2_els_compl(struct qed
+@@ -425,8 +430,11 @@ static void qedf_l2_els_compl(struct qed
* If we are flushing the command just free the cb_arg as none of the
* response data will be valid.
*/
@@ -109,7 +109,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
fcport = els_req->fcport;
mp_req = &(els_req->mp_req);
-@@ -505,8 +513,10 @@ static void qedf_srr_compl(struct qedf_e
+@@ -539,8 +547,10 @@ static void qedf_srr_compl(struct qedf_e
orig_io_req = cb_arg->aborted_io_req;
@@ -121,7 +121,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
clear_bit(QEDF_CMD_SRR_SENT, &orig_io_req->flags);
-@@ -520,8 +530,11 @@ static void qedf_srr_compl(struct qedf_e
+@@ -554,8 +564,11 @@ static void qedf_srr_compl(struct qedf_e
orig_io_req, orig_io_req->xid, srr_req->xid, refcount);
/* If a SRR times out, simply free resources */
@@ -134,7 +134,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
/* Normalize response data into struct fc_frame */
mp_req = &(srr_req->mp_req);
-@@ -694,8 +707,11 @@ void qedf_process_seq_cleanup_compl(stru
+@@ -728,8 +741,11 @@ void qedf_process_seq_cleanup_compl(stru
cb_arg = io_req->cb_arg;
/* If we timed out just free resources */
@@ -147,7 +147,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
/* Kill the timer we put on the request */
cancel_delayed_work_sync(&io_req->timeout_work);
-@@ -798,8 +814,10 @@ static void qedf_rec_compl(struct qedf_e
+@@ -832,8 +848,10 @@ static void qedf_rec_compl(struct qedf_e
orig_io_req = cb_arg->aborted_io_req;
@@ -159,7 +159,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
if (rec_req->event != QEDF_IOREQ_EV_ELS_TMO &&
rec_req->event != QEDF_IOREQ_EV_ELS_ERR_DETECT)
-@@ -811,8 +829,12 @@ static void qedf_rec_compl(struct qedf_e
+@@ -845,8 +863,12 @@ static void qedf_rec_compl(struct qedf_e
orig_io_req, orig_io_req->xid, rec_req->xid, refcount);
/* If a REC times out, free resources */
@@ -190,7 +190,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
eth_fr = (char *)skb->data;
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
-@@ -94,6 +94,8 @@ static void qedf_cmd_timeout(struct work
+@@ -107,6 +107,8 @@ static void qedf_cmd_timeout(struct work
qedf_process_seq_cleanup_compl(qedf, NULL, io_req);
break;
default:
@@ -199,7 +199,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
break;
}
}
-@@ -112,8 +114,10 @@ void qedf_cmd_mgr_free(struct qedf_cmd_m
+@@ -125,8 +127,10 @@ void qedf_cmd_mgr_free(struct qedf_cmd_m
num_ios = max_xid - min_xid + 1;
/* Free fcoe_bdt_ctx structures */
@@ -211,7 +211,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
bd_tbl_sz = QEDF_MAX_BDS_PER_CMD * sizeof(struct scsi_sge);
for (i = 0; i < num_ios; i++) {
-@@ -215,8 +219,11 @@ struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(
+@@ -228,8 +232,11 @@ struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(
io_req->sense_buffer = dma_alloc_coherent(&qedf->pdev->dev,
QEDF_SCSI_SENSE_BUFFERSIZE, &io_req->sense_buffer_dma,
GFP_KERNEL);
@@ -224,7 +224,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
/* Allocate task parameters to pass to f/w init funcions */
io_req->task_params = kzalloc(sizeof(*io_req->task_params),
-@@ -413,14 +420,23 @@ void qedf_release_cmd(struct kref *ref)
+@@ -426,14 +433,23 @@ void qedf_release_cmd(struct kref *ref)
struct qedf_cmd_mgr *cmd_mgr = io_req->cmd_mgr;
struct qedf_rport *fcport = io_req->fcport;
@@ -249,7 +249,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
/* Increment task retry identifier now that the request is released */
io_req->task_retry_identifier++;
-@@ -945,6 +961,9 @@ qedf_queuecommand(struct Scsi_Host *host
+@@ -958,6 +974,9 @@ qedf_queuecommand(struct Scsi_Host *host
if (test_bit(QEDF_UNLOADING, &qedf->flags) ||
test_bit(QEDF_DBG_STOP_IO, &qedf->flags)) {
@@ -259,7 +259,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
sc_cmd->result = DID_NO_CONNECT << 16;
sc_cmd->scsi_done(sc_cmd);
return 0;
-@@ -961,6 +980,9 @@ qedf_queuecommand(struct Scsi_Host *host
+@@ -974,6 +993,9 @@ qedf_queuecommand(struct Scsi_Host *host
rval = fc_remote_port_chkready(rport);
if (rval) {
@@ -269,7 +269,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
sc_cmd->result = rval;
sc_cmd->scsi_done(sc_cmd);
return 0;
-@@ -968,12 +990,14 @@ qedf_queuecommand(struct Scsi_Host *host
+@@ -981,12 +1003,14 @@ qedf_queuecommand(struct Scsi_Host *host
/* Retry command if we are doing a qed drain operation */
if (test_bit(QEDF_DRAIN_ACTIVE, &qedf->flags)) {
@@ -284,7 +284,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
rc = SCSI_MLQUEUE_HOST_BUSY;
goto exit_qcmd;
}
-@@ -1263,8 +1287,10 @@ void qedf_scsi_done(struct qedf_ctx *qed
+@@ -1289,8 +1313,10 @@ void qedf_scsi_done(struct qedf_ctx *qed
struct scsi_cmnd *sc_cmd;
int refcount;
@@ -296,7 +296,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
xid = io_req->xid;
sc_cmd = io_req->sc_cmd;
-@@ -1320,8 +1346,12 @@ void qedf_process_warning_compl(struct q
+@@ -1346,8 +1372,12 @@ void qedf_process_warning_compl(struct q
u64 err_warn_bit_map;
u8 err_warn = 0xff;
@@ -310,7 +310,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
QEDF_ERR(&(io_req->fcport->qedf->dbg_ctx), "Warning CQE, "
"xid=0x%x\n", io_req->xid);
-@@ -1383,8 +1413,11 @@ void qedf_process_error_detect(struct qe
+@@ -1409,8 +1439,11 @@ void qedf_process_error_detect(struct qe
{
int rval;
@@ -323,7 +323,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
QEDF_ERR(&(io_req->fcport->qedf->dbg_ctx), "Error detection CQE, "
"xid=0x%x\n", io_req->xid);
-@@ -1445,8 +1478,10 @@ void qedf_flush_active_ios(struct qedf_r
+@@ -1471,8 +1504,10 @@ void qedf_flush_active_ios(struct qedf_r
struct qedf_cmd_mgr *cmd_mgr;
int i, rc;
@@ -335,7 +335,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
/* Check that fcport is still offloaded */
if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) {
-@@ -1683,6 +1718,10 @@ void qedf_process_abts_compl(struct qedf
+@@ -1745,6 +1780,10 @@ void qedf_process_abts_compl(struct qedf
clear_bit(QEDF_CMD_IN_ABORT, &io_req->flags);
if (io_req->sc_cmd) {
@@ -346,7 +346,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
if (io_req->return_scsi_cmd_on_abts)
qedf_scsi_done(qedf, io_req, DID_ERROR);
}
-@@ -1888,6 +1927,10 @@ int qedf_initiate_cleanup(struct qedf_io
+@@ -1950,6 +1989,10 @@ int qedf_initiate_cleanup(struct qedf_io
}
if (io_req->sc_cmd) {
@@ -357,8 +357,8 @@ Acked-by: Lee Duncan <lduncan@suse.com>
if (io_req->return_scsi_cmd_on_abts)
qedf_scsi_done(qedf, io_req, DID_ERROR);
}
-@@ -1927,7 +1970,7 @@ static int qedf_execute_tmf(struct qedf_
- u16 sqe_idx;
+@@ -1991,7 +2034,7 @@ static int qedf_execute_tmf(struct qedf_
+ struct fc_rport_priv *rdata = fcport->rdata;
if (!sc_cmd) {
- QEDF_ERR(&(qedf->dbg_ctx), "invalid arg\n");
@@ -402,7 +402,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
fp = fc_frame_alloc(lport, sizeof(struct fc_els_flogi));
if (!fp) {
-@@ -2224,12 +2231,14 @@ static void qedf_recv_frame(struct qedf_
+@@ -2272,12 +2279,14 @@ static void qedf_recv_frame(struct qedf_
fr_dev(fp) = lport;
fr_sof(fp) = hp->fcoe_sof;
if (skb_copy_bits(skb, fr_len, &crc_eof, sizeof(crc_eof))) {
@@ -417,7 +417,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
kfree_skb(skb);
return;
}
-@@ -2290,9 +2299,9 @@ static void qedf_recv_frame(struct qedf_
+@@ -2338,9 +2347,9 @@ static void qedf_recv_frame(struct qedf_
* empty then this is not addressed to our port so simply drop it.
*/
if (lport->port_id != ntoh24(fh->fh_d_id) && !vn_port) {
@@ -430,7 +430,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
kfree_skb(skb);
return;
}
-@@ -2301,6 +2310,8 @@ static void qedf_recv_frame(struct qedf_
+@@ -2349,6 +2358,8 @@ static void qedf_recv_frame(struct qedf_
if ((fh->fh_type == FC_TYPE_BLS) && (f_ctl & FC_FC_SEQ_CTX) &&
(f_ctl & FC_FC_EX_CTX)) {
/* Drop incoming ABTS response that has both SEQ/EX CTX set */
@@ -439,7 +439,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
kfree_skb(skb);
return;
}
-@@ -2444,8 +2455,9 @@ static int qedf_alloc_and_init_sb(struct
+@@ -2492,8 +2503,9 @@ static int qedf_alloc_and_init_sb(struct
sizeof(struct status_block_e4), &sb_phys, GFP_KERNEL);
if (!sb_virt) {
@@ -451,7 +451,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
return -ENOMEM;
}
-@@ -2453,8 +2465,9 @@ static int qedf_alloc_and_init_sb(struct
+@@ -2501,8 +2513,9 @@ static int qedf_alloc_and_init_sb(struct
sb_id, QED_SB_TYPE_STORAGE);
if (ret) {
@@ -463,7 +463,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
return ret;
}
-@@ -2538,13 +2551,18 @@ void qedf_process_cqe(struct qedf_ctx *q
+@@ -2586,13 +2599,18 @@ void qedf_process_cqe(struct qedf_ctx *q
io_req = &qedf->cmd_mgr->cmds[xid];
/* Completion not for a valid I/O anymore so just return */
@@ -484,7 +484,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
return;
}
-@@ -2553,7 +2571,8 @@ void qedf_process_cqe(struct qedf_ctx *q
+@@ -2601,7 +2619,8 @@ void qedf_process_cqe(struct qedf_ctx *q
* isn't valid and shouldn't be taken. We should just return.
*/
if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) {
@@ -494,7 +494,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
return;
}
-@@ -2763,6 +2782,7 @@ static int qedf_alloc_global_queues(stru
+@@ -2811,6 +2830,7 @@ static int qedf_alloc_global_queues(stru
*/
if (!qedf->p_cpuq) {
status = 1;
@@ -502,7 +502,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
goto mem_alloc_failure;
}
-@@ -2778,8 +2798,10 @@ static int qedf_alloc_global_queues(stru
+@@ -2826,8 +2846,10 @@ static int qedf_alloc_global_queues(stru
/* Allocate DMA coherent buffers for BDQ */
rc = qedf_alloc_bdq(qedf);
@@ -514,7 +514,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
/* Allocate a CQ and an associated PBL for each MSI-X vector */
for (i = 0; i < qedf->num_queues; i++) {
-@@ -3087,6 +3109,7 @@ static int __qedf_probe(struct pci_dev *
+@@ -3136,6 +3158,7 @@ static int __qedf_probe(struct pci_dev *
qed_params.is_vf = is_vf;
qedf->cdev = qed_ops->common->probe(pdev, &qed_params);
if (!qedf->cdev) {
@@ -522,7 +522,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
rc = -ENODEV;
goto err1;
}
-@@ -3155,8 +3178,10 @@ static int __qedf_probe(struct pci_dev *
+@@ -3199,8 +3222,10 @@ static int __qedf_probe(struct pci_dev *
/* Setup interrupts */
rc = qedf_setup_int(qedf);
diff --git a/patches.suse/scsi_transport_fc-return-EBUSY-for-deleted-vport.patch b/patches.suse/scsi_transport_fc-return-EBUSY-for-deleted-vport.patch
index 3fba89e612..dbeb326237 100644
--- a/patches.suse/scsi_transport_fc-return-EBUSY-for-deleted-vport.patch
+++ b/patches.suse/scsi_transport_fc-return-EBUSY-for-deleted-vport.patch
@@ -11,14 +11,12 @@ if so there's no need to do anything.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
- drivers/scsi/scsi_transport_fc.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
+ drivers/scsi/scsi_transport_fc.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
-diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
-index bf28c68..ddbfbf1 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
-@@ -1284,7 +1284,7 @@ store_fc_vport_delete(struct device *dev, struct device_attribute *attr,
+@@ -1286,7 +1286,7 @@ store_fc_vport_delete(struct device *dev
unsigned long flags;
spin_lock_irqsave(shost->host_lock, flags);
@@ -27,19 +25,15 @@ index bf28c68..ddbfbf1 100644
spin_unlock_irqrestore(shost->host_lock, flags);
return -EBUSY;
}
-@@ -2447,8 +2447,11 @@ fc_remove_host(struct Scsi_Host *shost)
+@@ -2430,8 +2430,10 @@ fc_remove_host(struct Scsi_Host *shost)
spin_lock_irqsave(shost->host_lock, flags);
/* Remove any vports */
- list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers)
+ list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) {
-+ list_del(&vport->peers);
+ vport->flags |= FC_VPORT_DELETING;
fc_queue_work(shost, &vport->vport_delete_work);
+ }
/* Remove any remote ports */
list_for_each_entry_safe(rport, next_rport,
---
-1.8.5.6
-
diff --git a/patches.suse/tuntap-correctly-set-SOCKWQ_ASYNC_NOSPACE.patch b/patches.suse/tuntap-correctly-set-SOCKWQ_ASYNC_NOSPACE.patch
new file mode 100644
index 0000000000..1ff61165c5
--- /dev/null
+++ b/patches.suse/tuntap-correctly-set-SOCKWQ_ASYNC_NOSPACE.patch
@@ -0,0 +1,64 @@
+From: Jason Wang <jasowang@redhat.com>
+Date: Tue, 22 May 2018 14:21:04 +0800
+Subject: tuntap: correctly set SOCKWQ_ASYNC_NOSPACE
+Patch-mainline: v4.17-rc7
+Git-commit: 2f3ab6221e4c87960347d65c7cab9bd917d1f637
+References: bsc#1145099
+
+When link is down, writes to the device might fail with
+-EIO. Userspace needs an indication when the status is resolved. As a
+fix, tun_net_open() attempts to wake up writers - but that is only
+effective if SOCKWQ_ASYNC_NOSPACE has been set in the past. This is
+not the case of vhost_net which only poll for EPOLLOUT after it meets
+errors during sendmsg().
+
+This patch fixes this by making sure SOCKWQ_ASYNC_NOSPACE is set when
+socket is not writable or device is down to guarantee EPOLLOUT will be
+raised in either tun_chr_poll() or tun_sock_write_space() after device
+is up.
+
+Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
+Cc: Eric Dumazet <edumazet@google.com>
+Fixes: 1bd4978a88ac2 ("tun: honor IFF_UP in tun_get_user()")
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Lin Ma <lma@suse.com>
+---
+ drivers/net/tun.c | 19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/tun.c
++++ b/drivers/net/tun.c
+@@ -1093,6 +1093,13 @@ static void tun_net_init(struct net_device *dev)
+ dev->max_mtu = MAX_MTU - dev->hard_header_len;
+ }
+
++static bool tun_sock_writeable(struct tun_struct *tun, struct tun_file *tfile)
++{
++ struct sock *sk = tfile->socket.sk;
++
++ return (tun->dev->flags & IFF_UP) && sock_writeable(sk);
++}
++
+ /* Character device part */
+
+ /* Poll */
+@@ -1115,10 +1122,14 @@ static unsigned int tun_chr_poll(struct file *file, poll_table *wait)
+ if (!skb_array_empty(&tfile->tx_array))
+ mask |= POLLIN | POLLRDNORM;
+
+- if (tun->dev->flags & IFF_UP &&
+- (sock_writeable(sk) ||
+- (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) &&
+- sock_writeable(sk))))
++ /* Make sure SOCKWQ_ASYNC_NOSPACE is set if not writable to
++ * guarantee EPOLLOUT to be raised by either here or
++ * tun_sock_write_space(). Then process could get notification
++ * after it writes to a down device and meets -EIO.
++ */
++ if (tun_sock_writeable(tun, tfile) ||
++ (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) &&
++ tun_sock_writeable(tun, tfile)))
+ mask |= POLLOUT | POLLWRNORM;
+
+ if (tun->dev->reg_state != NETREG_REGISTERED)
diff --git a/patches.suse/vhost_net-conditionally-enable-tx-polling.patch b/patches.suse/vhost_net-conditionally-enable-tx-polling.patch
new file mode 100644
index 0000000000..0848fa6879
--- /dev/null
+++ b/patches.suse/vhost_net-conditionally-enable-tx-polling.patch
@@ -0,0 +1,44 @@
+From: Jason Wang <jasowang@redhat.com>
+Date: Mon, 13 Nov 2017 11:45:34 +0800
+Subject: vhost_net: conditionally enable tx polling
+Patch-mainline: v4.15-rc1
+Git-commit: feb8892cb441c742d4220cf7ced001e7fa070731
+References: bsc#1145099
+
+We always poll tx for socket, this is sub optimal since this will
+slightly increase the waitqueue traversing time and more important,
+vhost could not benefit from commit 9e641bdcfa4e ("net-tun:
+restructure tun_do_read for better sleep/wakeup efficiency") even if
+we've stopped rx polling during handle_rx(), tx poll were still left
+in the waitqueue.
+
+Pktgen from a remote host to VM over mlx4 on two 2.00GHz Xeon E5-2650
+shows 11.7% improvements on rx PPS. (from 1.28Mpps to 1.44Mpps)
+
+Cc: Wei Xu <wexu@redhat.com>
+Cc: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Acked-by: Lin Ma <lma@suse.com>
+---
+ drivers/vhost/net.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/vhost/net.c
++++ b/drivers/vhost/net.c
+@@ -394,6 +394,7 @@ static void handle_tx(struct vhost_net *net)
+ goto out;
+
+ vhost_disable_notify(&net->dev, vq);
++ vhost_net_disable_vq(net, vq);
+
+ hdr_size = nvq->vhost_hlen;
+ zcopy = nvq->ubufs;
+@@ -484,6 +485,7 @@ static void handle_tx(struct vhost_net *net)
+ % UIO_MAXIOV;
+ }
+ vhost_discard_vq_desc(vq, 1);
++ vhost_net_enable_vq(net, vq);
+ break;
+ }
+ if (err != len)
diff --git a/rpm/arch-symbols b/rpm/arch-symbols
index 6a80fdd35b..9b82f9227d 100755
--- a/rpm/arch-symbols
+++ b/rpm/arch-symbols
@@ -25,7 +25,7 @@
if [ "$1" = "--list" ]; then
# List all known architectures
- echo i386 mips{,64} sparc{,64} ppc{,64,64le} s390{,x} ia64 x86_64 alpha parisc armv6hl armv7hl arm64
+ echo i386 mips{,64} sparc{,64} ppc{,64,64le} s390{,x} ia64 x86_64 alpha parisc armv6hl armv7hl arm64 riscv64
exit 0
fi
diff --git a/rpm/check-module-license b/rpm/check-module-license
index 9910deec18..b5f67fce99 100755
--- a/rpm/check-module-license
+++ b/rpm/check-module-license
@@ -1,7 +1,7 @@
#!/bin/sh
rc=0
-for file in $(find "$@" -name '*.ko'); do
+for file in $(find "$@" -name '*.ko' -o -name '*.ko.xz'); do
l=$(/sbin/modinfo -F license "$file")
if [ -z "$l" ]; then
echo "ERROR: No license is included for module ${file##*/lib/modules/}"
diff --git a/rpm/config.sh b/rpm/config.sh
index 6f9274823b..9a6d612f80 100644
--- a/rpm/config.sh
+++ b/rpm/config.sh
@@ -2,6 +2,8 @@
SRCVERSION=4.12
# variant of the kernel-source package, either empty or "-rt" or "-azure"
VARIANT=-azure
+# Use new style livepatch package names
+LIVEPATCH=livepatch
# buildservice projects to build the kernel against
OBS_PROJECT=SUSE:SLE-15:Update
IBS_PROJECT=SUSE:SLE-15:Update
diff --git a/rpm/dtb.spec.in.in b/rpm/dtb.spec.in.in
index 8badeb3a98..60e2c9af55 100644
--- a/rpm/dtb.spec.in.in
+++ b/rpm/dtb.spec.in.in
@@ -88,10 +88,10 @@ done
cd pp
for dts in $ALL_SUPPORTED_DTB; do
target=${dts%*.dts}
- install -m 700 -d %{buildroot}%{dtbdir}/$(dirname $target)
+ install -m 755 -d %{buildroot}%{dtbdir}/$(dirname $target)
# install -m 644 COPYING %{buildroot}%{dtbdir}/$(dirname $target)
install -m 644 $target.dtb %{buildroot}%{dtbdir}/$(dirname $target)
-%ifarch aarch64
+%ifarch aarch64 riscv64
# HACK: work around U-Boot ignoring vendor dir
baselink=%{dtbdir}/$(basename $target).dtb
vendordir=$(basename $(dirname $target))
diff --git a/rpm/gitlog-excludes b/rpm/gitlog-excludes
index 07896db683..27fab312a6 100644
--- a/rpm/gitlog-excludes
+++ b/rpm/gitlog-excludes
@@ -1,3 +1,4 @@
bac621c6704610562ebd9e74ae5ad85ca8025681
5568093d5dbacaeb60b6e0f7f4bbe384b586b82a
821419f311f3edd58124e551664a2362b62671d6
+dc247e12f003761deeb591821ef78cde0b4f565f
diff --git a/rpm/kernel-binary.spec.in b/rpm/kernel-binary.spec.in
index b40edc7338..aadc3d30d0 100644
--- a/rpm/kernel-binary.spec.in
+++ b/rpm/kernel-binary.spec.in
@@ -21,6 +21,8 @@
%define patchversion @PATCHVERSION@
%define variant @VARIANT@%{nil}
%define vanilla_only @VANILLA_ONLY@
+%define compress_modules @COMPRESS_MODULES@
+%define livepatch @LIVEPATCH@%{nil}
%include %_sourcedir/kernel-spec-macros
@@ -329,12 +331,16 @@ if [ -f %_sourcedir/localversion ] ; then
cat %_sourcedir/localversion > localversion
fi
-vanilla_base="default"
+config_base="default"
%ifarch %ix86
-vanilla_base="pae"
+config_base="pae"
%endif
+if ! [ -f %my_builddir/config/%cpu_arch/$config_base ] ; then
+ config_base=%variant
+ config_base=${config_base#-}
+fi
if ! grep -q CONFIG_MMU= "%my_builddir/config/%cpu_arch_flavor"; then
-cp "%my_builddir/config/%cpu_arch/$vanilla_base" .config
+cp "%my_builddir/config/%cpu_arch/$config_base" .config
../scripts/kconfig/merge_config.sh -m .config \
%my_builddir/config/%cpu_arch_flavor
else
@@ -379,6 +385,9 @@ case %cpu_arch in
armv*)
MAKE_ARGS="$MAKE_ARGS ARCH=arm"
;;
+ riscv*)
+ MAKE_ARGS="$MAKE_ARGS ARCH=riscv"
+ ;;
*)
MAKE_ARGS="$MAKE_ARGS ARCH=%cpu_arch"
;;
@@ -474,21 +483,6 @@ done
%install
-# sign the modules, firmware and possibly the kernel in the buildservice
-BRP_PESIGN_FILES=""
-%if %CONFIG_EFI_STUB == "y"
-BRP_PESIGN_FILES="/boot/vmlinuz-%kernelrelease-%build_flavor"
-%endif
-%if %CONFIG_MODULE_SIG == "y"
-BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko"
-%endif
-%ifarch %ix86
-# XXX: do not sign on x86, as the repackaging changes kernel-pae
-# from i686 to i586
-BRP_PESIGN_FILES=""
-%endif
-export BRP_PESIGN_FILES
-
# get rid of /usr/lib/rpm/brp-strip-debug
# strip removes too much from the vmlinux ELF binary
export NO_BRP_STRIP_DEBUG=true
@@ -546,7 +540,11 @@ add_vmlinux()
%endif
%ifarch s390 s390x
add_vmlinux --compressed
- cp -p arch/s390/boot/image %buildroot/boot/image-%kernelrelease-%build_flavor
+ image=image
+ if test ! -f arch/s390/boot/$image; then
+ image=bzImage
+ fi
+ cp -p arch/s390/boot/$image %buildroot/boot/image-%kernelrelease-%build_flavor
image=image
if test -e arch/s390/boot/kerntypes.o; then
cp -p arch/s390/boot/kerntypes.o %buildroot/boot/Kerntypes-%kernelrelease-%build_flavor
@@ -568,6 +566,29 @@ add_vmlinux()
image=Image
cp -p arch/arm64/boot/$image %buildroot/boot/$image-%kernelrelease-%build_flavor
%endif
+%ifarch riscv64
+ add_vmlinux --compressed
+ image=Image
+ cp -p arch/riscv/boot/$image %buildroot/boot/$image-%kernelrelease-%build_flavor
+%endif
+
+# sign the modules, firmware and possibly the kernel in the buildservice
+BRP_PESIGN_FILES=""
+%if %CONFIG_EFI_STUB == "y"
+BRP_PESIGN_FILES="/boot/$image-%kernelrelease-%build_flavor"
+%endif
+%if %CONFIG_MODULE_SIG == "y"
+BRP_PESIGN_FILES="$BRP_PESIGN_FILES *.ko"
+%endif
+%ifarch %ix86
+# XXX: do not sign on x86, as the repackaging changes kernel-pae
+# from i686 to i586
+BRP_PESIGN_FILES=""
+%endif
+export BRP_PESIGN_FILES
+%if %{compress_modules} != "none"
+export BRP_PESIGN_COMPRESS_MODULE=%{compress_modules}
+%endif
if test -x /usr/lib/rpm/pesign/gen-hmac; then
$_ -r %buildroot /boot/$image-%kernelrelease-%build_flavor
@@ -803,6 +824,10 @@ if [ %CONFIG_MODULES = y ]; then
fi
rm -rf %{buildroot}/lib/firmware
+if [ %CONFIG_MODULES = y ]; then
+ # file contains number of CPUs, making builds hard to reproduce
+ find %{buildroot}/usr/src/linux-*-obj/ -name .kernel-binary.spec.buildenv -delete
+fi
add_dirs_to_filelist() {
sed -rn '
@@ -861,7 +886,8 @@ done | add_dirs_to_filelist >%my_builddir/kernel-devel.files
find lib/modules/%kernelrelease-%build_flavor \
-type d -o \
\( -path '*/modules.*' ! -path '*/modules.order' \
- ! -path '*/modules.builtin' \) -printf '%%%%ghost /%%p\n' \
+ ! -path '*/modules.builtin' \
+ ! -path '*/modules.builtin.modinfo' \) -printf '%%%%ghost /%%p\n' \
-o -name '*.ko' -prune -o -type f -printf '/%%p\n'
cat %my_builddir/base-modules
fi
@@ -1077,42 +1103,48 @@ kernel module packages) against the %build_flavor flavor of the kernel.
/usr/src/linux-obj/%kmp_target_cpu
%endif
-%if %CONFIG_SUSE_KERNEL_SUPPORTED == "y"
-%package livepatch
-Summary: Metapackage to pull in matching kernel-livepatch package
+%if "%livepatch" != "" && %CONFIG_SUSE_KERNEL_SUPPORTED == "y" && "%variant" == ""
+%if %livepatch == kgraft
+%define patch_package %{livepatch}-patch
+%else
+%define patch_package kernel-%{livepatch}
+%endif
+%package %{livepatch}
+Summary: Metapackage to pull in matching %patch_package package
Group: System/Kernel
-Requires: kernel-livepatch-%(echo %version-%source_rel | sed 'y/\./_/')-%build_flavor
+Requires: %{patch_package}-%(echo %{version}-%{source_rel} | sed 'y/\./_/')-%{build_flavor}
Provides: kernel-default-kgraft = %version
Provides: kernel-xen-kgraft = %version
Provides: multiversion(kernel)
+%if "%livepatch" != "kgraft"
Obsoletes: kernel-default-kgraft < %version
Obsoletes: kernel-xen-kgraft < %version
+%endif
-%description livepatch
-This is a metapackage that pulls in the matching kernel-livepatch package for a
+%description %{livepatch}
+This is a metapackage that pulls in the matching %patch_package package for a
given kernel version. The advantage of the metapackage is that its name is
-static, unlike the kernel-livepatch-<kernel-version>-flavor package names.
+static, unlike the %{patch_package}-<kernel-version>-flavor package names.
-%files livepatch
+%files %{livepatch}
# rpmlint complains about empty packages, so lets own something
%defattr(-, root, root)
%dir /lib/modules/%kernelrelease-%build_flavor
%endif
-%if 0%{?klp_symbols}
-
-%package livepatch-devel
-Summary: Kernel symbols file used during livepatch development
+%if 0%{?klp_symbols} && "%livepatch" != ""
+%package %{livepatch}-devel
+Summary: Kernel symbols file used during kGraft patch development
Group: System/Kernel
Provides: klp-symbols = %version
-%description livepatch-devel
+%description %{livepatch}-devel
This package brings a file named Symbols.list, which contains a list of all
kernel symbols and its respective kernel object . This list is to be used by
the klp-convert tool, which helps livepatch developers by enabling automatic
symbol resolution.
-%files livepatch-devel
+%files %{livepatch}-devel
%defattr(-, root, root)
%dir %obj_install_dir
%dir %obj_install_dir/%cpu_arch
diff --git a/rpm/kernel-module-subpackage b/rpm/kernel-module-subpackage
index 1f0e900719..5bee387b47 100644
--- a/rpm/kernel-module-subpackage
+++ b/rpm/kernel-module-subpackage
@@ -75,7 +75,7 @@ fi
%{?regenerate_initrd_posttrans}
%preun -n %{-n*}-kmp-%1
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
-rpm -ql $nvr | sed -n '/\.ko$/p' > /var/run/rpm-$nvr-modules
+rpm -ql $nvr | sed -n '/\.ko\(\.xz\)\?$/p' > /var/run/rpm-$nvr-modules
%postun -n %{-n*}-kmp-%1
nvr=%{-n*}-kmp-%1-%_this_kmp_version-%{-r*}
modules=( $(cat /var/run/rpm-$nvr-modules) )
diff --git a/rpm/kernel-obs-build.spec.in b/rpm/kernel-obs-build.spec.in
index 91ad608e44..9d68deb489 100644
--- a/rpm/kernel-obs-build.spec.in
+++ b/rpm/kernel-obs-build.spec.in
@@ -136,7 +136,7 @@ ROOT=""
%ifarch %arm
%define kernel_name zImage
%endif
-%ifarch aarch64
+%ifarch aarch64 riscv64
%define kernel_name Image
%endif
diff --git a/rpm/kernel-subpackage-build b/rpm/kernel-subpackage-build
index 6fcf94daca..ccb08d1903 100644
--- a/rpm/kernel-subpackage-build
+++ b/rpm/kernel-subpackage-build
@@ -58,9 +58,7 @@ cat kernel-ghost.flist | while read ghost ; do
ln -s $ghost-$KREL $RPM_BUILD_ROOT$ghost
;;
/boot/vmlinux-$KREL)
- [ -f /boot/vmlinux-$KREL.gz ] && gunzip -dc < /boot/vmlinux-$KREL.gz > vmlinux-$KREL
- size="$(ls -l vmlinux-$KREL | sed -e 's/^\([^ ]* \)\{4\}//' -e 's/ .*//')"
- dd if=/dev/zero bs=1 count=1 seek="$(expr $size - 1)" of=$RPM_BUILD_ROOT$ghost
+ [ -f /boot/vmlinux-$KREL.gz ] && touch vmlinux-$KREL
;;
/boot/initrd-$KREL | /boot/initrd-$KREL-kdump)
# Create a dummy initrd with roughly the size the real one will have.
diff --git a/rpm/klp-symbols b/rpm/klp-symbols
index c108030a9e..07580f8170 100755
--- a/rpm/klp-symbols
+++ b/rpm/klp-symbols
@@ -30,8 +30,13 @@ if ! test -f "$VMLINUX" ; then
fi
if ! test -d "$MODVER_DIR" ; then
- echo "Error: Directory does not exist: $MODVER_DIR" >&2
- exit 1
+ # kernel >= 5.3 has *.mod in the build tree
+ mod_cnt=$(find "$KERNEL_BUILD_DIR" -name '*.mod' | wc -l)
+ if [ $mod_cnt -eq 0 ]; then
+ echo "Error: Directory does not exist: $MODVER_DIR" >&2
+ exit 1
+ fi
+ MODVER_DIR="$KERNEL_BUILD_DIR"
fi
get_symbols()
@@ -44,8 +49,13 @@ echo "*vmlinux" >> "$KLP_SYMBOLS"
get_symbols "$VMLINUX" >> "$KLP_SYMBOLS"
find "$MODVER_DIR" -iname '*.mod' | while read KMOD ; do
- # read .ko path and file from .mod file
- KO_FILE="$(head -n1 $KMOD)"
+ if [ "$MODVER_DIR" = "$KERNEL_BUILD_DIR" ]; then
+ # kernel >= 5.3, just replace the suffix
+ KO_FILE="${KMOD%.mod}.ko"
+ else
+ # kernel <= 5.2, read .ko path and file from .mod file
+ KO_FILE="$(head -n1 $KMOD)"
+ fi
# obtain module name and its object file by processing .ko file name
NO_SUFFIX="$(basename -s .ko $KO_FILE)"
diff --git a/rpm/macros.kernel-source b/rpm/macros.kernel-source
index 1e69532597..b06448bfd1 100644
--- a/rpm/macros.kernel-source
+++ b/rpm/macros.kernel-source
@@ -1,6 +1,6 @@
# A few cross-distro definitions:
%kernel_module_package_release 1
-%kernel_module_package_buildreqs modutils kernel-syms
+%kernel_module_package_buildreqs modutils kernel-syms kmod-compat
%cpu_arch %(case %_target_cpu in \
# from rpm --eval '%ix86' \
@@ -31,6 +31,9 @@ esac)
(armv*) \
echo "arm" \
;; \
+ (riscv*) \
+ echo "riscv" \
+ ;;
(*) \
echo "%cpu_arch" \
;; \
diff --git a/rpm/mergedep b/rpm/mergedep
index f1e7994d0a..c0ca85a829 100755
--- a/rpm/mergedep
+++ b/rpm/mergedep
@@ -7,10 +7,12 @@ cat /lib/modules/$KREL/modules.softdep | grep : | sed -e 's/^softdep //' -e 's/
| \
while read l ; do
MOD=$(echo "$l" | sed -e 's/:.*//')
+ MOD=$(basename $MOD .xz)
MOD=$(basename $MOD .ko)
DEPS="$(echo "$l" | sed -e 's/.*://')"
moddeps=""
for dep in $DEPS ; do
+ dep=$(basename $dep .xz)
dep=$(basename $dep .ko)
moddeps="$moddeps $dep"
done
diff --git a/rpm/mkspec b/rpm/mkspec
index 4467462c44..b18845cf2d 100755
--- a/rpm/mkspec
+++ b/rpm/mkspec
@@ -37,6 +37,20 @@ my @kmps = read_kmps();
my %vars = parse_config_sh();
my ($srcversion, $variant, $vanilla_only) =
($vars{'SRCVERSION'}, $vars{'VARIANT'}, $vars{'VANILLA_ONLY'});
+my $compress_modules = 'none';
+my $build_dtbs = ();
+my $livepatch = "";
+if (defined($vars{'COMPRESS_MODULES'})) {
+ $compress_modules = $vars{'COMPRESS_MODULES'};
+}
+if (defined($vars{'BUILD_DTBS'})) {
+ $build_dtbs = $vars{'BUILD_DTBS'};
+ $build_dtbs = () if $build_dtbs =~ /^(0+|no|false)$/i;
+}
+if (defined($vars{'LIVEPATCH'})) {
+ $livepatch = $vars{'LIVEPATCH'};
+ $livepatch = "" if $livepatch =~ /^(0+|no|none)$/i;
+}
$vanilla_only ||= "0";
if (!defined ($rpmrelease)) {
$rpmrelease = $vars{'RELEASE'} || 0;
@@ -76,7 +90,8 @@ my $scripts = join(",", grep { is_script($_) }
my $tarball_url;
if ($srcversion =~ /^(\d+)(?:\.\d+)*(-rc\d+)?$/) {
$tarball_url = "http://www.kernel.org/pub/linux/kernel/v$1.x/";
- $tarball_url .= "testing/" if $2;
+ $tarball_url = "" if $2; # kernel.org has no tarballs for rc kernels
+ # rc tarballs only available from git as https://git.kernel.org/torvalds/t/linux-*.gz
} else {
# kernel.org has no tarballs for linux-next or vanilla snapshots
$tarball_url = "";
@@ -99,7 +114,9 @@ my %macros = (
NOSOURCE => $nosource,
UNPACK_PATCHES => $unpack_patches,
SCRIPTS => $scripts,
+ LIVEPATCH => $livepatch,
YEAR => (localtime time)[5] + 1900,
+ COMPRESS_MODULES => $compress_modules,
);
# binary spec files
@@ -204,7 +221,7 @@ if (!$variant) {
}
# dtb-*.spec
-if (!$variant) {
+if (!$variant && $build_dtbs) {
do_spec('dtb', "dtb.spec.in", %macros);
print "./mkspec-dtb $all_archs\n";
system("./mkspec-dtb $all_archs\n");
diff --git a/rpm/mkspec-dtb b/rpm/mkspec-dtb
index 504e191118..92ca10ab60 100755
--- a/rpm/mkspec-dtb
+++ b/rpm/mkspec-dtb
@@ -83,6 +83,11 @@ my @aarch64_package_list = (
['dtb-zte', 'zte/*.dts', "ZTE based arm64 systems"],
);
+# DTB packages names
+my @riscv64_package_list = (
+ ['dtb-sifive', 'sifive/*.dts', "SiFive based riscv64 systems"],
+);
+
sub generate_spec($$$)
{
my ($main_package, $exclusive_arch, $package_list) = @_;
@@ -103,6 +108,8 @@ sub generate_spec($$$)
my $DTS_folder = "arch/arm/boot/dts";
if ($exclusive_arch =~ /aarch64/) {
$DTS_folder = "arch/arm64/boot/dts";
+ } elsif ($exclusive_arch =~ /riscv64/) {
+ $DTS_folder = "arch/riscv/boot/dts";
}
foreach my $NAME (@$package_list) {
@@ -155,7 +162,7 @@ sub generate_spec($$$)
}
$subpkg_files .=
- "%ifarch aarch64\n" .
+ "%ifarch aarch64 riscv64\n" .
"%files -n $PKG_NAME -f $PKG_NAME.list\n" .
"%else\n" .
"%files -n $PKG_NAME\n" .
@@ -195,3 +202,6 @@ generate_spec('dtb-armv6l', "armv6l armv6hl", \@armv6l_package_list);
if ( grep( /aarch64/, @ARGV)) {
generate_spec('dtb-aarch64', "aarch64", \@aarch64_package_list);
}
+if ( grep( /riscv64/, @ARGV)) {
+generate_spec('dtb-riscv64', "riscv64", \@riscv64_package_list);
+}
diff --git a/rpm/modflist b/rpm/modflist
index 476b541c67..62d8f3a08f 100755
--- a/rpm/modflist
+++ b/rpm/modflist
@@ -6,5 +6,5 @@ mod_builtin=$4
while read MOD ; do
[ -n "$MOD" ] || continue
- cat $flist | grep /$MOD[.]ko\$ >> $output || { grep -q /$MOD[.]ko\$ $mod_builtin && echo Module $MOD built-in ;} || echo Module $MOD missing
+ cat $flist | grep -E "/$MOD[.]ko([.]xz)?\$" >> $output || { grep -q /$MOD[.]ko\$ $mod_builtin && echo Module $MOD built-in ;} || echo Module $MOD missing
done < $modules
diff --git a/rpm/preun.sh b/rpm/preun.sh
index 7d1a2708c5..005cb95b74 100644
--- a/rpm/preun.sh
+++ b/rpm/preun.sh
@@ -1,4 +1,4 @@
if [ @BASE_PACKAGE@ = 0 ]; then
nvr=@SUBPACKAGE@-@RPM_VERSION_RELEASE@
- rpm -ql $nvr | grep '\.ko$' > /var/run/rpm-$nvr-modules
+ rpm -ql $nvr | grep '\.ko\(\.xz\)\?$' > /var/run/rpm-$nvr-modules
fi
diff --git a/rpm/split-modules b/rpm/split-modules
index ecb967e921..329b110342 100755
--- a/rpm/split-modules
+++ b/rpm/split-modules
@@ -59,8 +59,8 @@ trap 'rm -rf "$tmp"' EXIT
tmp=$(mktemp -d)
mkdir "$tmp/empty"
-find "$opt_dir" -type f -name '*.ko' -printf '/%P\n' | \
- awk -F/ '{ n=$NF; gsub(/-/, "_", n); sub(/\.ko$/, "", n); print n " " $0; }' | \
+find "$opt_dir" -type f \( -name '*.ko' -o -name '*.ko.xz' \) -printf '/%P\n' | \
+ awk -F/ '{ n=$NF; gsub(/-/, "_", n); sub(/\.ko(\.xz)?$/, "", n); print n " " $0; }' | \
sort >"$tmp/all"
err=false
@@ -101,7 +101,7 @@ ifdef EXPLAIN
@for dep in $^; do echo "$$dep needed by $@"; done >> $(EXPLAIN)
endif
'
- sed -r 's:[^ ]*/([^/]*)\.ko\>:\1:g; y/-/_/' "$modules_dep"
+ sed -r 's:[^ ]*/([^/]*)\.ko(.xz)?\>:\1:g; y/-/_/' "$modules_dep"
) >"$tmp/dep"
add_dependent_modules()
diff --git a/scripts/git_sort/git_sort.py b/scripts/git_sort/git_sort.py
index c521dfbcfa..c63a7f318c 100755
--- a/scripts/git_sort/git_sort.py
+++ b/scripts/git_sort/git_sort.py
@@ -241,6 +241,8 @@ remotes = (
Head(RepoURL("rafael/linux-pm.git")),
Head(RepoURL("git://git.cmpxchg.org/linux-mmots.git"), "master"),
Head(RepoURL("git://git.linux-nfs.org/~bfields/linux.git"), "nfsd-next"),
+ Head(RepoURL("vkoul/soundwire.git"),"fixes"),
+ Head(RepoURL("vkoul/soundwire.git"),"next"),
)
diff --git a/scripts/install-git-hooks b/scripts/install-git-hooks
index 69bebc942f..5c261fa71f 100755
--- a/scripts/install-git-hooks
+++ b/scripts/install-git-hooks
@@ -101,10 +101,10 @@ clean_config()
! git config --local --get-all "include.path" | \
grep -q "../extra-gitconfig"; then
if git config --local --get "merge.rpm-changes.name" >/dev/null; then
- git config --local --remove_section "merge.rpm-changes"
+ git config --local --remove-section "merge.rpm-changes"
fi
if git config --local --get "diff.symsets.textconv" >/dev/null; then
- git config --local --remove_section "diff.symsets"
+ git config --local --remove-section "diff.symsets"
fi
git config --add "include.path" "../extra-gitconfig"
fi
diff --git a/series.conf b/series.conf
index b6e2d050fd..c826e485ee 100644
--- a/series.conf
+++ b/series.conf
@@ -23331,10 +23331,12 @@
patches.suse/scsi-qla2xxx-Fix-a-small-typo-in-qla_bsg.c.patch
patches.suse/scsi-qla4xxx-avoid-freeing-unallocated-dma-memory
patches.suse/scsi-qla2xxx-Simplify-conditional-check-again.patch
+ patches.suse/scsi-qedf-Modify-abort-and-tmf-handler-to-handle-edg.patch
patches.suse/scsi-qedf-check-for-link-state-before-processing-ll2-packets-and-send-fipvlan-retries
patches.suse/scsi-qedf-missing-kref_put-in-qedf_xmit.patch
patches.suse/scsi-qedf-fixup-locking-in-qedf_restart_rport.patch
patches.suse/scsi-qedf-fixup-bit-operations.patch
+ patches.suse/scsi-qedf-fc_rport_priv-reference-counting-fixes.patch
patches.suse/scsi-qedf-check-both-the-fcf-and-fabric-id-before-servicing-clear-virtual-link
patches.suse/scsi-qla2xxx-Set-the-SCSI-command-result-before-call.patch
patches.suse/scsi-qla2xxx-Set-the-qpair-in-SRB-to-NULL-when-SRB-i.patch
@@ -24936,6 +24938,7 @@
patches.suse/scsi-lpfc-Fix-propagation-of-devloss_tmo-setting-to-.patch
patches.suse/scsi-qla2xxx-Fix-a-recently-introduced-kernel-warnin.patch
patches.suse/scsi-qla2xxx-fix-spelling-mistake-initializatin-init.patch
+ patches.suse/scsi-lpfc-Remove-bg-debugfs-buffers.patch
patches.suse/scsi-qedf-print-message-during-bailout-conditions
patches.suse/scsi-qedf-stop-sending-fipvlan-request-on-unload
patches.suse/scsi-qedf-update-module-description-string
@@ -25572,6 +25575,7 @@
patches.kabi/bt_accept_enqueue-kabi-workaround.patch
patches.kabi/mwifiex-ieee-types-kabi-fix.patch
patches.suse/libertas-fix-a-potential-NULL-pointer-dereference.patch
+ patches.suse/rtlwifi-Fix-potential-overflow-on-P2P-code.patch
########################################################
# ISDN
@@ -25940,6 +25944,10 @@
patches.kabi/Fix-KVM-kABI-after-x86-mmu-backports.patch
patches.kabi/Fix-AMD-IOMMU-kABI.patch
+ # bsc#1145099
+ patches.suse/vhost_net-conditionally-enable-tx-polling.patch
+ patches.suse/tuntap-correctly-set-SOCKWQ_ASYNC_NOSPACE.patch
+
########################################################
# You'd better have a good reason for adding a patch
# below here.