diff options
author | Jeff Layton <jlayton@redhat.com> | 2018-05-21 14:35:03 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-05-21 12:36:03 -0600 |
commit | eedffa28c9b00ca2dcb4d541b5a530f4c917052d (patch) | |
tree | 10ce33f80746ba7cb5a5ac210ffd38ed967ea15e | |
parent | f7068114d45ec55996b9040e98111afa56e010fe (diff) | |
download | linux-eedffa28c9b00ca2dcb4d541b5a530f4c917052d.tar.bz2 |
loop: clear wb_err in bd_inode when detaching backing file
When a loop block device encounters a writeback error, that error will
get propagated to the bd_inode's wb_err field. If we then detach the
backing file from it, attach another and fsync it, we'll get back the
writeback error that we had from the previous backing file.
This is a bit of a grey area as POSIX doesn't cover loop devices, but it
is somewhat counterintuitive.
If we detach a backing file from the loopdev while there are still
unreported errors, take it as a sign that we're no longer interested in
the previous file, and clear out the wb_err in the loop blockdev.
Reported-and-Tested-by: Theodore Y. Ts'o <tytso@mit.edu>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/block/loop.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 5d4e31655d96..55cf554bc914 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1068,6 +1068,7 @@ static int loop_clr_fd(struct loop_device *lo) if (bdev) { bdput(bdev); invalidate_bdev(bdev); + bdev->bd_inode->i_mapping->wb_err = 0; } set_capacity(lo->lo_disk, 0); loop_sysfs_exit(lo); |