Skip to content

Commit 04e6ce8

Browse files
Luis Henriques (SUSE)tytso
Luis Henriques (SUSE)
authored andcommitted
ext4: mark fc as ineligible using an handle in ext4_xattr_set()
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]
1 parent faab35a commit 04e6ce8

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
@@ -2559,14 +2559,15 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name,
25592559

25602560
error = ext4_xattr_set_handle(handle, inode, name_index, name,
25612561
value, value_len, flags);
2562+
ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR,
2563+
handle);
25622564
error2 = ext4_journal_stop(handle);
25632565
if (error == -ENOSPC &&
25642566
ext4_should_retry_alloc(sb, &retries))
25652567
goto retry;
25662568
if (error == 0)
25672569
error = error2;
25682570
}
2569-
ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR, NULL);
25702571

25712572
return error;
25722573
}

0 commit comments

Comments
 (0)