Skip to contentSkip to conversation

ext4: unlock xattr_sem properly in ext4_inline_data_truncate()

PATCH Applied Joseph Qi 3 participants 3 messages Nov 3, 2020 – Nov 7, 2020 ext4 file system

lore
Share & tools
lore

Joseph Qi

author
#0 lore raw

PATCH 1/1 ext4: unlock xattr_sem properly in ext4_inline_data_truncate()

It takes xattr_sem to check inline data again but without unlock it in case not have. So unlock it before return.

Fixes aef1c8513c1f ("ext4: let ext4_truncate handle inline data correctly")
Cc Tao Ma <[email protected]>
---
 fs/ext4/inline.c | 1 +
 1 file changed, 1 insertion(+)
fs/ext4/inline.c +1 -0
index caa5147..b41512d 100644
@@ -1880,6 +1880,7 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline)
 
 	ext4_write_lock_xattr(inode, &no_expand);
 	if (!ext4_has_inline_data(inode)) {
+		ext4_write_unlock_xattr(inode, &no_expand);
 		*has_inline = 0;
 		ext4_journal_stop(handle);
 		return 0;
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Joseph Qi

It takes xattr_sem to check inline data again but without unlock it in case not have. So unlock it before return.

Fixes aef1c8513c1f ("ext4: let ext4_truncate handle inline data correctly")
Cc Tao Ma <[email protected]>
Quoted 17 lines

---
fs/ext4/inline.c | 1 +

1 file changed, 1 insertion(+)
fs/ext4/inline.c +1 -1
index caa5147..b41512d 100644
@@ -1880,6 +1880,7 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline)
 
 	ext4_write_lock_xattr(inode, &no_expand);
 	if (!ext4_has_inline_data(inode)) {
+		ext4_write_unlock_xattr(inode, &no_expand);
 		*has_inline = 0;
 		ext4_journal_stop(handle);
 		return 0;
--
Quoted 2 lines

1.8.3.1

Cheers, Andreas

maintainer Applied
#2 lore raw
Quoted 11 lines · Andreas Dilger
Quoted 8 lines · Joseph Qi

It takes xattr_sem to check inline data again but without unlock it in case not have. So unlock it before return.

Fixes aef1c8513c1f ("ext4: let ext4_truncate handle inline data correctly")
Cc Tao Ma <[email protected]>

Thanks, applied.

- Ted