Re: [PATCH v10 2/5] ext4: introduce ext4_put_ea_inode() for safe deferred iput
From: Zhou, Yun
Date: Sun Jun 28 2026 - 04:14:39 EST
On 6/27/26 00:53, Jan Kara wrote:
On Thu 25-06-26 23:29:38, Yun Zhou wrote:
+
+/*
+ * Drain all pending deferred EA inode iputs. Must be called before
+ * freeing resources that eviction depends on (quota, block allocator).
+ * Loops because worker iput may trigger eviction that re-queues.
+ */
Can you please explain how iput of EA inode can trigger iput of another EA
inode? So far I don't think that's possible but perhaps I'm missing
something.
+static inline void ext4_drain_ea_inode_work(struct ext4_sb_info *sbi)
+{
+ while (flush_delayed_work(&sbi->s_ea_inode_work) ||
+ !llist_empty(&sbi->s_ea_inode_to_free))
+ ;
+}
On a corrupted fs, an evicted ea_inode might still have xattrs and point to another ea inode, which creates a potential "re-arm" scenario. Of course, this situation is extremely rare. Therefore, I plan to remove this redundant loop logic for flush_delayed_work. Instead, I will add a simple EXT4_EA_INODE_FL flag check right before calling ext4_xattr_delete_inode(), as shown below:
+ if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) {
+ err = ext4_xattr_delete_inode(handle, inode, extra_credits);
+ if (err) {
This will be submitted as a separate, optional enhancement patch. What do you think?
BR,
Yun