--- /dev/null
- @@ -1815,6 +1815,7 @@ static void nfs_commit_done(struct rpc_t
+From 221203ce6406273cf00e5c6397257d986c003ee6 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trondmy@gmail.com>
+Date: Mon, 6 Jan 2020 15:25:04 -0500
+Subject: NFS/pnfs: Fix pnfs_generic_prepare_to_resend_writes()
+
+From: Trond Myklebust <trondmy@gmail.com>
+
+commit 221203ce6406273cf00e5c6397257d986c003ee6 upstream.
+
+Instead of making assumptions about the commit verifier contents, change
+the commit code to ensure we always check that the verifier was set
+by the XDR code.
+
+Fixes: f54bcf2ecee9 ("pnfs: Prepare for flexfiles by pulling out common code")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/direct.c | 4 ++--
+ fs/nfs/nfs3xdr.c | 5 ++++-
+ fs/nfs/nfs4xdr.c | 5 ++++-
+ fs/nfs/pnfs_nfs.c | 7 +++----
+ fs/nfs/write.c | 4 +++-
+ 5 files changed, 16 insertions(+), 9 deletions(-)
+
+--- a/fs/nfs/direct.c
++++ b/fs/nfs/direct.c
+@@ -261,10 +261,10 @@ static int nfs_direct_cmp_commit_data_ve
+ data->ds_commit_index);
+
+ /* verifier not set so always fail */
+- if (verfp->committed < 0)
++ if (verfp->committed < 0 || data->res.verf->committed <= NFS_UNSTABLE)
+ return 1;
+
+- return nfs_direct_cmp_verf(verfp, &data->verf);
++ return nfs_direct_cmp_verf(verfp, data->res.verf);
+ }
+
+ /**
+--- a/fs/nfs/nfs3xdr.c
++++ b/fs/nfs/nfs3xdr.c
+@@ -2373,6 +2373,7 @@ static int nfs3_xdr_dec_commit3res(struc
+ void *data)
+ {
+ struct nfs_commitres *result = data;
++ struct nfs_writeverf *verf = result->verf;
+ enum nfs_stat status;
+ int error;
+
+@@ -2385,7 +2386,9 @@ static int nfs3_xdr_dec_commit3res(struc
+ result->op_status = status;
+ if (status != NFS3_OK)
+ goto out_status;
+- error = decode_writeverf3(xdr, &result->verf->verifier);
++ error = decode_writeverf3(xdr, &verf->verifier);
++ if (!error)
++ verf->committed = NFS_FILE_SYNC;
+ out:
+ return error;
+ out_status:
+--- a/fs/nfs/nfs4xdr.c
++++ b/fs/nfs/nfs4xdr.c
+@@ -4409,11 +4409,14 @@ static int decode_write_verifier(struct
+
+ static int decode_commit(struct xdr_stream *xdr, struct nfs_commitres *res)
+ {
++ struct nfs_writeverf *verf = res->verf;
+ int status;
+
+ status = decode_op_hdr(xdr, OP_COMMIT);
+ if (!status)
+- status = decode_write_verifier(xdr, &res->verf->verifier);
++ status = decode_write_verifier(xdr, &verf->verifier);
++ if (!status)
++ verf->committed = NFS_FILE_SYNC;
+ return status;
+ }
+
+--- a/fs/nfs/pnfs_nfs.c
++++ b/fs/nfs/pnfs_nfs.c
+@@ -30,12 +30,11 @@ EXPORT_SYMBOL_GPL(pnfs_generic_rw_releas
+ /* Fake up some data that will cause nfs_commit_release to retry the writes. */
+ void pnfs_generic_prepare_to_resend_writes(struct nfs_commit_data *data)
+ {
+- struct nfs_page *first = nfs_list_entry(data->pages.next);
++ struct nfs_writeverf *verf = data->res.verf;
+
+ data->task.tk_status = 0;
+- memcpy(&data->verf.verifier, &first->wb_verf,
+- sizeof(data->verf.verifier));
+- data->verf.verifier.data[0]++; /* ensure verifier mismatch */
++ memset(&verf->verifier, 0, sizeof(verf->verifier));
++ verf->committed = NFS_UNSTABLE;
+ }
+ EXPORT_SYMBOL_GPL(pnfs_generic_prepare_to_resend_writes);
+
+--- a/fs/nfs/write.c
++++ b/fs/nfs/write.c
- @@ -1841,7 +1842,8 @@ static void nfs_commit_release_pages(str
++@@ -1807,6 +1807,7 @@ static void nfs_commit_done(struct rpc_t
+
+ static void nfs_commit_release_pages(struct nfs_commit_data *data)
+ {
++ const struct nfs_writeverf *verf = data->res.verf;
+ struct nfs_page *req;
+ int status = data->task.tk_status;
+ struct nfs_commit_info cinfo;
++@@ -1833,7 +1834,8 @@ static void nfs_commit_release_pages(str
+
+ /* Okay, COMMIT succeeded, apparently. Check the verifier
+ * returned by the server against all stored verfs. */
+- if (!nfs_write_verifier_cmp(&req->wb_verf, &data->verf.verifier)) {
++ if (verf->committed > NFS_UNSTABLE &&
++ !nfs_write_verifier_cmp(&req->wb_verf, &verf->verifier)) {
+ /* We have a match */
+ if (req->wb_page)
+ nfs_inode_remove_request(req);
--- /dev/null
- drivers/tty/serial/xilinx_uartps.c | 14 ++++++++++----
+ From 28e9b4cd255e3bbb49f0dd6e1fc234e76d046c03 Mon Sep 17 00:00:00 2001
+ From: Sasha Levin <sashal@kernel.org>
+ Date: Mon, 10 Feb 2020 10:18:25 -0700
+ Subject: serial: uartps: Add a timeout to the tx empty wait
+
+ From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
+
+ [ Upstream commit 277375b864e8147975b064b513f491e2a910e66a ]
+
+ In case the cable is not connected then the target gets into
+ an infinite wait for tx empty.
+ Add a timeout to the tx empty wait.
+
+ Reported-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
+ Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+ Signed-off-by: Sasha Levin <sashal@kernel.org>
+ ---
-diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
-index 0dbfd02e3b196..9826a15bfd871 100644
++ drivers/tty/serial/xilinx_uartps.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
-@@ -685,16 +687,20 @@ static void cdns_uart_set_termios(struct uart_port *port,
+ --- a/drivers/tty/serial/xilinx_uartps.c
+ +++ b/drivers/tty/serial/xilinx_uartps.c
+ @@ -31,6 +31,7 @@
+ #include <linux/of.h>
+ #include <linux/module.h>
+ #include <linux/pm_runtime.h>
+ +#include <linux/iopoll.h>
+
+ #define CDNS_UART_TTY_NAME "ttyPS"
+ #define CDNS_UART_NAME "xuartps"
+ @@ -39,6 +40,7 @@
+ #define CDNS_UART_NR_PORTS 2
+ #define CDNS_UART_FIFO_SIZE 64 /* FIFO size */
+ #define CDNS_UART_REGISTER_SPACE 0x1000
+ +#define TX_TIMEOUT 500000
+
+ /* Rx Trigger level */
+ static int rx_trigger_level = 56;
---
-2.20.1
-
++@@ -685,16 +687,20 @@ static void cdns_uart_set_termios(struct
+ unsigned int cval = 0;
+ unsigned int baud, minbaud, maxbaud;
+ unsigned long flags;
+ - unsigned int ctrl_reg, mode_reg;
+ + unsigned int ctrl_reg, mode_reg, val;
+ + int err;
+
+ spin_lock_irqsave(&port->lock, flags);
+
+ /* Wait for the transmit FIFO to empty before making changes */
+ if (!(readl(port->membase + CDNS_UART_CR) &
+ CDNS_UART_CR_TX_DIS)) {
+ - while (!(readl(port->membase + CDNS_UART_SR) &
+ - CDNS_UART_SR_TXEMPTY)) {
+ - cpu_relax();
+ + err = readl_poll_timeout(port->membase + CDNS_UART_SR,
+ + val, (val & CDNS_UART_SR_TXEMPTY),
+ + 1000, TX_TIMEOUT);
+ + if (err) {
+ + dev_err(port->dev, "timed out waiting for tx empty");
+ + return;
+ }
+ }
+
rxrpc-fix-service-call-disconnection.patch
asoc-pcm-update-fe-be-trigger-order-based-on-the-com.patch
hv_sock-remove-the-accept-port-restriction.patch
- nfs-revalidate-the-file-size-on-a-fatal-write-error.patch
+rdma-netlink-do-not-always-generate-an-ack-for-some-netlink-operations.patch
+scsi-ufs-fix-ufshcd_probe_hba-reture-value-in-case-ufshcd_scsi_add_wlus-fails.patch
+pci-switchtec-fix-vep_vector_number-ioread-width.patch
+pci-don-t-disable-bridge-bars-when-assigning-bus-resources.patch
+nfs-nfs_swap-should-depend-on-swap.patch
+nfs-pnfs-fix-pnfs_generic_prepare_to_resend_writes.patch
+nfsv4-try-lease-recovery-on-nfs4err_expired.patch
+ serial-uartps-add-a-timeout-to-the-tx-empty-wait.patch
asoc-pcm-update-fe-be-trigger-order-based-on-the-com.patch
hv_sock-remove-the-accept-port-restriction.patch
+ib-mlx4-fix-memory-leak-in-add_gid-error-flow.patch
+rdma-netlink-do-not-always-generate-an-ack-for-some-netlink-operations.patch
+rdma-core-fix-locking-in-ib_uverbs_event_read.patch
+rdma-uverbs-verify-mr-access-flags.patch
+scsi-ufs-fix-ufshcd_probe_hba-reture-value-in-case-ufshcd_scsi_add_wlus-fails.patch
+pci-iov-fix-memory-leak-in-pci_iov_add_virtfn.patch
+ath10k-pci-only-dump-ath10k_mem_region_type_ioreg-when-safe.patch
+pci-switchtec-fix-vep_vector_number-ioread-width.patch
+pci-don-t-disable-bridge-bars-when-assigning-bus-resources.patch
+nfs-nfs_swap-should-depend-on-swap.patch
+nfs-revalidate-the-file-size-on-a-fatal-write-error.patch
+nfs-pnfs-fix-pnfs_generic_prepare_to_resend_writes.patch
+nfsv4-try-lease-recovery-on-nfs4err_expired.patch
+ serial-uartps-add-a-timeout-to-the-tx-empty-wait.patch
+ gpio-zynq-report-gpio-direction-at-boot.patch
+ spi-spi-mem-add-extra-sanity-checks-on-the-op-param.patch
+ spi-spi-mem-fix-inverted-logic-in-op-sanity-check.patch
asoc-pcm-update-fe-be-trigger-order-based-on-the-com.patch
hv_sock-remove-the-accept-port-restriction.patch
+ib-mlx4-fix-memory-leak-in-add_gid-error-flow.patch
+ib-srp-never-use-immediate-data-if-it-is-disabled-by-a-user.patch
+ib-mlx4-fix-leak-in-id_map_find_del.patch
+rdma-netlink-do-not-always-generate-an-ack-for-some-netlink-operations.patch
+rdma-i40iw-fix-a-potential-null-pointer-dereference.patch
+rdma-core-fix-locking-in-ib_uverbs_event_read.patch
+rdma-uverbs-verify-mr-access-flags.patch
+rdma-cma-fix-unbalanced-cm_id-reference-count-during-address-resolve.patch
+rdma-umem-fix-ib_umem_find_best_pgsz.patch
+scsi-ufs-fix-ufshcd_probe_hba-reture-value-in-case-ufshcd_scsi_add_wlus-fails.patch
+pci-iov-fix-memory-leak-in-pci_iov_add_virtfn.patch
+ath10k-pci-only-dump-ath10k_mem_region_type_ioreg-when-safe.patch
+pci-switchtec-use-dma_set_mask_and_coherent.patch
+pci-switchtec-fix-vep_vector_number-ioread-width.patch
+pci-tegra-fix-afi_pex2_ctrl-reg-offset-for-tegra30.patch
+pci-don-t-disable-bridge-bars-when-assigning-bus-resources.patch
+pci-aer-initialize-aer_fifo.patch
+iwlwifi-mvm-avoid-use-after-free-for-pmsr-request.patch
+nfsd-fixing-possible-null-pointer-derefering-in-copy-offload.patch
+nfs-nfs_swap-should-depend-on-swap.patch
+nfs-revalidate-the-file-size-on-a-fatal-write-error.patch
+nfs-pnfs-fix-pnfs_generic_prepare_to_resend_writes.patch
+nfs-fix-fix-of-show_nfs_errors.patch
+nfsv4-pnfs_roc-must-use-cred_fscmp-to-compare-creds.patch
+nfsv4-try-lease-recovery-on-nfs4err_expired.patch
+nfsv4.0-nfs4_do_fsinfo-should-not-do-implicit-lease-renewals.patch
+ x86-boot-handle-malformed-srat-tables-during-early-a.patch
+ib-mlx4-fix-memory-leak-in-add_gid-error-flow.patch
+ib-srp-never-use-immediate-data-if-it-is-disabled-by-a-user.patch
+ib-mlx5-return-the-administrative-guid-if-exists.patch
+ib-mlx4-fix-leak-in-id_map_find_del.patch
+rdma-netlink-do-not-always-generate-an-ack-for-some-netlink-operations.patch
+rdma-i40iw-fix-a-potential-null-pointer-dereference.patch
+rdma-core-fix-locking-in-ib_uverbs_event_read.patch
+rdma-uverbs-verify-mr-access-flags.patch
+rdma-mlx5-fix-handling-of-iova-user_va-in-odp-paths.patch
+rdma-core-ensure-that-rdma_user_mmap_entry_remove-is-a-fence.patch
+rdma-cma-fix-unbalanced-cm_id-reference-count-during-address-resolve.patch
+rdma-umem-fix-ib_umem_find_best_pgsz.patch
+scsi-ufs-fix-ufshcd_probe_hba-reture-value-in-case-ufshcd_scsi_add_wlus-fails.patch
+pci-iov-fix-memory-leak-in-pci_iov_add_virtfn.patch
+ath10k-pci-only-dump-ath10k_mem_region_type_ioreg-when-safe.patch
+pci-switchtec-use-dma_set_mask_and_coherent.patch
+pci-switchtec-fix-vep_vector_number-ioread-width.patch
+pci-tegra-fix-afi_pex2_ctrl-reg-offset-for-tegra30.patch
+pci-don-t-disable-bridge-bars-when-assigning-bus-resources.patch
+pci-aer-initialize-aer_fifo.patch
+iwlwifi-mvm-avoid-use-after-free-for-pmsr-request.patch
+iwlwifi-mvm-fix-tdls-discovery-with-the-new-firmware-api.patch
+netfilter-flowtable-fetch-stats-only-if-flow-is-still-alive.patch
+netfilter-flowtable-restrict-flow-dissector-match-on-meta-ingress-device.patch
+netfilter-flowtable-fix-hardware-flush-order-on-nf_flow_table_cleanup.patch
+netfilter-flowtable-fix-missing-flush-hardware-on-table-free.patch
+nfsd-fixing-possible-null-pointer-derefering-in-copy-offload.patch
+nfsv4.x-recover-from-pre-mature-loss-of-openstateid.patch
+nfs-nfs_swap-should-depend-on-swap.patch
+nfs-revalidate-the-file-size-on-a-fatal-write-error.patch
+nfs-pnfs-fix-pnfs_generic_prepare_to_resend_writes.patch
+nfs-fix-fix-of-show_nfs_errors.patch
+nfsv4-pnfs_roc-must-use-cred_fscmp-to-compare-creds.patch
+nfsv4-try-lease-recovery-on-nfs4err_expired.patch
+nfsv4.0-nfs4_do_fsinfo-should-not-do-implicit-lease-renewals.patch
+ x86-boot-handle-malformed-srat-tables-during-early-a.patch