From: "Zhou, Yun" <yun.zhou@windriver.com>
To: almaz.alexandrovich@paragon-software.com
Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org,
yun.zhou@windriver.com
Subject: Re: [PATCH 0/2] ntfs3: fix deadlocks in ntfs_readdir caused by ni_lock held across dir_emit
Date: Sun, 19 Jul 2026 20:29:26 +0800 [thread overview]
Message-ID: <338de59b-ec43-4680-95f3-65f29b0d7db4@windriver.com> (raw)
In-Reply-To: <20260701013049.3141386-1-yun.zhou@windriver.com>
Friendly ping.
On 7/1/2026 9:30 AM, Yun Zhou wrote:
> Commit d62cf685d12e ("fs/ntfs3: hold ni_lock across readdir metadata
> walk") extended ni_lock to cover the entire directory walk in
> ntfs_readdir(), including dir_emit() calls that copy data to userspace.
> This introduced multiple deadlocks reported by syzkaller:
>
> 1. Recursive ni_lock: ntfs_dir_emit() -> ntfs_iget5() -> mi_read()
> tries to acquire ni_lock on a child inode with the same lock class
> while the parent's ni_lock is already held.
>
> 2. Lock-order inversions: dir_emit() may trigger page faults that need
> mmap_lock or mapping->invalidate_lock, conflicting with paths that
> acquire those locks before ni_lock (ntfs_fallocate, mmap).
>
> This series fixes both issues:
> - Patch 1 removes the ntfs_iget5() call that caused recursive locking.
> - Patch 2 releases ni_lock before calling dir_emit(), using the XFS
> approach of reading data into stable buffers under the lock, then
> emitting to userspace after releasing it.
>
> Yun Zhou (2):
> ntfs3: remove ntfs_iget5 call in ntfs_dir_emit to fix recursive
> deadlock
> ntfs3: release ni_lock before dir_emit in ntfs_readdir to fix
> deadlocks
>
> fs/ntfs3/dir.c | 38 ++++++++++++++++++++------------------
> 1 file changed, 20 insertions(+), 18 deletions(-)
>
prev parent reply other threads:[~2026-07-19 12:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 1:30 Yun Zhou
2026-07-01 1:30 ` [PATCH 1/2] ntfs3: remove ntfs_iget5 call in ntfs_dir_emit to fix recursive deadlock Yun Zhou
2026-07-01 1:30 ` [PATCH 2/2] ntfs3: release ni_lock before dir_emit in ntfs_readdir to fix deadlocks Yun Zhou
2026-10-16 14:48 ` Konstantin Komarov
2026-07-19 12:29 ` Zhou, Yun [this message]
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=338de59b-ec43-4680-95f3-65f29b0d7db4@windriver.com \
--to=yun.zhou@windriver.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/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®