]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/block-suppress-buffer-IO-errors
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / block-suppress-buffer-IO-errors
1 Subject: block: Supress Buffer I/O errors when SCSI REQ_QUIET flag set
2 From: Keith Mannthey <kmannth@us.ibm.com>
3 Date: Mon Dec 29 08:28:44 2008 +0100:
4 Git: 08bafc0341f2f7920e9045bc32c40299cac8c21b
5 References: bnc#464155
6
7 Allow the scsi request REQ_QUIET flag to be propagated to the buffer
8 file system layer. The basic ideas is to pass the flag from the scsi
9 request to the bio (block IO) and then to the buffer layer. The buffer
10 layer can then suppress needless printks.
11
12 This patch declutters the kernel log by removed the 40-50 (per lun)
13 buffer io error messages seen during a boot in my multipath setup . It
14 is a good chance any real errors will be missed in the "noise" it the
15 logs without this patch.
16
17 During boot I see blocks of messages like
18 "
19 __ratelimit: 211 callbacks suppressed
20 Buffer I/O error on device sdm, logical block 5242879
21 Buffer I/O error on device sdm, logical block 5242879
22 Buffer I/O error on device sdm, logical block 5242847
23 Buffer I/O error on device sdm, logical block 1
24 Buffer I/O error on device sdm, logical block 5242878
25 Buffer I/O error on device sdm, logical block 5242879
26 Buffer I/O error on device sdm, logical block 5242879
27 Buffer I/O error on device sdm, logical block 5242879
28 Buffer I/O error on device sdm, logical block 5242879
29 Buffer I/O error on device sdm, logical block 5242872
30 "
31 in my logs.
32
33 My disk environment is multipath fiber channel using the SCSI_DH_RDAC
34 code and multipathd. This topology includes an "active" and "ghost"
35 path for each lun. IO's to the "ghost" path will never complete and the
36 SCSI layer, via the scsi device handler rdac code, quick returns the IOs
37 to theses paths and sets the REQ_QUIET scsi flag to suppress the scsi
38 layer messages.
39
40 I am wanting to extend the QUIET behavior to include the buffer file
41 system layer to deal with these errors as well. I have been running this
42 patch for a while now on several boxes without issue. A few runs of
43 bonnie++ show no noticeable difference in performance in my setup.
44
45 Thanks for John Stultz for the quiet_error finalization.
46
47 Submitted-by: Keith Mannthey <kmannth@us.ibm.com>
48 Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
49 Signed-off-by: Hannes Reinecke <hare@suse.de>
50
51 ---
52 block/blk-core.c | 3 +++
53 fs/buffer.c | 19 +++++++++++++++----
54 include/linux/bio.h | 1 +
55 include/linux/buffer_head.h | 1 +
56 4 files changed, 20 insertions(+), 4 deletions(-)
57
58 --- a/block/blk-core.c
59 +++ b/block/blk-core.c
60 @@ -138,6 +138,9 @@ static void req_bio_endio(struct request
61 nbytes = bio->bi_size;
62 }
63
64 + if (unlikely(rq->cmd_flags & REQ_QUIET))
65 + set_bit(BIO_QUIET, &bio->bi_flags);
66 +
67 bio->bi_size -= nbytes;
68 bio->bi_sector += (nbytes >> 9);
69
70 --- a/fs/buffer.c
71 +++ b/fs/buffer.c
72 @@ -100,10 +100,18 @@ __clear_page_buffers(struct page *page)
73 page_cache_release(page);
74 }
75
76 +
77 +static int quiet_error(struct buffer_head *bh)
78 +{
79 + if (!test_bit(BH_Quiet, &bh->b_state) && printk_ratelimit())
80 + return 0;
81 + return 1;
82 +}
83 +
84 +
85 static void buffer_io_error(struct buffer_head *bh)
86 {
87 char b[BDEVNAME_SIZE];
88 -
89 printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
90 bdevname(bh->b_bdev, b),
91 (unsigned long long)bh->b_blocknr);
92 @@ -145,7 +153,7 @@ void end_buffer_write_sync(struct buffer
93 if (uptodate) {
94 set_buffer_uptodate(bh);
95 } else {
96 - if (!buffer_eopnotsupp(bh) && printk_ratelimit()) {
97 + if (!buffer_eopnotsupp(bh) && !quiet_error(bh)) {
98 buffer_io_error(bh);
99 printk(KERN_WARNING "lost page write due to "
100 "I/O error on %s\n",
101 @@ -395,7 +403,7 @@ static void end_buffer_async_read(struct
102 set_buffer_uptodate(bh);
103 } else {
104 clear_buffer_uptodate(bh);
105 - if (printk_ratelimit())
106 + if (!quiet_error(bh))
107 buffer_io_error(bh);
108 SetPageError(page);
109 }
110 @@ -456,7 +464,7 @@ static void end_buffer_async_write(struc
111 if (uptodate) {
112 set_buffer_uptodate(bh);
113 } else {
114 - if (printk_ratelimit()) {
115 + if (!quiet_error(bh)) {
116 buffer_io_error(bh);
117 printk(KERN_WARNING "lost page write due to "
118 "I/O error on %s\n",
119 @@ -2958,6 +2966,9 @@ static void end_bio_bh_io_sync(struct bi
120 set_bit(BH_Eopnotsupp, &bh->b_state);
121 }
122
123 + if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags)))
124 + set_bit(BH_Quiet, &bh->b_state);
125 +
126 bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
127 bio_put(bio);
128 }
129 --- a/include/linux/bio.h
130 +++ b/include/linux/bio.h
131 @@ -116,6 +116,7 @@ struct bio {
132 #define BIO_EOPNOTSUPP 7 /* not supported */
133 #define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
134 #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
135 +#define BIO_QUIET 11 /* Make BIO Quiet */
136 #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
137
138 /*
139 --- a/include/linux/buffer_head.h
140 +++ b/include/linux/buffer_head.h
141 @@ -35,6 +35,7 @@ enum bh_state_bits {
142 BH_Ordered, /* ordered write */
143 BH_Eopnotsupp, /* operation not supported (barrier) */
144 BH_Unwritten, /* Buffer is allocated on disk but not written */
145 + BH_Quiet, /* Buffer Error Prinks to be quiet */
146
147 BH_PrivateStart,/* not a state bit, but the first bit available
148 * for private allocation by other entities