ext4: enable scoped NOFS when starting a handle in nojournal mode

The jbd2 layer enables NOFS mode using memalloc_nofs_{save,restore}()
while a handle is active.  We need to do the same in nojournal mode so
that it is safe to remove GFP_NOFS flags while a jbd2 handle is
active.

This will require that we actually allocate a real handle, but with an
h_invalid flag set, so there is a place to put the saved memalloc
context.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
This commit is contained in:
Theodore Ts'o 2026-07-16 10:10:20 -04:00
commit 61e2a90a91
4 changed files with 25 additions and 19 deletions