Skip to content

gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf() and its caller chain

Mauricio Faria de Oliveira gfs2 lkml 1 version New

Get series with b4
b4 am [email protected] change-id 20260908-gfs2_getbuf-error-checks-e8f89a08acc4

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf()fs/gfs2/meta_io.c+4 -00 replies
2/5gfs2: handle NULL return value in callers of gfs2_getbuf() with CREATEfs/gfs2/bmap.c fs/gfs2/dir.c fs/gfs2/meta_io.c+23 -70 replies
3/5gfs2: handle NULL return value in callers of gfs2_meta_new()fs/gfs2/bmap.c fs/gfs2/dir.c fs/gfs2/inode.c +2 more+48 -130 replies
4/5gfs2: handle NULL return value in callers of gfs2_meta_ra()fs/gfs2/dir.c fs/gfs2/recovery.c+6 -00 replies
5/5gfs2: check for errors from filemap_get_folio() in gfs2_jhead_process_page()fs/gfs2/lops.c+18 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf() and its caller chain

Currently, gfs2_getbuf() will hit a kernel oops for dereferencing an error pointer if __filemap_get_folio() with FGP_CREAT fails, eg ERR_PTR(-ENOMEM), as there is no error handling in this case.

The code and documentation in filemap.c and pagemap.h show that it indeed may fail, and other callers in the kernel check for errors with FGP_CREAT.

This series adds such error handling in gfs2_getbuf() and its caller chain.

Tested with fstests on v7.3-rc1. It "Failed 51 out 788 tests" consistently, plus one (different) flaky test on ~10 runs before and after this series.

Thanks,

---
Mauricio Faria de Oliveira (5):
gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf()
gfs2: handle NULL return value in callers of gfs2_getbuf() with CREATE
gfs2: handle NULL return value in callers of gfs2_meta_new()
gfs2: handle NULL return value in callers of gfs2_meta_ra()
gfs2: check for errors from filemap_get_folio() in gfs2_jhead_process_page()

 fs/gfs2/bmap.c     | 27 +++++++++++++++++++--------
 fs/gfs2/dir.c      |  8 ++++++++
 fs/gfs2/inode.c    | 20 +++++++++++++++-----
 fs/gfs2/lops.c     | 31 ++++++++++++++++++++++++++-----
 fs/gfs2/meta_io.c  | 30 +++++++++++++++++++++++-------
 fs/gfs2/recovery.c |  2 ++
 fs/gfs2/xattr.c    |  6 ++++++
 7 files changed, 99 insertions(+), 25 deletions(-)

---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260908-gfs2_getbuf-error-checks-e8f89a08acc4

Best regards,

Signature · 1 line
Mauricio Faria de Oliveira <[email protected]>