Skip to content

Commit 58f5f66

Browse files
Christoph Hellwigakpm00
authored andcommitted
afs: fix the afs_dir_get_folio return value
Keep returning NULL on failure instead of letting an ERR_PTR escape to callers that don't expect it. Link: https://lkml.kernel.org/r/20230503154526.1223095-2-hch@lst.de Fixes: 66dabbb ("mm: return an ERR_PTR from __filemap_get_folio") Signed-off-by: Christoph Hellwig <hch@lst.de> Reported-by: Jan Kara <jack@suse.cz> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: David Howells <dhowells@redhat.com> Tested-by: David Howells <dhowells@redhat.com> Cc: Marc Dionne <marc.dionne@auristor.com> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 28a65b4 commit 58f5f66

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/afs/dir_edit.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,12 @@ static struct folio *afs_dir_get_folio(struct afs_vnode *vnode, pgoff_t index)
115115
folio = __filemap_get_folio(mapping, index,
116116
FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
117117
mapping->gfp_mask);
118-
if (IS_ERR(folio))
118+
if (IS_ERR(folio)) {
119119
clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags);
120-
else if (folio && !folio_test_private(folio))
120+
return NULL;
121+
}
122+
if (!folio_test_private(folio))
121123
folio_attach_private(folio, (void *)1);
122-
123124
return folio;
124125
}
125126

0 commit comments

Comments
 (0)