Blob Blame History Raw
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 20 Jan 2021 16:11:12 +0000
Subject: cachefiles: Drop superfluous readpages aops NULL check
Git-commit: db58465f1121086b524be80be39d1fedbe5387f3
Patch-mainline: v5.11-rc5
References: bsc#1210430

After the recent actions to convert readpages aops to readahead, the
NULL checks of readpages aops in cachefiles_read_or_alloc_page() may
hit falsely.  More badly, it's an ASSERT() call, and this panics.

Drop the superfluous NULL checks for fixing this regression.

[dh: Note that cachefiles never actually used readpages, so this check was
 never actually necessary]

Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=208883
Buglink: https://bugzilla.opensuse.org/show_bug.cgi?id=1175245
Fixes: 9ae326a69004 ("CacheFiles: A cache that backs onto a mounted filesystem")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[adjusted context as we don't have 10d83e11a582
 ("cachefiles: drop direct usage of ->bmap method.")]

Acked-by: Luís Henriques <lhenriques@suse.de>

---
 fs/cachefiles/rdwr.c |    2 --
 1 file changed, 2 deletions(-)

--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -418,7 +418,6 @@ int cachefiles_read_or_alloc_page(struct
 	inode = d_backing_inode(object->backer);
 	ASSERT(S_ISREG(inode->i_mode));
 	ASSERT(inode->i_mapping->a_ops->bmap);
-	ASSERT(inode->i_mapping->a_ops->readpages);
 
 	/* calculate the shift required to use bmap */
 	shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits;
@@ -717,7 +716,6 @@ int cachefiles_read_or_alloc_pages(struc
 	inode = d_backing_inode(object->backer);
 	ASSERT(S_ISREG(inode->i_mode));
 	ASSERT(inode->i_mapping->a_ops->bmap);
-	ASSERT(inode->i_mapping->a_ops->readpages);
 
 	/* calculate the shift required to use bmap */
 	shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits;