All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>,
	Dave Chinner <david@fromorbit.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: question about mapping_set_error when writeback fails?
Date: Wed, 2 Jun 2021 13:27:56 -0700	[thread overview]
Message-ID: <20210602202756.GA26333@locust> (raw)

In iomap_finish_page_writeback,

static void
iomap_finish_page_writeback(struct inode *inode, struct page *page,
		int error, unsigned int len)
{
	struct iomap_page *iop = to_iomap_page(page);

	if (error) {
		SetPageError(page);
		mapping_set_error(inode->i_mapping, -EIO);

Why don't we pass error to mapping_set_error here?  If the writeback
completion failed due to insufficient space (e.g. extent mapping btree
expansion hit ENOSPC while trying to perform an unwritten extent
conversion) then we set AS_EIO which causes fsync to return EIO instead
of ENOSPC like you'd expect.

The line in question was lifted from XFS; is this a historical behavior
from before we had AS_ENOSPC?  Or do we always set AS_EIO because that's
the error code that everyone understands (ha) to mean that writeback
failed and now we have no idea what's on disk vs. in the pagecache?

(I tried to figure out what ext4 and btrfs do to handle this, but ...
that was a twisty code maze and I gave up.)

--D

             reply	other threads:[~2021-06-02 20:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 20:27 Darrick J. Wong [this message]
2021-06-02 22:26 ` question about mapping_set_error when writeback fails? Matthew Wilcox
2021-06-03 18:02   ` Jeff Layton

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=20210602202756.GA26333@locust \
    --to=djwong@kernel.org \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --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 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.