linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: unlock xattr_sem properly in ext4_inline_data_truncate()
@ 2020-11-03  2:29 Joseph Qi
  2020-11-03  3:15 ` Andreas Dilger
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Qi @ 2020-11-03  2:29 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger
  Cc: linux-ext4, Jan Kara, Dan Carpenter, Tao Ma

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")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
---
 fs/ext4/inline.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index caa5147..b41512d 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -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;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: unlock xattr_sem properly in ext4_inline_data_truncate()
  2020-11-03  2:29 [PATCH] ext4: unlock xattr_sem properly in ext4_inline_data_truncate() Joseph Qi
@ 2020-11-03  3:15 ` Andreas Dilger
  2020-11-07  3:29   ` Theodore Y. Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2020-11-03  3:15 UTC (permalink / raw)
  To: Joseph Qi
  Cc: Theodore Ts'o, Ext4 Developers List, Jan Kara, Dan Carpenter, Tao Ma

[-- Attachment #1: Type: text/plain, Size: 1049 bytes --]

On Nov 2, 2020, at 7:29 PM, Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
> 
> 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")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Tao Ma <boyu.mt@taobao.com>
> Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> fs/ext4/inline.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index caa5147..b41512d 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -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;
> --
> 1.8.3.1
> 


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: unlock xattr_sem properly in ext4_inline_data_truncate()
  2020-11-03  3:15 ` Andreas Dilger
@ 2020-11-07  3:29   ` Theodore Y. Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-11-07  3:29 UTC (permalink / raw)
  To: Andreas Dilger
  Cc: Joseph Qi, Ext4 Developers List, Jan Kara, Dan Carpenter, Tao Ma

On Mon, Nov 02, 2020 at 08:15:36PM -0700, Andreas Dilger wrote:
> On Nov 2, 2020, at 7:29 PM, Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
> > 
> > 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")
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Cc: Tao Ma <boyu.mt@taobao.com>
> > Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> 
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-07  3:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03  2:29 [PATCH] ext4: unlock xattr_sem properly in ext4_inline_data_truncate() Joseph Qi
2020-11-03  3:15 ` Andreas Dilger
2020-11-07  3:29   ` Theodore Y. Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).