From: Hyeontae Lee <wonju345@naver.com>
To: hyc.lee@gmail.com
Cc: linkinjeon@kernel.org, zzzccc427@gmail.com,
baijiaju1990@gmail.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [BUG] ntfs: data race on ni->mrec between resident read path and MFT record mutation
Date: Tue, 28 Jul 2026 19:42:53 +0900 [thread overview]
Message-ID: <20260728104254.2459-1-wonju345@naver.com> (raw)
In-Reply-To: <CANFS6bbReuJMapSmtQSY+jASmY_di+X28rMFQuYtscBwjCie8g@mail.gmail.com>
Hi Hyunchul,
Thanks. In case it saves you some time: I tried the naive fix - taking
mrec_lock unconditionally in __ntfs_read_iomap_begin() - and it deadlocks
immediately. ntfs_lookup() already holds the directory inode's mrec_lock
when it reads an index folio via read_mapping_folio(), so the read iomap
path re-enters and lockdep reports recursive locking:
WARNING: possible recursive locking detected
--------------------------------------------
bash/1 is trying to acquire lock:
(&ni->mrec_lock), at: __ntfs_read_iomap_begin+0x291/0x3f0
but task is already holding lock:
(&ni->mrec_lock), at: ntfs_lookup+0x7f/0x3e0
Call Trace:
__mutex_lock+0xd3/0x1190
__ntfs_read_iomap_begin+0x291/0x3f0
iomap_iter+0x1a4/0x480
iomap_read_folio+0xb1/0x1c0
ntfs_read_folio+0x82/0xd0
filemap_read_folio+0x18/0x80
do_read_cache_folio+0x7a/0x1b0
ntfs_lookup_inode_by_name+0x624/0xe00
ntfs_lookup+0x93/0x3e0
path_openat+0xb4f/0x1370
So the read path is entered both with and without mrec_lock held (this one
has no attribute list involved), which lines up with your point on the June
thread that an unconditional lock there does not work. The comment at
fs/ntfs/dir.c:295 notes the same read_mapping_folio() hazard.
I will think about a different approach.
Thanks,
Hyeontae
next prev parent reply other threads:[~2026-07-28 10:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-25 4:24 Hyeontae Lee
2026-07-27 5:37 ` Hyunchul Lee
2026-07-28 10:42 ` Hyeontae Lee [this message]
2026-07-31 9:10 ` [PATCH] ntfs: serialize the resident read iomap path with mrec_lock Hyeontae Lee
2026-07-31 15:00 ` Namjae Jeon
2026-08-01 6:27 ` Hyeontae Lee
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=20260728104254.2459-1-wonju345@naver.com \
--to=wonju345@naver.com \
--cc=baijiaju1990@gmail.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zzzccc427@gmail.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®