summaryrefslogtreecommitdiffstats
path: root/fs/ext4/acl.c
diff options
context:
space:
mode:
authorTahsin Erdogan <tahsin@google.com>2017-06-21 22:28:40 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-06-21 22:28:40 -0400
commitc1a5d5f6ab21eb7e6ff8cb99489d9001cf2a2850 (patch)
treefdbc1f98ca505dc3b85bbef2a0aefb0b764c56d8 /fs/ext4/acl.c
parent65d3000520c50f3c160403a210a7504d789eafca (diff)
downloadlinux-c1a5d5f6ab21eb7e6ff8cb99489d9001cf2a2850.tar.bz2
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>
Diffstat (limited to 'fs/ext4/acl.c')
-rw-r--r--fs/ext4/acl.c7
1 files changed, 4 insertions, 3 deletions
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);