mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com
Cc: ocfs2-devel@oss.oracle.com, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] fs: ocfs2: possible ABBA deadlock in ocfs2_dio_end_io_write() and ocfs2_move_extents()
Date: Fri, 10 Dec 2021 16:37:31 +0800	[thread overview]
Message-ID: <7713e8e4-d397-ab73-4277-c03cc7d1c227@gmail.com> (raw)

Hello,

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

ocfs2_dio_end_io_write()
   down_write(&oi->ip_alloc_sem); --> Line 2322 (Lock A)
   ocfs2_del_inode_from_orphan()
     inode_lock(orphan_dir_inode);  --> Line 2701 (Lock B)

ocfs2_move_extents()
   inode_lock(inode); --> Line 916 (Lock B)
   down_write(&OCFS2_I(inode)->ip_alloc_sem); --> Line 936 (Lock A)

When ocfs2_dio_end_io_write() and ocfs2_move_extents() are concurrently 
executed, the deadlocks 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-10  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10  8:37 Jia-Ju Bai [this message]
2021-12-10  8:38 Jia-Ju Bai
2021-12-14  7:08 ` Joseph Qi
2021-12-14  7:19   ` 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=7713e8e4-d397-ab73-4277-c03cc7d1c227@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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®