Commit 44bd70c3 authored by Mike Galbraith's avatar Mike Galbraith Committed by Jens Axboe

drivers/block/loop.c: ratelimit error messages

Metric tons of high speed spew is not helpful when things go pear shaped.
systemd lost its mind, forgot how to stop services it insists on being
sole manager of, massive printk() flood ensued, box eventually died.

[16206.684000] loop: Write error at byte offset 11412291584, length 4096.
[16206.684000] systemd-journald[1758]: /dev/kmsg buffer overrun, some messages lost.
[16206.684000] loop: Write error at byte offset 13155434496, length 4096.
[16206.684000] loop: Write error at byte offset 13155438592, length 4096.
[16206.684000] loop: Write error at byte offset 13155442688, length 4096.
[16206.684000] loop: Write error at byte offset 13960736768, length 4096.
[16206.684000] loop: Write error at byte offset 14229172224, length 4096.
[16206.684000] systemd-journald[1758]: /dev/kmsg buffer overrun, some messages lost.
[16206.684000] loop: Write error at byte offset 14766043136, length 4096.
[16206.684000] loop: Write error at byte offset 15034478592, length 4096.
[16206.684000] systemd-journald[1758]: /dev/kmsg buffer overrun, some messages lost.
Signed-off-by: default avatarMike Galbraith <bitbucket@online.de>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent bccb5f7c
...@@ -237,7 +237,7 @@ static int __do_lo_send_write(struct file *file, ...@@ -237,7 +237,7 @@ static int __do_lo_send_write(struct file *file,
file_end_write(file); file_end_write(file);
if (likely(bw == len)) if (likely(bw == len))
return 0; return 0;
printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n", printk_ratelimited(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n",
(unsigned long long)pos, len); (unsigned long long)pos, len);
if (bw >= 0) if (bw >= 0)
bw = -EIO; bw = -EIO;
...@@ -277,7 +277,7 @@ static int do_lo_send_write(struct loop_device *lo, struct bio_vec *bvec, ...@@ -277,7 +277,7 @@ static int do_lo_send_write(struct loop_device *lo, struct bio_vec *bvec,
return __do_lo_send_write(lo->lo_backing_file, return __do_lo_send_write(lo->lo_backing_file,
page_address(page), bvec->bv_len, page_address(page), bvec->bv_len,
pos); pos);
printk(KERN_ERR "loop: Transfer error at byte offset %llu, " printk_ratelimited(KERN_ERR "loop: Transfer error at byte offset %llu, "
"length %i.\n", (unsigned long long)pos, bvec->bv_len); "length %i.\n", (unsigned long long)pos, bvec->bv_len);
if (ret > 0) if (ret > 0)
ret = -EIO; ret = -EIO;
...@@ -316,7 +316,7 @@ static int lo_send(struct loop_device *lo, struct bio *bio, loff_t pos) ...@@ -316,7 +316,7 @@ static int lo_send(struct loop_device *lo, struct bio *bio, loff_t pos)
out: out:
return ret; return ret;
fail: fail:
printk(KERN_ERR "loop: Failed to allocate temporary page for write.\n"); printk_ratelimited(KERN_ERR "loop: Failed to allocate temporary page for write.\n");
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -345,7 +345,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf, ...@@ -345,7 +345,7 @@ lo_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
size = p->bsize; size = p->bsize;
if (lo_do_transfer(lo, READ, page, buf->offset, p->page, p->offset, size, IV)) { if (lo_do_transfer(lo, READ, page, buf->offset, p->page, p->offset, size, IV)) {
printk(KERN_ERR "loop: transfer error block %ld\n", printk_ratelimited(KERN_ERR "loop: transfer error block %ld\n",
page->index); page->index);
size = -EINVAL; size = -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment