ext4: improve journal credit handling in set xattr paths
Both ext4_set_acl() and ext4_set_context() need to be made aware of ea_inode feature when it comes to credits calculation. Also add a sufficient credits check in ext4_xattr_set_handle() right after xattr write lock is grabbed. Original credits calculation is done outside the lock so there is a possiblity that the initially calculated credits are not sufficient anymore. Signed-off-by: Tahsin Erdogan <tahsin@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:

committed by
Theodore Ts'o

parent
65d3000520
commit
c1a5d5f6ab
@@ -231,14 +231,15 @@ int
|
||||
ext4_set_acl(struct inode *inode, struct posix_acl *acl, int type)
|
||||
{
|
||||
handle_t *handle;
|
||||
int error, retries = 0;
|
||||
int error, credits, retries = 0;
|
||||
size_t acl_size = acl ? ext4_acl_size(acl->a_count) : 0;
|
||||
|
||||
error = dquot_initialize(inode);
|
||||
if (error)
|
||||
return error;
|
||||
retry:
|
||||
handle = ext4_journal_start(inode, EXT4_HT_XATTR,
|
||||
ext4_jbd2_credits_xattr(inode));
|
||||
credits = ext4_xattr_set_credits(inode, acl_size);
|
||||
handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits);
|
||||
if (IS_ERR(handle))
|
||||
return PTR_ERR(handle);
|
||||
|
||||
|
Reference in New Issue
Block a user