diff options
| author | Christoph Hellwig <[email protected]> | 2023-03-07 14:34:10 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2023-04-06 02:42:42 +0000 |
| commit | 66dabbb65d673aef40dd17bf62c042be8f6d4a4b (patch) | |
| tree | a14c48222ab659cc6a9344ca6a1468a09c09eb42 /fs/afs/dir_edit.c | |
| parent | mm: remove FGP_ENTRY (diff) | |
| download | kernel-66dabbb65d673aef40dd17bf62c042be8f6d4a4b.tar.gz kernel-66dabbb65d673aef40dd17bf62c042be8f6d4a4b.zip | |
mm: return an ERR_PTR from __filemap_get_folio
Instead of returning NULL for all errors, distinguish between:
- no entry found and not asked to allocated (-ENOENT)
- failed to allocate memory (-ENOMEM)
- would block (-EAGAIN)
so that callers don't have to guess the error based on the passed in
flags.
Also pass through the error through the direct callers: filemap_get_folio,
filemap_lock_folio filemap_grab_folio and filemap_get_incore_folio.
[[email protected]: fix null-pointer deref]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/20230310043137.GA1624890@u2004
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Christoph Hellwig <[email protected]>
Acked-by: Ryusuke Konishi <[email protected]> [nilfs2]
Cc: Andreas Gruenbacher <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'fs/afs/dir_edit.c')
| -rw-r--r-- | fs/afs/dir_edit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c index 0ab7752d1b75..f0eddccbdd95 100644 --- a/fs/afs/dir_edit.c +++ b/fs/afs/dir_edit.c @@ -115,7 +115,7 @@ static struct folio *afs_dir_get_folio(struct afs_vnode *vnode, pgoff_t index) folio = __filemap_get_folio(mapping, index, FGP_LOCK | FGP_ACCESSED | FGP_CREAT, mapping->gfp_mask); - if (!folio) + if (IS_ERR(folio)) clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags); else if (folio && !folio_test_private(folio)) folio_attach_private(folio, (void *)1); |
