]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.fixes/block-suppress-buffer-IO-errors
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / block-suppress-buffer-IO-errors
CommitLineData
2cb7cef9
BS
1Subject: block: Supress Buffer I/O errors when SCSI REQ_QUIET flag set
2From: Keith Mannthey <kmannth@us.ibm.com>
3Date: Mon Dec 29 08:28:44 2008 +0100:
4Git: 08bafc0341f2f7920e9045bc32c40299cac8c21b
5References: bnc#464155
6
7Allow the scsi request REQ_QUIET flag to be propagated to the buffer
8file system layer. The basic ideas is to pass the flag from the scsi
9request to the bio (block IO) and then to the buffer layer. The buffer
10layer can then suppress needless printks.
11
12This patch declutters the kernel log by removed the 40-50 (per lun)
13buffer io error messages seen during a boot in my multipath setup . It
14is a good chance any real errors will be missed in the "noise" it the
15logs without this patch.
16
17During boot I see blocks of messages like
18"
19__ratelimit: 211 callbacks suppressed
20Buffer I/O error on device sdm, logical block 5242879
21Buffer I/O error on device sdm, logical block 5242879
22Buffer I/O error on device sdm, logical block 5242847
23Buffer I/O error on device sdm, logical block 1
24Buffer I/O error on device sdm, logical block 5242878
25Buffer I/O error on device sdm, logical block 5242879
26Buffer I/O error on device sdm, logical block 5242879
27Buffer I/O error on device sdm, logical block 5242879
28Buffer I/O error on device sdm, logical block 5242879
29Buffer I/O error on device sdm, logical block 5242872
30"
31in my logs.
32
33My disk environment is multipath fiber channel using the SCSI_DH_RDAC
34code and multipathd. This topology includes an "active" and "ghost"
35path for each lun. IO's to the "ghost" path will never complete and the
36SCSI layer, via the scsi device handler rdac code, quick returns the IOs
37to theses paths and sets the REQ_QUIET scsi flag to suppress the scsi
38layer messages.
39
40 I am wanting to extend the QUIET behavior to include the buffer file
41system layer to deal with these errors as well. I have been running this
42patch for a while now on several boxes without issue. A few runs of
43bonnie++ show no noticeable difference in performance in my setup.
44
45Thanks for John Stultz for the quiet_error finalization.
46
47Submitted-by: Keith Mannthey <kmannth@us.ibm.com>
48Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
49Signed-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