From: Greg Kroah-Hartman Date: Wed, 20 Mar 2019 17:25:22 +0000 (+0100) Subject: 3.18-stable patches X-Git-Tag: v3.18.137~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5e0829c0a486aceeb62dfcefbca600936f206166;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: cifs-fix-read-after-write-for-files-with-read-caching.patch --- diff --git a/queue-3.18/cifs-fix-read-after-write-for-files-with-read-caching.patch b/queue-3.18/cifs-fix-read-after-write-for-files-with-read-caching.patch new file mode 100644 index 00000000000..83c5a200141 --- /dev/null +++ b/queue-3.18/cifs-fix-read-after-write-for-files-with-read-caching.patch @@ -0,0 +1,54 @@ +From 6dfbd84684700cb58b34e8602c01c12f3d2595c8 Mon Sep 17 00:00:00 2001 +From: Pavel Shilovsky +Date: Mon, 4 Mar 2019 17:48:01 -0800 +Subject: CIFS: Fix read after write for files with read caching + +From: Pavel Shilovsky + +commit 6dfbd84684700cb58b34e8602c01c12f3d2595c8 upstream. + +When we have a READ lease for a file and have just issued a write +operation to the server we need to purge the cache and set oplock/lease +level to NONE to avoid reading stale data. Currently we do that +only if a write operation succedeed thus not covering cases when +a request was sent to the server but a negative error code was +returned later for some other reasons (e.g. -EIOCBQUEUED or -EINTR). +Fix this by turning off caching regardless of the error code being +returned. + +The patches fixes generic tests 075 and 112 from the xfs-tests. + +Cc: +Signed-off-by: Pavel Shilovsky +Signed-off-by: Steve French +Reviewed-by: Ronnie Sahlberg +Signed-off-by: Greg Kroah-Hartman + +--- + fs/cifs/file.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/fs/cifs/file.c ++++ b/fs/cifs/file.c +@@ -2772,14 +2772,16 @@ cifs_strict_writev(struct kiocb *iocb, s + * these pages but not on the region from pos to ppos+len-1. + */ + written = cifs_user_writev(iocb, from); +- if (written > 0 && CIFS_CACHE_READ(cinode)) { ++ if (CIFS_CACHE_READ(cinode)) { + /* +- * Windows 7 server can delay breaking level2 oplock if a write +- * request comes - break it on the client to prevent reading +- * an old data. ++ * We have read level caching and we have just sent a write ++ * request to the server thus making data in the cache stale. ++ * Zap the cache and set oplock/lease level to NONE to avoid ++ * reading stale data from the cache. All subsequent read ++ * operations will read new data from the server. + */ + cifs_zap_mapping(inode); +- cifs_dbg(FYI, "Set no oplock for inode=%p after a write operation\n", ++ cifs_dbg(FYI, "Set Oplock/Lease to NONE for inode=%p after write\n", + inode); + cinode->oplock = 0; + } diff --git a/queue-3.18/net-set-static-variable-an-initial-value-in-atl2_pro.patch b/queue-3.18/net-set-static-variable-an-initial-value-in-atl2_pro.patch index 8fe84ad5f05..72fce8f49f5 100644 --- a/queue-3.18/net-set-static-variable-an-initial-value-in-atl2_pro.patch +++ b/queue-3.18/net-set-static-variable-an-initial-value-in-atl2_pro.patch @@ -13,14 +13,12 @@ Signed-off-by: Mao Wenan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- - drivers/net/ethernet/atheros/atlx/atl2.c | 4 +--- + drivers/net/ethernet/atheros/atlx/atl2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c -index 5086ec9214c3..ceae4d56105d 100644 --- a/drivers/net/ethernet/atheros/atlx/atl2.c +++ b/drivers/net/ethernet/atheros/atlx/atl2.c -@@ -1338,13 +1338,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +@@ -1338,13 +1338,11 @@ static int atl2_probe(struct pci_dev *pd { struct net_device *netdev; struct atl2_adapter *adapter; @@ -35,6 +33,3 @@ index 5086ec9214c3..ceae4d56105d 100644 err = pci_enable_device(pdev); if (err) return err; --- -2.19.1 - diff --git a/queue-3.18/series b/queue-3.18/series index c127cb35eed..d53ed6e43ad 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -108,3 +108,4 @@ arm64-relax-gic-version-check-during-early-boot.patch net-marvell-mvneta-fix-dma-debug-warning.patch tmpfs-fix-link-accounting-when-a-tmpfile-is-linked-i.patch net-set-static-variable-an-initial-value-in-atl2_pro.patch +cifs-fix-read-after-write-for-files-with-read-caching.patch