From ebc796b83a28b7370e5cf41d72e8ef22265a7ba5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 23 Jul 2019 12:29:02 +0200 Subject: [PATCH] drop some 4.4 and 4.9 patches that broke the build --- ...et-info-if-we-have-writeable-handles.patch | 61 ---- ...dle-alps-cs19-trackpoint-only-device.patch | 101 ------ ...en-a-condition-check-and-its-comment.patch | 38 --- queue-4.4/series | 3 - ...dle-alps-cs19-trackpoint-only-device.patch | 101 ------ ...en-a-condition-check-and-its-comment.patch | 38 --- ...imization-by-cache-mechanism-memleak.patch | 287 ------------------ queue-4.9/series | 3 - 8 files changed, 632 deletions(-) delete mode 100644 queue-4.4/cifs-flush-before-set-info-if-we-have-writeable-handles.patch delete mode 100644 queue-4.4/input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch delete mode 100644 queue-4.4/input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch delete mode 100644 queue-4.9/input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch delete mode 100644 queue-4.9/input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch delete mode 100644 queue-4.9/revert-nfs-readdirplus-optimization-by-cache-mechanism-memleak.patch diff --git a/queue-4.4/cifs-flush-before-set-info-if-we-have-writeable-handles.patch b/queue-4.4/cifs-flush-before-set-info-if-we-have-writeable-handles.patch deleted file mode 100644 index c4819e35a2e..00000000000 --- a/queue-4.4/cifs-flush-before-set-info-if-we-have-writeable-handles.patch +++ /dev/null @@ -1,61 +0,0 @@ -From aa081859b10c5d8b19f5c525c78883a59d73c2b8 Mon Sep 17 00:00:00 2001 -From: Ronnie Sahlberg -Date: Fri, 19 Jul 2019 08:12:11 +1000 -Subject: cifs: flush before set-info if we have writeable handles - -From: Ronnie Sahlberg - -commit aa081859b10c5d8b19f5c525c78883a59d73c2b8 upstream. - -Servers can defer destaging any data and updating the mtime until close(). -This means that if we do a setinfo to modify the mtime while other handles -are open for write the server may overwrite our setinfo timestamps when -if flushes the file on close() of the writeable handle. - -To solve this we add an explicit flush when the mtime is about to -be updated. - -This fixes "cp -p" to preserve mtime when copying a file onto an SMB2 share. - -CC: Stable -Signed-off-by: Ronnie Sahlberg -Reviewed-by: Pavel Shilovsky -Signed-off-by: Steve French -Signed-off-by: Greg Kroah-Hartman - ---- - fs/cifs/inode.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - ---- a/fs/cifs/inode.c -+++ b/fs/cifs/inode.c -@@ -2282,6 +2282,8 @@ cifs_setattr_nounix(struct dentry *diren - struct inode *inode = d_inode(direntry); - struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); - struct cifsInodeInfo *cifsInode = CIFS_I(inode); -+ struct cifsFileInfo *wfile; -+ struct cifs_tcon *tcon; - char *full_path = NULL; - int rc = -EACCES; - __u32 dosattr = 0; -@@ -2323,6 +2325,20 @@ cifs_setattr_nounix(struct dentry *diren - mapping_set_error(inode->i_mapping, rc); - rc = 0; - -+ if (attrs->ia_valid & ATTR_MTIME) { -+ rc = cifs_get_writable_file(cifsInode, false, &wfile); -+ if (!rc) { -+ tcon = tlink_tcon(wfile->tlink); -+ rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid); -+ cifsFileInfo_put(wfile); -+ if (rc) -+ return rc; -+ } else if (rc != -EBADF) -+ return rc; -+ else -+ rc = 0; -+ } -+ - if (attrs->ia_valid & ATTR_SIZE) { - rc = cifs_set_file_size(inode, attrs, xid, full_path); - if (rc != 0) diff --git a/queue-4.4/input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch b/queue-4.4/input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch deleted file mode 100644 index 4de49693845..00000000000 --- a/queue-4.4/input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 7e4935ccc3236751e5fe4bd6846f86e46bb2e427 Mon Sep 17 00:00:00 2001 -From: Hui Wang -Date: Mon, 15 Jul 2019 10:00:58 -0700 -Subject: Input: alps - don't handle ALPS cs19 trackpoint-only device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Hui Wang - -commit 7e4935ccc3236751e5fe4bd6846f86e46bb2e427 upstream. - -On a latest Lenovo laptop, the trackpoint and 3 buttons below it -don't work at all, when we move the trackpoint or press those 3 -buttons, the kernel will print out: -"Rejected trackstick packet from non DualPoint device" - -This device is identified as an alps touchpad but the packet has -trackpoint format, so the alps.c drops the packet and prints out -the message above. - -According to XiaoXiao's explanation, this device is named cs19 and -is trackpoint-only device, its firmware is only for trackpoint, it -is independent of touchpad and is a device completely different from -DualPoint ones. - -To drive this device with mininal changes to the existing driver, we -just let the alps driver not handle this device, then the trackpoint.c -will be the driver of this device if the trackpoint driver is enabled. -(if not, this device will fallback to a bare PS/2 device) - -With the trackpoint.c, this trackpoint and 3 buttons all work well, -they have all features that the trackpoint should have, like -scrolling-screen, drag-and-drop and frame-selection. - -Signed-off-by: XiaoXiao Liu -Signed-off-by: Hui Wang -Reviewed-by: Pali Rohár -Cc: stable@vger.kernel.org -Signed-off-by: Dmitry Torokhov -Signed-off-by: Greg Kroah-Hartman - ---- - drivers/input/mouse/alps.c | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - ---- a/drivers/input/mouse/alps.c -+++ b/drivers/input/mouse/alps.c -@@ -24,6 +24,7 @@ - - #include "psmouse.h" - #include "alps.h" -+#include "trackpoint.h" - - /* - * Definitions for ALPS version 3 and 4 command mode protocol -@@ -2715,6 +2716,23 @@ static const struct alps_protocol_info * - return NULL; - } - -+static bool alps_is_cs19_trackpoint(struct psmouse *psmouse) -+{ -+ u8 param[2] = { 0 }; -+ -+ if (ps2_command(&psmouse->ps2dev, -+ param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) -+ return false; -+ -+ /* -+ * param[0] contains the trackpoint device variant_id while -+ * param[1] contains the firmware_id. So far all alps -+ * trackpoint-only devices have their variant_ids equal -+ * TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range. -+ */ -+ return param[0] == TP_VARIANT_ALPS && (param[1] & 0x20); -+} -+ - static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) - { - const struct alps_protocol_info *protocol; -@@ -3002,6 +3020,20 @@ int alps_detect(struct psmouse *psmouse, - return error; - - /* -+ * ALPS cs19 is a trackpoint-only device, and uses different -+ * protocol than DualPoint ones, so we return -EINVAL here and let -+ * trackpoint.c drive this device. If the trackpoint driver is not -+ * enabled, the device will fall back to a bare PS/2 mouse. -+ * If ps2_command() fails here, we depend on the immediately -+ * followed psmouse_reset() to reset the device to normal state. -+ */ -+ if (alps_is_cs19_trackpoint(psmouse)) { -+ psmouse_dbg(psmouse, -+ "ALPS CS19 trackpoint-only device detected, ignoring\n"); -+ return -EINVAL; -+ } -+ -+ /* - * Reset the device to make sure it is fully operational: - * on some laptops, like certain Dell Latitudes, we may - * fail to properly detect presence of trackstick if device diff --git a/queue-4.4/input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch b/queue-4.4/input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch deleted file mode 100644 index d3b6c67ee14..00000000000 --- a/queue-4.4/input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 771a081e44a9baa1991ef011cc453ef425591740 Mon Sep 17 00:00:00 2001 -From: Hui Wang -Date: Fri, 19 Jul 2019 12:38:58 +0300 -Subject: Input: alps - fix a mismatch between a condition check and its comment - -From: Hui Wang - -commit 771a081e44a9baa1991ef011cc453ef425591740 upstream. - -In the function alps_is_cs19_trackpoint(), we check if the param[1] is -in the 0x20~0x2f range, but the code we wrote for this checking is not -correct: -(param[1] & 0x20) does not mean param[1] is in the range of 0x20~0x2f, -it also means the param[1] is in the range of 0x30~0x3f, 0x60~0x6f... - -Now fix it with a new condition checking ((param[1] & 0xf0) == 0x20). - -Fixes: 7e4935ccc323 ("Input: alps - don't handle ALPS cs19 trackpoint-only device") -Cc: stable@vger.kernel.org -Signed-off-by: Hui Wang -Signed-off-by: Dmitry Torokhov -Signed-off-by: Greg Kroah-Hartman - ---- - drivers/input/mouse/alps.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/input/mouse/alps.c -+++ b/drivers/input/mouse/alps.c -@@ -2730,7 +2730,7 @@ static bool alps_is_cs19_trackpoint(stru - * trackpoint-only devices have their variant_ids equal - * TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range. - */ -- return param[0] == TP_VARIANT_ALPS && (param[1] & 0x20); -+ return param[0] == TP_VARIANT_ALPS && ((param[1] & 0xf0) == 0x20); - } - - static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) diff --git a/queue-4.4/series b/queue-4.4/series index 2662fa6dd75..112e89af430 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -60,10 +60,7 @@ floppy-fix-out-of-bounds-read-in-copy_buffer.patch crypto-ghash-fix-unaligned-memory-access-in-ghash_setkey.patch crypto-arm64-sha1-ce-correct-digest-for-empty-data-in-finup.patch crypto-arm64-sha2-ce-correct-digest-for-empty-data-in-finup.patch -cifs-flush-before-set-info-if-we-have-writeable-handles.patch input-gtco-bounds-check-collection-indent-level.patch -input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch -input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch regulator-s2mps11-fix-buck7-and-buck8-wrong-voltages.patch tracing-snapshot-resize-spare-buffer-if-size-changed.patch nfsv4-handle-the-special-linux-file-open-access-mode.patch diff --git a/queue-4.9/input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch b/queue-4.9/input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch deleted file mode 100644 index 60dc73691fc..00000000000 --- a/queue-4.9/input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 7e4935ccc3236751e5fe4bd6846f86e46bb2e427 Mon Sep 17 00:00:00 2001 -From: Hui Wang -Date: Mon, 15 Jul 2019 10:00:58 -0700 -Subject: Input: alps - don't handle ALPS cs19 trackpoint-only device -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Hui Wang - -commit 7e4935ccc3236751e5fe4bd6846f86e46bb2e427 upstream. - -On a latest Lenovo laptop, the trackpoint and 3 buttons below it -don't work at all, when we move the trackpoint or press those 3 -buttons, the kernel will print out: -"Rejected trackstick packet from non DualPoint device" - -This device is identified as an alps touchpad but the packet has -trackpoint format, so the alps.c drops the packet and prints out -the message above. - -According to XiaoXiao's explanation, this device is named cs19 and -is trackpoint-only device, its firmware is only for trackpoint, it -is independent of touchpad and is a device completely different from -DualPoint ones. - -To drive this device with mininal changes to the existing driver, we -just let the alps driver not handle this device, then the trackpoint.c -will be the driver of this device if the trackpoint driver is enabled. -(if not, this device will fallback to a bare PS/2 device) - -With the trackpoint.c, this trackpoint and 3 buttons all work well, -they have all features that the trackpoint should have, like -scrolling-screen, drag-and-drop and frame-selection. - -Signed-off-by: XiaoXiao Liu -Signed-off-by: Hui Wang -Reviewed-by: Pali Rohár -Cc: stable@vger.kernel.org -Signed-off-by: Dmitry Torokhov -Signed-off-by: Greg Kroah-Hartman - ---- - drivers/input/mouse/alps.c | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - ---- a/drivers/input/mouse/alps.c -+++ b/drivers/input/mouse/alps.c -@@ -24,6 +24,7 @@ - - #include "psmouse.h" - #include "alps.h" -+#include "trackpoint.h" - - /* - * Definitions for ALPS version 3 and 4 command mode protocol -@@ -2858,6 +2859,23 @@ static const struct alps_protocol_info * - return NULL; - } - -+static bool alps_is_cs19_trackpoint(struct psmouse *psmouse) -+{ -+ u8 param[2] = { 0 }; -+ -+ if (ps2_command(&psmouse->ps2dev, -+ param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) -+ return false; -+ -+ /* -+ * param[0] contains the trackpoint device variant_id while -+ * param[1] contains the firmware_id. So far all alps -+ * trackpoint-only devices have their variant_ids equal -+ * TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range. -+ */ -+ return param[0] == TP_VARIANT_ALPS && (param[1] & 0x20); -+} -+ - static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) - { - const struct alps_protocol_info *protocol; -@@ -3150,6 +3168,20 @@ int alps_detect(struct psmouse *psmouse, - return error; - - /* -+ * ALPS cs19 is a trackpoint-only device, and uses different -+ * protocol than DualPoint ones, so we return -EINVAL here and let -+ * trackpoint.c drive this device. If the trackpoint driver is not -+ * enabled, the device will fall back to a bare PS/2 mouse. -+ * If ps2_command() fails here, we depend on the immediately -+ * followed psmouse_reset() to reset the device to normal state. -+ */ -+ if (alps_is_cs19_trackpoint(psmouse)) { -+ psmouse_dbg(psmouse, -+ "ALPS CS19 trackpoint-only device detected, ignoring\n"); -+ return -EINVAL; -+ } -+ -+ /* - * Reset the device to make sure it is fully operational: - * on some laptops, like certain Dell Latitudes, we may - * fail to properly detect presence of trackstick if device diff --git a/queue-4.9/input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch b/queue-4.9/input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch deleted file mode 100644 index 88c823d7742..00000000000 --- a/queue-4.9/input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 771a081e44a9baa1991ef011cc453ef425591740 Mon Sep 17 00:00:00 2001 -From: Hui Wang -Date: Fri, 19 Jul 2019 12:38:58 +0300 -Subject: Input: alps - fix a mismatch between a condition check and its comment - -From: Hui Wang - -commit 771a081e44a9baa1991ef011cc453ef425591740 upstream. - -In the function alps_is_cs19_trackpoint(), we check if the param[1] is -in the 0x20~0x2f range, but the code we wrote for this checking is not -correct: -(param[1] & 0x20) does not mean param[1] is in the range of 0x20~0x2f, -it also means the param[1] is in the range of 0x30~0x3f, 0x60~0x6f... - -Now fix it with a new condition checking ((param[1] & 0xf0) == 0x20). - -Fixes: 7e4935ccc323 ("Input: alps - don't handle ALPS cs19 trackpoint-only device") -Cc: stable@vger.kernel.org -Signed-off-by: Hui Wang -Signed-off-by: Dmitry Torokhov -Signed-off-by: Greg Kroah-Hartman - ---- - drivers/input/mouse/alps.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/input/mouse/alps.c -+++ b/drivers/input/mouse/alps.c -@@ -2873,7 +2873,7 @@ static bool alps_is_cs19_trackpoint(stru - * trackpoint-only devices have their variant_ids equal - * TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range. - */ -- return param[0] == TP_VARIANT_ALPS && (param[1] & 0x20); -+ return param[0] == TP_VARIANT_ALPS && ((param[1] & 0xf0) == 0x20); - } - - static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) diff --git a/queue-4.9/revert-nfs-readdirplus-optimization-by-cache-mechanism-memleak.patch b/queue-4.9/revert-nfs-readdirplus-optimization-by-cache-mechanism-memleak.patch deleted file mode 100644 index 9769aaaff8a..00000000000 --- a/queue-4.9/revert-nfs-readdirplus-optimization-by-cache-mechanism-memleak.patch +++ /dev/null @@ -1,287 +0,0 @@ -From db531db951f950b86d274cc8ed7b21b9e2240036 Mon Sep 17 00:00:00 2001 -From: Max Kellermann -Date: Fri, 12 Jul 2019 16:18:06 +0200 -Subject: Revert "NFS: readdirplus optimization by cache mechanism" (memleak) - -From: Max Kellermann - -commit db531db951f950b86d274cc8ed7b21b9e2240036 upstream. - -This reverts commit be4c2d4723a4a637f0d1b4f7c66447141a4b3564. - -That commit caused a severe memory leak in nfs_readdir_make_qstr(). - -When listing a directory with more than 100 files (this is how many -struct nfs_cache_array_entry elements fit in one 4kB page), all -allocated file name strings past those 100 leak. - -The root of the leakage is that those string pointers are managed in -pages which are never linked into the page cache. - -fs/nfs/dir.c puts pages into the page cache by calling -read_cache_page(); the callback function nfs_readdir_filler() will -then fill the given page struct which was passed to it, which is -already linked in the page cache (by do_read_cache_page() calling -add_to_page_cache_lru()). - -Commit be4c2d4723a4 added another (local) array of allocated pages, to -be filled with more data, instead of discarding excess items received -from the NFS server. Those additional pages can be used by the next -nfs_readdir_filler() call (from within the same nfs_readdir() call). - -The leak happens when some of those additional pages are never used -(copied to the page cache using copy_highpage()). The pages will be -freed by nfs_readdir_free_pages(), but their contents will not. The -commit did not invoke nfs_readdir_clear_array() (and doing so would -have been dangerous, because it did not track which of those pages -were already copied to the page cache, risking double free bugs). - -How to reproduce the leak: - -- Use a kernel with CONFIG_SLUB_DEBUG_ON. - -- Create a directory on a NFS mount with more than 100 files with - names long enough to use the "kmalloc-32" slab (so we can easily - look up the allocation counts): - - for i in `seq 110`; do touch ${i}_0123456789abcdef; done - -- Drop all caches: - - echo 3 >/proc/sys/vm/drop_caches - -- Check the allocation counter: - - grep nfs_readdir /sys/kernel/slab/kmalloc-32/alloc_calls - 30564391 nfs_readdir_add_to_array+0x73/0xd0 age=534558/4791307/6540952 pid=370-1048386 cpus=0-47 nodes=0-1 - -- Request a directory listing and check the allocation counters again: - - ls - [...] - grep nfs_readdir /sys/kernel/slab/kmalloc-32/alloc_calls - 30564511 nfs_readdir_add_to_array+0x73/0xd0 age=207/4792999/6542663 pid=370-1048386 cpus=0-47 nodes=0-1 - -There are now 120 new allocations. - -- Drop all caches and check the counters again: - - echo 3 >/proc/sys/vm/drop_caches - grep nfs_readdir /sys/kernel/slab/kmalloc-32/alloc_calls - 30564401 nfs_readdir_add_to_array+0x73/0xd0 age=735/4793524/6543176 pid=370-1048386 cpus=0-47 nodes=0-1 - -110 allocations are gone, but 10 have leaked and will never be freed. - -Unhelpfully, those allocations are explicitly excluded from KMEMLEAK, -that's why my initial attempts with KMEMLEAK were not successful: - - /* - * Avoid a kmemleak false positive. The pointer to the name is stored - * in a page cache page which kmemleak does not scan. - */ - kmemleak_not_leak(string->name); - -It would be possible to solve this bug without reverting the whole -commit: - -- keep track of which pages were not used, and call - nfs_readdir_clear_array() on them, or -- manually link those pages into the page cache - -But for now I have decided to just revert the commit, because the real -fix would require complex considerations, risking more dangerous -(crash) bugs, which may seem unsuitable for the stable branches. - -Signed-off-by: Max Kellermann -Cc: stable@vger.kernel.org # v5.1+ -Signed-off-by: Trond Myklebust -Signed-off-by: Greg Kroah-Hartman - -diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c -index bd1f9555447b..8d501093660f 100644 ---- a/fs/nfs/dir.c -+++ b/fs/nfs/dir.c -@@ -144,19 +144,12 @@ struct nfs_cache_array { - struct nfs_cache_array_entry array[0]; - }; - --struct readdirvec { -- unsigned long nr; -- unsigned long index; -- struct page *pages[NFS_MAX_READDIR_RAPAGES]; --}; -- - typedef int (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, bool); - typedef struct { - struct file *file; - struct page *page; - struct dir_context *ctx; - unsigned long page_index; -- struct readdirvec pvec; - u64 *dir_cookie; - u64 last_cookie; - loff_t current_index; -@@ -536,10 +529,6 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en - struct nfs_cache_array *array; - unsigned int count = 0; - int status; -- int max_rapages = NFS_MAX_READDIR_RAPAGES; -- -- desc->pvec.index = desc->page_index; -- desc->pvec.nr = 0; - - scratch = alloc_page(GFP_KERNEL); - if (scratch == NULL) -@@ -564,40 +553,20 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en - if (desc->plus) - nfs_prime_dcache(file_dentry(desc->file), entry); - -- status = nfs_readdir_add_to_array(entry, desc->pvec.pages[desc->pvec.nr]); -- if (status == -ENOSPC) { -- desc->pvec.nr++; -- if (desc->pvec.nr == max_rapages) -- break; -- status = nfs_readdir_add_to_array(entry, desc->pvec.pages[desc->pvec.nr]); -- } -+ status = nfs_readdir_add_to_array(entry, page); - if (status != 0) - break; - } while (!entry->eof); - -- /* -- * page and desc->pvec.pages[0] are valid, don't need to check -- * whether or not to be NULL. -- */ -- copy_highpage(page, desc->pvec.pages[0]); -- - out_nopages: - if (count == 0 || (status == -EBADCOOKIE && entry->eof != 0)) { -- array = kmap_atomic(desc->pvec.pages[desc->pvec.nr]); -+ array = kmap(page); - array->eof_index = array->size; - status = 0; -- kunmap_atomic(array); -+ kunmap(page); - } - - put_page(scratch); -- -- /* -- * desc->pvec.nr > 0 means at least one page was completely filled, -- * we should return -ENOSPC. Otherwise function -- * nfs_readdir_xdr_to_array will enter infinite loop. -- */ -- if (desc->pvec.nr > 0) -- return -ENOSPC; - return status; - } - -@@ -631,24 +600,6 @@ int nfs_readdir_alloc_pages(struct page **pages, unsigned int npages) - return -ENOMEM; - } - --/* -- * nfs_readdir_rapages_init initialize rapages by nfs_cache_array structure. -- */ --static --void nfs_readdir_rapages_init(nfs_readdir_descriptor_t *desc) --{ -- struct nfs_cache_array *array; -- int max_rapages = NFS_MAX_READDIR_RAPAGES; -- int index; -- -- for (index = 0; index < max_rapages; index++) { -- array = kmap_atomic(desc->pvec.pages[index]); -- memset(array, 0, sizeof(struct nfs_cache_array)); -- array->eof_index = -1; -- kunmap_atomic(array); -- } --} -- - static - int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, struct inode *inode) - { -@@ -659,12 +610,6 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, - int status = -ENOMEM; - unsigned int array_size = ARRAY_SIZE(pages); - -- /* -- * This means we hit readdir rdpages miss, the preallocated rdpages -- * are useless, the preallocate rdpages should be reinitialized. -- */ -- nfs_readdir_rapages_init(desc); -- - entry.prev_cookie = 0; - entry.cookie = desc->last_cookie; - entry.eof = 0; -@@ -725,24 +670,9 @@ int nfs_readdir_filler(void *data, struct page* page) - struct inode *inode = file_inode(desc->file); - int ret; - -- /* -- * If desc->page_index in range desc->pvec.index and -- * desc->pvec.index + desc->pvec.nr, we get readdir cache hit. -- */ -- if (desc->page_index >= desc->pvec.index && -- desc->page_index < (desc->pvec.index + desc->pvec.nr)) { -- /* -- * page and desc->pvec.pages[x] are valid, don't need to check -- * whether or not to be NULL. -- */ -- copy_highpage(page, desc->pvec.pages[desc->page_index - desc->pvec.index]); -- ret = 0; -- } else { -- ret = nfs_readdir_xdr_to_array(desc, page, inode); -- if (ret < 0) -- goto error; -- } -- -+ ret = nfs_readdir_xdr_to_array(desc, page, inode); -+ if (ret < 0) -+ goto error; - SetPageUptodate(page); - - if (invalidate_inode_pages2_range(inode->i_mapping, page->index + 1, -1) < 0) { -@@ -907,7 +837,6 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) - *desc = &my_desc; - struct nfs_open_dir_context *dir_ctx = file->private_data; - int res = 0; -- int max_rapages = NFS_MAX_READDIR_RAPAGES; - - dfprintk(FILE, "NFS: readdir(%pD2) starting at cookie %llu\n", - file, (long long)ctx->pos); -@@ -927,12 +856,6 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) - desc->decode = NFS_PROTO(inode)->decode_dirent; - desc->plus = nfs_use_readdirplus(inode, ctx); - -- res = nfs_readdir_alloc_pages(desc->pvec.pages, max_rapages); -- if (res < 0) -- return -ENOMEM; -- -- nfs_readdir_rapages_init(desc); -- - if (ctx->pos == 0 || nfs_attribute_cache_expired(inode)) - res = nfs_revalidate_mapping(inode, file->f_mapping); - if (res < 0) -@@ -968,7 +891,6 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) - break; - } while (!desc->eof); - out: -- nfs_readdir_free_pages(desc->pvec.pages, max_rapages); - if (res > 0) - res = 0; - dfprintk(FILE, "NFS: readdir(%pD2) returns %d\n", file, res); -diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h -index f359e760ed41..a2346a2f8361 100644 ---- a/fs/nfs/internal.h -+++ b/fs/nfs/internal.h -@@ -69,8 +69,7 @@ struct nfs_clone_mount { - * Maximum number of pages that readdir can use for creating - * a vmapped array of pages. - */ --#define NFS_MAX_READDIR_PAGES 64 --#define NFS_MAX_READDIR_RAPAGES 8 -+#define NFS_MAX_READDIR_PAGES 8 - - struct nfs_client_initdata { - unsigned long init_flags; diff --git a/queue-4.9/series b/queue-4.9/series index 684a42c254e..e06df8a3409 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -87,8 +87,6 @@ crypto-chacha20poly1305-fix-atomic-sleep-when-using-async-algorithm.patch crypto-crypto4xx-fix-a-potential-double-free-in-ppc4xx_trng_probe.patch cifs-flush-before-set-info-if-we-have-writeable-handles.patch input-gtco-bounds-check-collection-indent-level.patch -input-alps-don-t-handle-alps-cs19-trackpoint-only-device.patch -input-alps-fix-a-mismatch-between-a-condition-check-and-its-comment.patch regulator-s2mps11-fix-buck7-and-buck8-wrong-voltages.patch arm64-tegra-update-jetson-tx1-gpu-regulator-timings.patch iwlwifi-pcie-don-t-service-an-interrupt-that-was-masked.patch @@ -99,4 +97,3 @@ alsa-seq-break-too-long-mutex-context-in-the-write-loop.patch alsa-hda-realtek-apply-alc891-headset-fixup-to-one-dell-machine.patch media-v4l2-test-type-instead-of-cfg-type-in-v4l2_ctrl_new_custom.patch media-coda-remove-unbalanced-and-unneeded-mutex-unlock.patch -revert-nfs-readdirplus-optimization-by-cache-mechanism-memleak.patch -- 2.47.3