mbox series

[0/5] cachefiles, nfs: Fixes

Message ID 158897619675.1119820.2203023452686054109.stgit@warthog.procyon.org.uk (mailing list archive)
Headers show
Series cachefiles, nfs: Fixes | expand

Message

David Howells May 8, 2020, 10:16 p.m. UTC
Hi Linus, Trond, Anna,

Can you pull these fixes for cachefiles and NFS's use of fscache?  Should
they go through the NFS tree or directly upstream?  The things fixed are:

 (1) The reorganisation of bmap() use accidentally caused the return value
     of cachefiles_read_or_alloc_pages() to get corrupted.

 (2) The NFS superblock index key accidentally got changed to include a
     number of kernel pointers - meaning that the key isn't matchable after
     a reboot.

 (3) A redundant check in nfs_fscache_get_super_cookie().

 (4) The NFS change_attr sometimes set in the auxiliary data for the
     caching of an file and sometimes not, which causes the cache to get
     discarded when it shouldn't.

 (5) There's a race between cachefiles_read_waiter() and
     cachefiles_read_copier() that causes an occasional assertion failure.

The patches are tagged here:

	git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
	tag fscache-fixes-20200508-2

Thanks,
David
---
Dave Wysochanski (3):
      NFS: Fix fscache super_cookie index_key from changing after umount
      NFS: Fix fscache super_cookie allocation
      NFSv4: Fix fscache cookie aux_data to ensure change_attr is included

David Howells (1):
      cachefiles: Fix corruption of the return value in cachefiles_read_or_alloc_pages()

Lei Xue (1):
      cachefiles: Fix race between read_waiter and read_copier involving op->to_do


 fs/cachefiles/rdwr.c |   12 ++++++------
 fs/nfs/fscache.c     |   39 ++++++++++++++++++---------------------
 fs/nfs/super.c       |    1 -
 3 files changed, 24 insertions(+), 28 deletions(-)

Comments

Trond Myklebust May 10, 2020, 1:39 p.m. UTC | #1
Hi David,

On Fri, 2020-05-08 at 23:16 +0100, David Howells wrote:
> Hi Linus, Trond, Anna,
> 
> Can you pull these fixes for cachefiles and NFS's use of
> fscache?  Should
> they go through the NFS tree or directly upstream?  The things fixed
> are:
> 
>  (1) The reorganisation of bmap() use accidentally caused the return
> value
>      of cachefiles_read_or_alloc_pages() to get corrupted.
> 
>  (2) The NFS superblock index key accidentally got changed to include
> a
>      number of kernel pointers - meaning that the key isn't matchable
> after
>      a reboot.
> 
>  (3) A redundant check in nfs_fscache_get_super_cookie().
> 
>  (4) The NFS change_attr sometimes set in the auxiliary data for the
>      caching of an file and sometimes not, which causes the cache to
> get
>      discarded when it shouldn't.
> 
>  (5) There's a race between cachefiles_read_waiter() and
>      cachefiles_read_copier() that causes an occasional assertion
> failure.
> 
> The patches are tagged here:
> 
> 	git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-
> fs.git
> 	tag fscache-fixes-20200508-2
> 
> Thanks,
> David
> ---
> Dave Wysochanski (3):
>       NFS: Fix fscache super_cookie index_key from changing after
> umount
>       NFS: Fix fscache super_cookie allocation
>       NFSv4: Fix fscache cookie aux_data to ensure change_attr is
> included
> 
> David Howells (1):
>       cachefiles: Fix corruption of the return value in
> cachefiles_read_or_alloc_pages()
> 
> Lei Xue (1):
>       cachefiles: Fix race between read_waiter and read_copier
> involving op->to_do
> 
> 
>  fs/cachefiles/rdwr.c |   12 ++++++------
>  fs/nfs/fscache.c     |   39 ++++++++++++++++++---------------------
>  fs/nfs/super.c       |    1 -
>  3 files changed, 24 insertions(+), 28 deletions(-)
> 

I can pull this branch, and send it together with the NFS client
bugfixes for 5.7-rc5.
David Howells May 10, 2020, 8:35 p.m. UTC | #2
Trond Myklebust <trondmy@hammerspace.com> wrote:

> I can pull this branch, and send it together with the NFS client
> bugfixes for 5.7-rc5.

Thanks!

David
NeilBrown May 11, 2020, 10:38 p.m. UTC | #3
On Fri, May 08 2020, David Howells wrote:

> Hi Linus, Trond, Anna,
>
> Can you pull these fixes for cachefiles and NFS's use of fscache?  Should
> they go through the NFS tree or directly upstream?  The things fixed are:

hi David,
thanks for these fscache fixes.  Here is another for your consideration.

NeilBrown


From: NeilBrown <neilb@suse.de>
Date: Tue, 12 May 2020 08:32:25 +1000
Subject: [PATCH] cachefiles: fix inverted ASSERTion.

bmap() returns a negative result precisely when a_ops->bmap is NULL.

A recent patch converted

       ASSERT(inode->i_mapping->a_ops->bmap);

to an assertion that bmap(inode, ...) returns a negative number.
This inverts the sense of the assertion.
So change it back : ASSERT(ret == 0)

Fixes: 10d83e11a582 ("cachefiles: drop direct usage of ->bmap method.")
Signed-off-by: NeilBrown <neilb@suse.de>
---
 fs/cachefiles/rdwr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 1dc97f2d6201..a4573c96660c 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -431,7 +431,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
 	block <<= shift;
 
 	ret = bmap(inode, &block);
-	ASSERT(ret < 0);
+	ASSERT(ret == 0);
 
 	_debug("%llx -> %llx",
 	       (unsigned long long) (page->index << shift),