Patch "fs/cachefiles: Remove wait_bit_key layout dependency" has been added to the 5.11-stable tree
Subsystems (3)
[email protected]
AppliedThis is a note to let you know that I've just added the patch titled
fs/cachefiles: Remove wait_bit_key layout dependency
to the 5.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
fs-cachefiles-remove-wait_bit_key-layout-dependency.patch
and it can be found in the queue-5.11 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From 39f985c8f667c80a3d1eb19d31138032fa36b09e Mon Sep 17 00:00:00 2001
From: "Matthew Wilcox (Oracle)" <[email protected]>
Date: Sat, 20 Mar 2021 05:40:38 +0000
Subject: fs/cachefiles: Remove wait_bit_key layout dependency
From: Matthew Wilcox (Oracle) <[email protected]>
commit 39f985c8f667c80a3d1eb19d31138032fa36b09e upstream.
Cachefiles was relying on wait_page_key and wait_bit_key being the same layout, which is fragile. Now that wait_page_key is exposed in the pagemap.h header, we can remove that fragility
A comment on the need to maintain structure layout equivalence was added by Linus[1] and that is no longer applicable.
--- fs/cachefiles/rdwr.c | 7 +++---- include/linux/pagemap.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-)
fs/cachefiles/rdwr.c +3 -4
@@ -24,17 +24,16 @@ static int cachefiles_read_waiter(wait_q container_of(wait, struct cachefiles_one_read, monitor);struct cachefiles_object *object;struct fscache_retrieval *op = monitor->op; -struct wait_bit_key *key = _key; +struct wait_page_key *key = _key;struct page *page = wait->private;ASSERT (key);_enter ("{%lu},%u,%d,{%p,%u}" , monitor->netfs_page->index, mode, sync, - key->flags, key->bit_nr); + key->page, key->bit_nr); -if (key->flags != &page->flags || - key->bit_nr != PG_locked) +if (key->page != page || key->bit_nr != PG_locked)return 0 ;_debug ("--- monitor %p %lx ---" , page, page->flags);
include/linux/pagemap.h +0 -1
@@ -559,7 +559,6 @@ static inline pgoff_t linear_page_index(return pgoff; } -/* This has the same layout as wait_bit_key - see fs/cachefiles/rdwr.c */ struct wait_page_key {struct page *page;int bit_nr;
Patches currently in stable-queue which might be from [email protected] are
queue-5.11/fs-cachefiles-remove-wait_bit_key-layout-dependency.patch