From: Jeff Layton <jlayton@kernel.org>
To: "Theodore Y. Ts'o" <tytso@mit.edu>, Matthew Wilcox <willy@infradead.org>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>,
linux-fsdevel@vger.kernel.org, fstests@vger.kernel.org,
xfs <linux-xfs@vger.kernel.org>,
linux-block <linux-block@vger.kernel.org>
Subject: Re: [PATCH] fs: clear writeback errors in inode_init_always
Date: Mon, 21 May 2018 07:20:05 -0400 [thread overview]
Message-ID: <a11668bbe2050c8b5fb8f27b8b301ba8a78e6a97.camel@kernel.org> (raw)
In-Reply-To: <20180520194124.GB5072@thunk.org>
On Sun, 2018-05-20 at 15:41 -0400, Theodore Y. Ts'o wrote:
> On Sun, May 20, 2018 at 12:20:09PM -0700, Matthew Wilcox wrote:
> > Oh! I misunderstood. I thought that bd_inode->i_mapping pointed to
> > lo_backing_file->f_mapping.
> >
> > So how about this to preserve the error _in the file with the error_?
> >
> > if (bdev) {
> > bdput(bdev);
> > invalidate_bdev(bdev);
> > + filp->f_mapping->wb_err = bdev->bd_inode->i_mapping->wb_err;
> > + bdev->bd_inode->i_mapping->wb_err = 0;
> > }
> > set_capacity(lo->lo_disk, 0);
> > loop_sysfs_exit(lo);
>
> I don't think it's necessary. wb_err on the underlying file would
> have already been set when the error was set. So if someone tried
> calling fsync(2) on the underlying file, it would have collected the
> error already. Re-setting the error when we detach the loop device
> doesn't seem to make any sense.
>
(cc'ing linux-block)
Yes, the error would have been set on the original file already. As long
as lo_req_flush or __loop_update_dio weren't called before we detach the
device, it should still be possible to call fsync on the original fd and
get back the error.
As a side note, it looks like __loop_update_dio will discard an error
from vfs_fsync, so certain ioctls against a loop device can cause errors
to be lost. It seems like those ought to get propagated to userland or
to the blockdev's mapping somehow.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2018-05-21 11:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 22:50 commit b4678df184b causing xfstests regressions Theodore Y. Ts'o
2018-05-19 2:17 ` Matthew Wilcox
2018-05-19 13:09 ` Jeff Layton
2018-05-19 15:25 ` Darrick J. Wong
2018-05-19 15:27 ` [PATCH] fs: clear writeback errors in inode_init_always Darrick J. Wong
2018-05-19 15:36 ` Matthew Wilcox
2018-05-21 17:54 ` Darrick J. Wong
2018-05-22 10:30 ` Jeff Layton
2018-05-22 22:09 ` Dave Chinner
2018-05-23 10:56 ` Jeff Layton
2018-05-24 3:59 ` Dave Chinner
2018-05-19 23:19 ` Theodore Y. Ts'o
2018-05-20 11:45 ` Jeff Layton
2018-05-20 12:58 ` Matthew Wilcox
2018-05-20 13:18 ` Jeff Layton
2018-05-20 16:29 ` Theodore Y. Ts'o
2018-05-20 19:20 ` Matthew Wilcox
2018-05-20 19:41 ` Theodore Y. Ts'o
2018-05-21 11:20 ` Jeff Layton [this message]
2018-05-21 14:43 ` Theodore Y. Ts'o
2018-05-20 17:57 ` Theodore Y. Ts'o
2018-05-22 4:06 ` [PATCH v2] " Darrick J. Wong
2018-05-22 10:14 ` Jeff Layton
2018-05-22 12:14 ` Brian Foster
2018-05-22 14:37 ` Darrick J. Wong
2018-05-22 16:43 ` [PATCH v3] " Darrick J. Wong
2018-05-22 18:40 ` Brian Foster
2018-05-22 18:47 ` Darrick J. Wong
2018-05-22 22:05 ` Dave Chinner
2018-05-23 3:00 ` Darrick J. Wong
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=a11668bbe2050c8b5fb8f27b8b301ba8a78e6a97.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=darrick.wong@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=willy@infradead.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).