From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: David Howells <dhowells@redhat.com>
Cc: "idryomov@gmail.com" <idryomov@gmail.com>,
Alex Markuze <amarkuze@redhat.com>,
"slava@dubeyko.com" <slava@dubeyko.com>,
"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: RE: [PATCH v2] ceph: Fix kernel crash in generic/397 test
Date: Tue, 28 Jan 2025 20:16:14 +0000 [thread overview]
Message-ID: <d81a04646f76e0b65cd1e075ab3d410c4b9c3876.camel@ibm.com> (raw)
In-Reply-To: <3532744.1738094469@warthog.procyon.org.uk>
On Tue, 2025-01-28 at 20:01 +0000, David Howells wrote:
> I added some tracing to fs/ceph/addr.c and this highlights the bug causing the
> hang that I'm seeing.
>
> So what I see is ceph_writepages_start() being entered and getting a
> collection of folios from filemap_get_folios_tag():
>
> netfs_ceph_writepages: i=10000004f52 ix=0
> netfs_ceph_wp_get_folios: i=10000004f52 oix=0 ix=8000000000000 nr=6
>
> Then we get out the first dirty folio from the batch and attempt to lock it:
>
> netfs_folio: i=10000004f52 ix=00003-00003 ceph-wb-lock
>
> which succeeds. We then pass through a number of lines:
>
> netfs_ceph_wp_track: i=10000004f52 line=1218
>
> which is the "/* shift unused page to beginning of fbatch */" comment, then:
>
> netfs_ceph_wp_track: i=10000004f52 line=1238
>
> which is followed by "offset = ceph_fscrypt_page_offset(pages[0]);", then:
>
> netfs_ceph_wp_track: i=10000004f52 line=1264
>
> which is the error handling path of:
>
> if (!ceph_inc_osd_stopping_blocker(fsc->mdsc)) {
> rc = -EIO;
> goto release_folios;
> }
>
> and then:
>
> netfs_ceph_wp_track: i=10000004f52 line=1389
>
> which is "release_folios:".
>
> We then reenter ceph_writepages_start(), get the same batch of dirty folios
> and try to lock them again:
>
> netfs_ceph_writepages: i=10000004f52 ix=0
> netfs_ceph_wp_get_folios: i=10000004f52 oix=0 ix=8000000000000 nr=6
> netfs_folio: i=10000004f52 ix=00003-00003 ceph-wb-lock
>
> and that's where we hang.
>
> I think the problem is that the error handling here:
>
> if (!ceph_inc_osd_stopping_blocker(fsc->mdsc)) {
> rc = -EIO;
> goto release_folios;
> }
>
> is insufficient. The folios are locked and can't just be released.
>
> Why ceph_inc_osd_stopping_blocker() fails is also something that needs looking
> at.
>
Yeah, I am trying to solve this issue now. :) I am reproducing the issue for
generic/421.
It's only the first issue. Also this code [1] doesn't work because page is
already locked and it will be unlocked only in writepages_finish():
if (folio_test_writeback(folio) ||
folio_test_private_2(folio) /* [DEPRECATED] */) {
if (wbc->sync_mode == WB_SYNC_NONE) {
doutc(cl, "%p under writeback\n",
folio);
folio_unlock(folio);
continue;
}
doutc(cl, "waiting on writeback %p\n", folio);
folio_wait_writeback(folio);
folio_wait_private_2(folio); /* [DEPRECATED] */
}
It looks like we need to check it before the lock here [2].
And even after solving these two issues, I can see dirty memory pages after
unmount finish. Something wrong yet in ceph_writepages_start() logic. So, I am
trying to figure out what I am missing here yet.
[1] https://elixir.bootlin.com/linux/v6.13-rc3/source/fs/ceph/addr.c#L1101
[2] https://elixir.bootlin.com/linux/v6.13-rc3/source/fs/ceph/addr.c#L1059
next prev parent reply other threads:[~2025-01-28 20:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-17 3:50 [PATCH v2] ceph: Fix kernel crash in generic/397 test Viacheslav Dubeyko
2025-01-17 12:06 ` Ilya Dryomov
2025-01-17 19:18 ` Viacheslav Dubeyko
2025-01-17 21:32 ` David Howells
2025-01-17 22:08 ` Viacheslav Dubeyko
2025-01-20 9:33 ` David Howells
2025-01-20 9:47 ` Alex Markuze
2025-01-27 18:40 ` Viacheslav Dubeyko
2025-01-28 16:13 ` David Howells
2025-01-28 16:57 ` David Howells
2025-01-28 20:01 ` David Howells
2025-01-28 20:16 ` Viacheslav Dubeyko [this message]
2025-01-28 22:34 ` David Howells
2025-01-28 22:37 ` Viacheslav Dubeyko
2025-01-29 10:39 ` Alex Markuze
2025-01-29 13:42 ` David Howells
2025-01-29 13:54 ` Alex Markuze
2025-01-29 13:41 ` David Howells
2025-01-29 19:16 ` Viacheslav Dubeyko
2025-02-14 20:29 ` David Howells
2025-02-14 20:54 ` Viacheslav Dubeyko
2025-04-15 17:59 ` Viacheslav Dubeyko
2025-06-01 16:23 ` Ilya Dryomov
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=d81a04646f76e0b65cd1e075ab3d410c4b9c3876.camel@ibm.com \
--to=slava.dubeyko@ibm.com \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=dhowells@redhat.com \
--cc=idryomov@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=slava@dubeyko.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.