diff options
author | Tahsin Erdogan <tahsin@google.com> | 2017-06-21 22:28:40 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2017-06-21 22:28:40 -0400 |
commit | c1a5d5f6ab21eb7e6ff8cb99489d9001cf2a2850 (patch) | |
tree | fdbc1f98ca505dc3b85bbef2a0aefb0b764c56d8 /fs/ext4/super.c | |
parent | 65d3000520c50f3c160403a210a7504d789eafca (diff) |
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/super.c')
-rw-r--r-- | fs/ext4/super.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d37c81f327e7..b02a23ec92ca 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -1143,7 +1143,7 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, | |||
1143 | void *fs_data) | 1143 | void *fs_data) |
1144 | { | 1144 | { |
1145 | handle_t *handle = fs_data; | 1145 | handle_t *handle = fs_data; |
1146 | int res, res2, retries = 0; | 1146 | int res, res2, credits, retries = 0; |
1147 | 1147 | ||
1148 | res = ext4_convert_inline_data(inode); | 1148 | res = ext4_convert_inline_data(inode); |
1149 | if (res) | 1149 | if (res) |
@@ -1178,8 +1178,8 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, | |||
1178 | if (res) | 1178 | if (res) |
1179 | return res; | 1179 | return res; |
1180 | retry: | 1180 | retry: |
1181 | handle = ext4_journal_start(inode, EXT4_HT_MISC, | 1181 | credits = ext4_xattr_set_credits(inode, len); |
1182 | ext4_jbd2_credits_xattr(inode)); | 1182 | handle = ext4_journal_start(inode, EXT4_HT_MISC, credits); |
1183 | if (IS_ERR(handle)) | 1183 | if (IS_ERR(handle)) |
1184 | return PTR_ERR(handle); | 1184 | return PTR_ERR(handle); |
1185 | 1185 | ||