mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Deepanshu Kartikey <kartikey406@gmail.com>
To: adilger.kernel@dilger.ca, tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext4: fix allocation failure in ext4_mb_load_buddy_gfp
Date: Thu, 25 Sep 2025 07:36:21 +0530	[thread overview]
Message-ID: <20250925020621.1268714-1-kartikey406@gmail.com> (raw)


Hi Andreas,

Thank you for pointing out the fundamental issue with my approach. You're right that removing __GFP_NOFAIL creates a worse problem by potentially triggering filesystem errors.

I understand your suggestion about allowing the function to return errors so the caller can retry, but I need more specific guidance on the implementation approach.

Questions:

1. **Function signature change**: Should ext4_discard_preallocations() be changed from void to int to return error codes? This would require updating all 13+ callers I found.

2. **Caller modifications**: How should the various callers (ext4_truncate, ext4_clear_inode, ext4_release_file, etc.) handle allocation failures during memory pressure? Should they:
   - Retry the operation later?
   - Skip preallocation cleanup temporarily?
   - Handle it differently based on the calling context?

3. **Memory pressure detection**: Is checking (current->flags & PF_MEMALLOC) the right approach to detect when we're in memory reclaim context?

4. **Scope of changes**: Would you prefer:
   - A minimal fix that just handles the allocation failure gracefully?
   - A more comprehensive rework of the error handling throughout the preallocation discard path?

I want to make sure I understand the preferred approach before submitting v2, especially since this affects multiple call sites throughout the ext4 codebase.

Best regards,
Deepanshu

             reply	other threads:[~2025-09-25  2:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25  2:06 Deepanshu Kartikey [this message]
2025-09-26 19:17 ` Andreas Dilger
  -- strict thread matches above, loose matches on Subject: below --
2025-09-27  0:19 Deepanshu Kartikey
2025-09-27  0:18 Deepanshu Kartikey
2025-09-27  3:01 ` Theodore Ts'o
2025-09-24  1:16 Deepanshu Kartikey
2025-09-24 23:33 ` Andreas Dilger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250925020621.1268714-1-kartikey406@gmail.com \
    --to=kartikey406@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®