aboutsummaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-09-22 06:43:17 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-09-22 06:43:17 -0400
commitbf3c0e5e7102f5787d693379d9d384b813fe890b (patch)
treeaa48fc57dee9ecdf99918affa38d1b06be41419a /fs/buffer.c
parent32251b07d532174d66941488c112ec046f646157 (diff)
parent976bc5e2aceedef13e0ba1f0e6e372a22164aa0c (diff)
downloadkernel_replicant_linux-bf3c0e5e7102f5787d693379d9d384b813fe890b.tar.gz
kernel_replicant_linux-bf3c0e5e7102f5787d693379d9d384b813fe890b.tar.bz2
kernel_replicant_linux-bf3c0e5e7102f5787d693379d9d384b813fe890b.zip
Merge branch 'x86-seves-for-paolo' of https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into HEAD
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 061dd202979d..50bbc99e3d96 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1958,7 +1958,7 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
*/
set_buffer_new(bh);
set_buffer_unwritten(bh);
- /* FALLTHRU */
+ fallthrough;
case IOMAP_MAPPED:
if ((iomap->flags & IOMAP_F_NEW) ||
offset >= i_size_read(inode))
@@ -3157,6 +3157,15 @@ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
WARN_ON(atomic_read(&bh->b_count) < 1);
lock_buffer(bh);
if (test_clear_buffer_dirty(bh)) {
+ /*
+ * The bh should be mapped, but it might not be if the
+ * device was hot-removed. Not much we can do but fail the I/O.
+ */
+ if (!buffer_mapped(bh)) {
+ unlock_buffer(bh);
+ return -EIO;
+ }
+
get_bh(bh);
bh->b_end_io = end_buffer_write_sync;
ret = submit_bh(REQ_OP_WRITE, op_flags, bh);