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/[email protected] Fixes: 66dabbb ("mm: return an ERR_PTR from __filemap_get_folio") Signed-off-by: Christoph Hellwig <[email protected]> Reported-by: Jan Kara <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: David Howells <[email protected]> Tested-by: David Howells <[email protected]> Cc: Marc Dionne <[email protected]> Cc: Matthew Wilcox <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
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)