]> git.baikalelectronics.ru Git - kernel.git/commit
loop: clear wb_err in bd_inode when detaching backing file
authorJeff Layton <jlayton@redhat.com>
Mon, 21 May 2018 18:35:03 +0000 (14:35 -0400)
committerJens Axboe <axboe@kernel.dk>
Mon, 21 May 2018 18:36:03 +0000 (12:36 -0600)
commitff18d022de7f6c8d48b9a4e9a5c894efde0262e2
tree10ce33f80746ba7cb5a5ac210ffd38ed967ea15e
parentb35027cd97c90f88fb77a83b42ad47afe181271f
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>
drivers/block/loop.c