On Wed, Aug 11, 2021 at 12:19:15PM +0200, Jan Kara wrote:
quoted hunk ↗ jump to hunk
diff --git a/fs/ext4/orphan.c b/fs/ext4/orphan.c
index 019719c0ac12..18622ddeb41b 100644
--- a/fs/ext4/orphan.c
+++ b/fs/ext4/orphan.c
@@ -28,28 +43,40 @@ static int ext4_orphan_file_add(handle_t *handle, struct inode *inode)
*/
return -ENOSPC;
}
- oi->of_binfo[i].ob_free_entries--;
- spin_unlock(&oi->of_lock);
- /*
- * Get access to orphan block. We have dropped of_lock but since we
- * have decremented number of free entries we are guaranteed free entry
- * in our block.
- */
ret = ext4_journal_get_write_access(handle, inode->i_sb,
oi->of_binfo[i].ob_bh, EXT4_JTR_ORPHAN_FILE);
if (ret)
return ret;
Shouldn't there be a call to:
atomic_inc(&oi->of_binfo[i].ob_free_entries);
before we return, so the free_entry count stays consistent?
Otherwise, with the test-bot comments also addressed, you can add:
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Thanks,
- Ted