All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: <jack@suse.cz>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: __buffer_migrate_page() vs ll_rw_block()
Date: Tue, 1 Jun 2021 15:23:17 +0200	[thread overview]
Message-ID: <20210601132316.GA27976@axis.com> (raw)

I'm seeing occasional squashfs read failures ("squashfs_read_data failed
to read block") when compaction is run at the same time as reading from
squashfs, with something like the commands below.  The kernel version is
the latest stable/v5.4 kernel, v5.4.123.

 while :; do echo 1 > /proc/sys/vm/compact_memory; done &
 while :; do echo 3 > /proc/sys/vm/drop_caches; find fs/ > /dev/null; done &

On this kernel, squashfs uses ll_rw_block().  The problem is that
ll_rw_block() ignores BHs which it can't get a lock on, but
__buffer_migrate_page() can take the lock on the BHs in order to check
if they can be migrated.  If __buffer_migrate_page() holds the lock at
the same time that ll_rw_block() wants it, the BH is skipped and I/O is
not issued for these blocks, and squashfs ends up seeing
!buffer_uptodate() and erroring out.

On newer kernels, squashfs doesn't use ll_rw_block() anymore, but I
still see other users of that function in other filesystems, and AFAICS
the underlying problem of the race with __buffer_migrate_page() has not
yet been fixed.

I'd be happy to receive any suggestions about the right way to fix this.

Thank you.


             reply	other threads:[~2021-06-01 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 13:23 Vincent Whitchurch [this message]
2021-06-02 14:52 ` __buffer_migrate_page() vs ll_rw_block() Jan Kara

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=20210601132316.GA27976@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 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.