linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Why does mpage_writepage() not handle locked buffers?
Date: Fri, 15 Dec 2023 05:43:53 +0000	[thread overview]
Message-ID: <ZXvnmfXG4xN8BQxI@casper.infradead.org> (raw)

I tried this:

-static int blkdev_writepage(struct page *page, struct writeback_control *wbc)
+static int blkdev_writepages(struct address_space *mapping,
+               struct writeback_control *wbc)
 {
-       return block_write_full_page(page, blkdev_get_block, wbc);
+       return mpage_writepages(mapping, wbc, blkdev_get_block);
 }

and I hit the BUG_ON(buffer_locked(bh)); in __mpage_writepage() which
has been there since you added it in 2002.

block_write_full_page() handles this fine, so why isn't this

	if (buffer_locked(bh))
		goto confused;

Is the thought that we hold the folio locked, therefore no buffers
should be locked at this time?  I don't know the rules.

In case it's relevant, I hit this while running xfstests generic/013
with ext4 and the stack backtrace is:

__mpage_writepage+0x18d/0x7c0
 write_cache_pages+0x17e/0x480
 mpage_writepages+0x44/0x80
 blkdev_writepages+0x10/0x20
 do_writepages+0xa9/0x150
 filemap_fdatawrite+0x70/0x80
 sync_bdevs+0x151/0x160
 ksys_sync+0x55/0x80


             reply	other threads:[~2023-12-15  5:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  5:43 Matthew Wilcox [this message]
2023-12-15 10:49 ` Why does mpage_writepage() not handle locked buffers? Christoph Hellwig
2023-12-15 17:21   ` Matthew Wilcox

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=ZXvnmfXG4xN8BQxI@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).