mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca
Cc: linux-ext4@vger.kernel.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] fs: ext4: possible ABBA deadlock in ext4_inline_data_truncate() and ext4_punch_hole()
Date: Thu, 9 Dec 2021 19:10:44 +0800	[thread overview]
Message-ID: <03a92134-ce74-f586-59a0-baed436b275a@gmail.com> (raw)

Hello,

My static analysis tool reports a possible ABBA deadlock in the ext4 
module in Linux 5.10:

ext4_inline_data_truncate()
   down_write(&EXT4_I(inode)->i_data_sem); --> Line 1895 (Lock A)
   ext4_xattr_ibody_get()
     ext4_xattr_inode_get()
       ext4_xattr_inode_iget()
         inode_lock(inode); --> Line 427 (Lock B)

ext4_punch_hole()
   inode_lock(inode); --> Line 4018 (Lock B)
   ext4_update_disksize_before_punch()
     ext4_update_i_disksize()
       down_write(&EXT4_I(inode)->i_data_sem); --> Line 3248 (Lock A)

When ext4_inline_data_truncate() and ext4_punch_hole() are concurrently 
executed, the deadlock can occur.

I am not quite sure whether this possible deadlock is real and how to 
fix it if it is real.
Any feedback would be appreciated, thanks :)

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>


Best wishes,
Jia-Ju Bai

             reply	other threads:[~2021-12-09 11:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 11:10 Jia-Ju Bai [this message]
2021-12-09 17:00 ` Theodore Y. Ts'o
2021-12-10  2:03   ` Jia-Ju Bai
2021-12-10 18:05     ` Theodore Y. Ts'o
2021-12-12 12:56       ` Jia-Ju Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03a92134-ce74-f586-59a0-baed436b275a@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®