From c1a5d5f6ab21eb7e6ff8cb99489d9001cf2a2850 Mon Sep 17 00:00:00 2001 From: Tahsin Erdogan Date: Wed, 21 Jun 2017 22:28:40 -0400 Subject: 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 Signed-off-by: Theodore Ts'o --- fs/ext4/acl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'fs/ext4/acl.c') diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c index 3ec0e46de95f..74f7ac539e00 100644 --- a/fs/ext4/acl.c +++ b/fs/ext4/acl.c @@ -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); -- cgit v1.2.3