Skip to content

Commit 8d26a18

Browse files
Luis Henriques (SUSE)Sasha Levin
Luis Henriques (SUSE)
authored and
Sasha Levin
committed
ext4: mark fc as ineligible using an handle in ext4_xattr_set()
commit 04e6ce8 upstream. Calling ext4_fc_mark_ineligible() with a NULL handle is racy and may result in a fast-commit being done before the filesystem is effectively marked as ineligible. This patch moves the call to this function so that an handle can be used. If a transaction fails to start, then there's not point in trying to mark the filesystem as ineligible, and an error will eventually be returned to user-space. Suggested-by: Jan Kara <[email protected]> Signed-off-by: Luis Henriques (SUSE) <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9e933bd commit 8d26a18

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ext4/xattr.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2512,14 +2512,15 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name,
25122512

25132513
error = ext4_xattr_set_handle(handle, inode, name_index, name,
25142514
value, value_len, flags);
2515+
ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR,
2516+
handle);
25152517
error2 = ext4_journal_stop(handle);
25162518
if (error == -ENOSPC &&
25172519
ext4_should_retry_alloc(sb, &retries))
25182520
goto retry;
25192521
if (error == 0)
25202522
error = error2;
25212523
}
2522-
ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR, NULL);
25232524

25242525
return error;
25252526
}

0 commit comments

Comments
 (0)