dm-flakey NOT to return -EIO on READ?
Hi,
I am using dm-flakey to emulate a broken device that should return -EIO on both read and write. I use the parameter up_interval=0 and down_interval=1.
But when I am dd-ing the flakey device, while write fails, read succeeds. This isn't the behavior I expect.
Then I looked into the code.
326 static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error) 327 {
328 struct flakey_c *fc = ti->private;
329 struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct per_bio_data));
330
331 /*
332 * Corrupt successful READs while in down state. 333 * If flags were specified, only corrupt those that match. 334 */
335 if (fc->corrupt_bio_byte && !error && pb->bio_submitted &&
336 (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw == READ) &&
337 all_corrupt_bio_flags_match(bio, fc))
338 corrupt_bio_data(bio, fc);
339
340 return error;
341 }
When the bio direction is READ and currupt_bio_bytes isn't specified the READ bio is handled normally right?
I think READ requests should return -EIO if
1. corrupt_bio_bytes isn't specified
2. but the requested is handled during down interval.
as well as WRITE requests:
305 /*
306 * Corrupt matching writes.
307 */
308 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == WRITE)) {
309 if (all_corrupt_bio_flags_match(bio, fc))
310 corrupt_bio_data(bio, fc);
311 goto map_bio;
312 }
313
314 /*
315 * By default, error all I/O.
316 */
317 return -EIO;
318 }
This code is similar to what we see in the end_io.
If my understanding is correct, I would like to modify dm-flakey to return -EIO in the end_io.
I would like to request for comments.
Thanks,
- Akira
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.
Lukas
Quoted 73 lines · Akira Hayakawa
Hi,
I am using dm-flakey to emulate a broken device that should return
-EIOon both read and write.
I use the parameter up_interval=0 and down_interval=1.But when I am dd-ing the flakey device, while write fails, read succeeds. This isn't the behavior I expect.
Then I looked into the code.
326 static int
flakey_end_io(struct dm_target *ti, struct bio *bio, int error)
327 {
328 structflakey_c*fc =ti->private;
329 structper_bio_data*pb = dm_per_bio_data(bio, sizeof(structper_bio_data));
330
331 /*332 * Corrupt successful READs while in down state. 333 * If flags were specified, only corrupt those that match. 334 */335 if (
fc->corrupt_bio_byte&& !error &&pb->bio_submitted&&
336 (bio_data_dir(bio)== READ) && (fc->corrupt_bio_rw==
READ) &&
337all_corrupt_bio_flags_match(bio, fc))
338corrupt_bio_data(bio, fc);
339
340 return error;
341 }When the bio direction is READ and
currupt_bio_bytesisn't specified the READ bio is handled normally right?I think READ requests should return
-EIOif1.
corrupt_bio_bytesisn't specified
2. but the requested is handled during down interval.as well as WRITE requests:
305 /*
306 * Corrupt matching writes.
307 */
308 if (fc->corrupt_bio_byte&& (fc->corrupt_bio_rw==
WRITE)) {
309 if (all_corrupt_bio_flags_match(bio, fc))
310corrupt_bio_data(bio, fc);
311 gotomap_bio;
312 }
313
314 /*
315 * By default, error all I/O.
316 */
317 return-EIO;
318 }This code is similar to what we see in the
end_io.If my understanding is correct, I would like to modify dm-flakey to return
-EIOin theend_io.I would like to request for comments.
Thanks,
- Akira
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 5 lines
Lukas Herbolt RHCE, RH436, BSc, SSc Senior Technical Support Engineer Global Support Services (GSS) Email: [email protected]
Thanks,
I want the patch in the main-tree quickly.
Because without it, my tests will not be green.
This is really annoying.
I made a quick reproducer of this problem.
If you are looking for one, this will help.
(You need to install sbt first)
https://github.com/akiradeveloper/writeboost-test-suite
test("flakey (read)") {
Memory(Sector.M(16)) { a =>
Flakey.Table(a, 0, 1).create { b =>
intercept[Exception] {
Shell(s"dd status=none if=${b.bdev.path} iflag=direct of=/dev/null")
}
}
}
}$ sudo sbt "testOnly dmtest.FlakeyTest" 12:44:00.643 [pool-2-thread-3-ScalaTest-running-FlakeyTest] INFO dmtest - [TEST] flakey (read) 12:44:00.752 [pool-2-thread-3-ScalaTest-running-FlakeyTest] DEBUG dmtest - reload: table=0 32768 flakey /dev/loop0 0 0 1 [info] FlakeyTest: [info] - flakey (read) *** FAILED *** [info] Expected exception java.lang.Exception to be thrown, but no exception was thrown. (FlakeyTest.scala:9) [info] Run completed in 2 seconds, 781 milliseconds. [info] Total number of tests run: 1 [info] Suites: completed 1, aborted 0 [info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
- Akira
Quoted 84 lines · Lukas Herbolt
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.Lukas
Quoted 73 lines · Akira Hayakawa
Hi,
I am using dm-flakey to emulate a broken device that should return
-EIOon both read and write.
I use the parameter up_interval=0 and down_interval=1.But when I am dd-ing the flakey device, while write fails, read succeeds. This isn't the behavior I expect.
Then I looked into the code.
326 static int
flakey_end_io(struct dm_target *ti, struct bio *bio, int error)
327 {
328 structflakey_c*fc =ti->private;
329 structper_bio_data*pb = dm_per_bio_data(bio, sizeof(structper_bio_data));
330
331 /*332 * Corrupt successful READs while in down state. 333 * If flags were specified, only corrupt those that match. 334 */335 if (
fc->corrupt_bio_byte&& !error &&pb->bio_submitted&&
336 (bio_data_dir(bio)== READ) && (fc->corrupt_bio_rw==
READ) &&
337all_corrupt_bio_flags_match(bio, fc))
338corrupt_bio_data(bio, fc);
339
340 return error;
341 }When the bio direction is READ and
currupt_bio_bytesisn't specified the READ bio is handled normally right?I think READ requests should return
-EIOif1.
corrupt_bio_bytesisn't specified
2. but the requested is handled during down interval.as well as WRITE requests:
305 /*
306 * Corrupt matching writes.
307 */
308 if (fc->corrupt_bio_byte&& (fc->corrupt_bio_rw==
WRITE)) {
309 if (all_corrupt_bio_flags_match(bio, fc))
310corrupt_bio_data(bio, fc);
311 gotomap_bio;
312 }
313
314 /*
315 * By default, error all I/O.
316 */
317 return-EIO;
318 }This code is similar to what we see in the
end_io.If my understanding is correct, I would like to modify dm-flakey to return
-EIOin theend_io.I would like to request for comments.
Thanks,
- Akira
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Quoted 4 lines · Lukas Herbolt
Quoted 3 lines
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.
btw, is this fix going to be included in the next release?
Quoted 120 lines · Akira Hayakawa
Thanks,
I want the patch in the main-tree quickly.
Because without it, my tests will not be green.
This is really annoying.I made a quick reproducer of this problem.
If you are looking for one, this will help.
(You need to install sbt first)https://github.com/akiradeveloper/writeboost-test-suite
test("flakey (read)") { Memory(Sector.M(16)) { a => Flakey.Table(a, 0, 1).create { b => intercept[Exception] { Shell(s"dd status=none if=${b.bdev.path} iflag=direct of=/dev/null") } } } }$ sudo sbt "testOnly dmtest.FlakeyTest" 12:44:00.643 [pool-2-thread-3-ScalaTest-running-FlakeyTest] INFO dmtest - [TEST] flakey (read) 12:44:00.752 [pool-2-thread-3-ScalaTest-running-FlakeyTest] DEBUG dmtest - reload: table=0 32768 flakey /dev/loop0 0 0 1 [info] FlakeyTest: [info] - flakey (read) *** FAILED *** [info] Expected exception java.lang.Exception to be thrown, but no exception was thrown. (FlakeyTest.scala:9) [info] Run completed in 2 seconds, 781 milliseconds. [info] Total number of tests run: 1 [info] Suites: completed 1, aborted 0 [info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0- Akira
Quoted 84 lines · Lukas Herbolt
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.Lukas
Quoted 73 lines · Akira Hayakawa
Hi,
I am using dm-flakey to emulate a broken device that should return
-EIOon both read and write.
I use the parameter up_interval=0 and down_interval=1.But when I am dd-ing the flakey device, while write fails, read succeeds. This isn't the behavior I expect.
Then I looked into the code.
326 static int
flakey_end_io(struct dm_target *ti, struct bio *bio, int error)
327 {
328 structflakey_c*fc =ti->private;
329 structper_bio_data*pb = dm_per_bio_data(bio, sizeof(structper_bio_data));
330
331 /*332 * Corrupt successful READs while in down state. 333 * If flags were specified, only corrupt those that match. 334 */335 if (
fc->corrupt_bio_byte&& !error &&pb->bio_submitted&&
336 (bio_data_dir(bio)== READ) && (fc->corrupt_bio_rw==
READ) &&
337all_corrupt_bio_flags_match(bio, fc))
338corrupt_bio_data(bio, fc);
339
340 return error;
341 }When the bio direction is READ and
currupt_bio_bytesisn't specified the READ bio is handled normally right?I think READ requests should return
-EIOif1.
corrupt_bio_bytesisn't specified
2. but the requested is handled during down interval.as well as WRITE requests:
305 /*
306 * Corrupt matching writes.
307 */
308 if (fc->corrupt_bio_byte&& (fc->corrupt_bio_rw==
WRITE)) {
309 if (all_corrupt_bio_flags_match(bio, fc))
310corrupt_bio_data(bio, fc);
311 gotomap_bio;
312 }
313
314 /*
315 * By default, error all I/O.
316 */
317 return-EIO;
318 }This code is similar to what we see in the
end_io.If my understanding is correct, I would like to modify dm-flakey to return
-EIOin theend_io.I would like to request for comments.
Thanks,
- Akira
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Hi Akira,
Sorry I was on holiday.
I have patch ready, would you be able to test it before posting it.
Let me know if I should build the kernel for you or just share the source with you.
Lukas
Quoted 138 lines · Akira Hayakawa
Quoted 4 lines · Lukas Herbolt
Quoted 3 lines
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.btw, is this fix going to be included in the next release?
Quoted 10 lines · Akira Hayakawa
Thanks,
I want the patch in the main-tree quickly. Because without it, my tests will not be green. This is really annoying.
I made a quick reproducer of this problem. If you are looking for one, this will help. (You need to install sbt first)
Quoted 7 lines
https://github.com/akiradeveloper/writeboost-test-suite
test("flakey (read)") { Memory(Sector.M(16)) { a => Flakey.Table(a, 0, 1).create { b => intercept[Exception] { Shell(s"dd status=none if=${b.bdev.path} iflag=directof=/dev/null")
Quoted 7 lines
} } }}
$ sudo sbt "testOnly dmtest.FlakeyTest" 12:44:00.643 [pool-2-thread-3-ScalaTest-running-FlakeyTest] INFO dmtest- [TEST] flakey (read)
Quoted 1 line
12:44:00.752 [pool-2-thread-3-ScalaTest-running-FlakeyTest] DEBUG dmtest
- reload: table=0 32768 flakey
/dev/loop00 0 1Quoted 3 lines
[info] FlakeyTest:
[info] - flakey (read) *** FAILED ***
[info] Expected exception java.lang.Exception to be thrown, but noexception was thrown. (FlakeyTest.scala:9)
Quoted 15 lines
[info] Run completed in 2 seconds, 781 milliseconds. [info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0- Akira
Quoted 7 lines · Lukas Herbolt
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.Lukas
On Wed, Jul 6, 2016 at 8:33 AM, Akira Hayakawa <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Hi,
I am using dm-flakey to emulate a broken device that should return
-EIOonQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
both read and write.
I use the parameter up_interval=0 and down_interval=1.But when I am dd-ing the flakey device, while write fails, read
succeeds.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
This isn't the behavior I expect.
Then I looked into the code.
326 static int
flakey_end_io(struct dm_target *ti, struct bio *bio, int error)
327 {
328 structflakey_c*fc =ti->private;
329 structper_bio_data*pb = dm_per_bio_data(bio,sizeof(struct
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
per_bio_data));
330
331 /*332 * Corrupt successful READs while in down state. 333 * If flags were specified, only corrupt those that match. 334 */335 if (
fc->corrupt_bio_byte&& !error &&pb->bio_submitted&&
336 (bio_data_dir(bio)== READ) && (fc->corrupt_bio_rw==
READ) &&
337all_corrupt_bio_flags_match(bio, fc))
338corrupt_bio_data(bio, fc);
339
340 return error;
341 }When the bio direction is READ and
currupt_bio_bytesisn't specified the READ bio is handled normally right?I think READ requests should return
-EIOif1.
corrupt_bio_bytesisn't specified
2. but the requested is handled during down interval.as well as WRITE requests:
305 /*
306 * Corrupt matching writes.
307 */
308 if (fc->corrupt_bio_byte&& (fc->corrupt_bio_rw==
WRITE)) {
309 if (all_corrupt_bio_flags_match(bio, fc))
310corrupt_bio_data(bio, fc);
311 gotomap_bio;
312 }
313
314 /*
315 * By default, error all I/O.
316 */
317 return-EIO;
318 }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
This code is similar to what we see in the
end_io.If my understanding is correct, I would like to modify dm-flakey to
return
Quoted 16 lines
Quoted 16 lines
Quoted 13 lines
-EIOin theend_io.I would like to request for comments.
Thanks,
- Akira
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 5 lines
Lukas Herbolt RHCE, RH436, BSc, SSc Senior Technical Support Engineer Global Support Services (GSS) Email: [email protected]
Hi Lukas,
Quoted 4 lines
I have patch ready, would you be able to test it before posting it.
Let me know if I should build the kernel for you or just share the source with you.
OK.
Please share the git tree and specify the branch to test.
Akira
Quoted 152 lines · Lukas Herbolt
Hi Akira,
Sorry I was on holiday.
I have patch ready, would you be able to test it before posting it.Let me know if I should build the kernel for you or just share the source with you.
Lukas
Quoted 138 lines · Akira Hayakawa
Quoted 4 lines · Lukas Herbolt
Quoted 3 lines
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.btw, is this fix going to be included in the next release?
Quoted 10 lines · Akira Hayakawa
Thanks,
I want the patch in the main-tree quickly. Because without it, my tests will not be green. This is really annoying.
I made a quick reproducer of this problem. If you are looking for one, this will help. (You need to install sbt first)
Quoted 7 lines
https://github.com/akiradeveloper/writeboost-test-suite
test("flakey (read)") { Memory(Sector.M(16)) { a => Flakey.Table(a, 0, 1).create { b => intercept[Exception] { Shell(s"dd status=none if=${b.bdev.path} iflag=directof=/dev/null")
Quoted 7 lines
} } }}
$ sudo sbt "testOnly dmtest.FlakeyTest" 12:44:00.643 [pool-2-thread-3-ScalaTest-running-FlakeyTest] INFO dmtest- [TEST] flakey (read)
Quoted 1 line
12:44:00.752 [pool-2-thread-3-ScalaTest-running-FlakeyTest] DEBUG dmtest
- reload: table=0 32768 flakey
/dev/loop00 0 1Quoted 3 lines
[info] FlakeyTest:
[info] - flakey (read) *** FAILED ***
[info] Expected exception java.lang.Exception to be thrown, but noexception was thrown. (FlakeyTest.scala:9)
Quoted 15 lines
[info] Run completed in 2 seconds, 781 milliseconds. [info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0- Akira
Quoted 7 lines · Lukas Herbolt
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.Lukas
On Wed, Jul 6, 2016 at 8:33 AM, Akira Hayakawa <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Hi,
I am using dm-flakey to emulate a broken device that should return
-EIOonQuoted 4 lines
Quoted 4 lines
Quoted 4 lines
both read and write.
I use the parameter up_interval=0 and down_interval=1.But when I am dd-ing the flakey device, while write fails, read
succeeds.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
This isn't the behavior I expect.
Then I looked into the code.
326 static int
flakey_end_io(struct dm_target *ti, struct bio *bio, int error)
327 {
328 structflakey_c*fc =ti->private;
329 structper_bio_data*pb = dm_per_bio_data(bio,sizeof(struct
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
per_bio_data));
330
331 /*332 * Corrupt successful READs while in down state. 333 * If flags were specified, only corrupt those that match. 334 */335 if (
fc->corrupt_bio_byte&& !error &&pb->bio_submitted&&
336 (bio_data_dir(bio)== READ) && (fc->corrupt_bio_rw==
READ) &&
337all_corrupt_bio_flags_match(bio, fc))
338corrupt_bio_data(bio, fc);
339
340 return error;
341 }When the bio direction is READ and
currupt_bio_bytesisn't specified the READ bio is handled normally right?I think READ requests should return
-EIOif1.
corrupt_bio_bytesisn't specified
2. but the requested is handled during down interval.as well as WRITE requests:
305 /*
306 * Corrupt matching writes.
307 */
308 if (fc->corrupt_bio_byte&& (fc->corrupt_bio_rw==
WRITE)) {
309 if (all_corrupt_bio_flags_match(bio, fc))
310corrupt_bio_data(bio, fc);
311 gotomap_bio;
312 }
313
314 /*
315 * By default, error all I/O.
316 */
317 return-EIO;
318 }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
This code is similar to what we see in the
end_io.If my understanding is correct, I would like to modify dm-flakey to
return
Quoted 16 lines
Quoted 16 lines
Quoted 13 lines
-EIOin theend_io.I would like to request for comments.
Thanks,
- Akira
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
- http://people.redhat.com/~lherbolt/dm-flakey/v4.7-dm_flakey.tar.gz
Lukas
Quoted 172 lines · Akira Hayakawa
Hi Lukas,
Quoted 4 lines
I have patch ready, would you be able to test it before posting it.
Let me know if I should build the kernel for you or just share the source with you.
OK.
Please share the git tree and specify the branch to test.Akira
Quoted 10 lines · Lukas Herbolt
Hi Akira,
Sorry I was on holiday.
I have patch ready, would you be able to test it before posting it.Let me know if I should build the kernel for you or just share the source with you.
Lukas
On Sun, Jul 17, 2016 at 3:36 AM, Akira Hayakawa <[email protected]>
Quoted 32 lines · wrote:
Quoted 32 lines
Quoted 5 lines · Lukas Herbolt
Quoted 3 lines
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.btw, is this fix going to be included in the next release?
Quoted 10 lines · Akira Hayakawa
Thanks,
I want the patch in the main-tree quickly. Because without it, my tests will not be green. This is really annoying.
I made a quick reproducer of this problem. If you are looking for one, this will help. (You need to install sbt first)
Quoted 7 lines
https://github.com/akiradeveloper/writeboost-test-suite
test("flakey (read)") { Memory(Sector.M(16)) { a => Flakey.Table(a, 0, 1).create { b => intercept[Exception] { Shell(s"dd status=none if=${b.bdev.path} iflag=directof=/dev/null")
Quoted 5 lines
} } }}
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
$ sudo sbt "testOnly dmtest.FlakeyTest" 12:44:00.643 [pool-2-thread-3-ScalaTest-running-FlakeyTest] INFO dmtest- [TEST] flakey (read)
Quoted 1 line
12:44:00.752 [pool-2-thread-3-ScalaTest-running-FlakeyTest] DEBUG
dmtest
Quoted 29 lines
Quoted 29 lines
- reload: table=0 32768 flakey
/dev/loop00 0 1Quoted 3 lines
[info] FlakeyTest:
[info] - flakey (read) *** FAILED ***
[info] Expected exception java.lang.Exception to be thrown, but noexception was thrown. (FlakeyTest.scala:9)
Quoted 15 lines
[info] Run completed in 2 seconds, 781 milliseconds. [info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0- Akira
Quoted 7 lines · Lukas Herbolt
Hi,
Yes this part is wrong and reads are not dropped.
I have a patch ready, just have to send it out.Lukas
On Wed, Jul 6, 2016 at 8:33 AM, Akira Hayakawa <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Hi,
I am using dm-flakey to emulate a broken device that should return
-EIOonQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
both read and write.
I use the parameter up_interval=0 and down_interval=1.Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
But when I am dd-ing the flakey device, while write fails, read
succeeds.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This isn't the behavior I expect.
Then I looked into the code.
326 static int flakey_end_io(struct
dm_target*ti, struct bio *bio,int
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
error)
327 {
328 structflakey_c*fc =ti->private;
329 structper_bio_data*pb = dm_per_bio_data(bio,sizeof(struct
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
per_bio_data));
330
331 /*
332 * Corrupt successful READs while in down state.
333 * If flags were specified, only corrupt those thatmatch.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
334 */
335 if (fc->corrupt_bio_byte&& !error &&pb->bio_submitted&&
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
336 (
bio_data_dir(bio)== READ) && (fc->corrupt_bio_rw==
READ) &&
337all_corrupt_bio_flags_match(bio, fc))
338corrupt_bio_data(bio, fc);
339
340 return error;
341 }When the bio direction is READ and
currupt_bio_bytesisn't specified the READ bio is handled normally right?I think READ requests should return
-EIOif1.
corrupt_bio_bytesisn't specified
2. but the requested is handled during down interval.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
as well as WRITE requests:
305 /*
306 * Corrupt matching writes.
307 */
308 if (fc->corrupt_bio_byte&& (fc->corrupt_bio_rw==
Quoted 36 lines
Quoted 33 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
WRITE)) {
309 if (all_corrupt_bio_flags_match(bio, fc))
310corrupt_bio_data(bio, fc);
311 gotomap_bio;
312 }
313
314 /*
315 * By default, error all I/O.
316 */
317 return-EIO;
318 }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
This code is similar to what we see in the
end_io.If my understanding is correct, I would like to modify dm-flakey to
return
Quoted 16 lines
Quoted 16 lines
Quoted 13 lines
-EIOin theend_io.I would like to request for comments.
Thanks,
- Akira
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Signature · 5 lines
Lukas Herbolt RHCE, RH436, BSc, SSc Senior Technical Support Engineer Global Support Services (GSS) Email: [email protected]
Quoted 3 lines · Lukas Herbolt
- http://people.redhat.com/~lherbolt/dm-flakey/v4.7-dm_flakey.tar.gz
Lukas
Please post an incremental patch relative to 4.7 or latest Linus kernel. Don't make people suffer with tarballs of whatever you've packaged above.
Mike
Quoted 10 lines · Mike Snitzer
Quoted 3 lines · Lukas Herbolt
- http://people.redhat.com/~lherbolt/dm-flakey/v4.7-dm_flakey.tar.gz
Lukas
Please post an incremental patch relative to 4.7 or latest Linus kernel. Don't make people suffer with tarballs of whatever you've packaged above.
I pulled out your incremental diff. Your proposed fix isn't correct. It breaks the corrupt_bio_byte feature. We cannot blindly drop reads early in flakey_map(), like you've proposed, because the corrupt_bio_byte feature relies on corrupt data being returned on read during the down_interval.
The issue reported is: reads aren't dropped during the "down_interval".
I do agree that this needs fixing, and it was commit a3998799fb4df ("dm
flakey: add corrupt_bio_byte feature") that caused this regression.
But a fix must not break the corrupt_bio_byte feature.
This fix should resolve the problem, I'll be staging it to go upstream during the 4.8-rc cycle (Akira, please test to verify your test fails as expected now):
From: Mike Snitzer <[email protected]>
Date: Fri, 29 Jul 2016 13:19:55 -0400
Subject: [PATCH] dm flakey: error READ bios during the down_interval
When the corrupt_bio_byte feature was introduced it caused READ bios to no longer be errored with -EIO during the down_interval. This had to do with the complexity of needing to submit READs if the corrupt_bio_byte feature was used.
Fix it so READ bios are properly errored with -EIO; doing so early in flakey_map() as long as there isn't a match for the corrupt_bio_byte feature.
--- drivers/md/dm-flakey.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/md/dm-flakey.c +15 -8
@@ -289,10 +289,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) pb->bio_submitted = true;/* -* Map reads as normal. +* Map reads as normal only if corrupt_bio_byte set. */ -if (bio_data_dir (bio) ==READ ) - goto map_bio; +if (bio_data_dir (bio) ==READ ) { +/* If flags were specified, only corrupt those that match. */ +if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw ==READ ) && +all_corrupt_bio_flags_match (bio, fc)) + goto map_bio; +else +return -EIO ; + }/* * Drop writes?
@@ -330,12 +336,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error)/* * Corrupt successful READs while in down state. -* If flags were specified, only corrupt those that match. */ -if (fc->corrupt_bio_byte && !error && pb->bio_submitted && - (bio_data_dir (bio) ==READ ) && (fc->corrupt_bio_rw ==READ ) && -all_corrupt_bio_flags_match (bio, fc)) -corrupt_bio_data (bio, fc); +if (!error && pb->bio_submitted && (bio_data_dir (bio) ==READ )) { +if (fc->corrupt_bio_byte) +corrupt_bio_data (bio, fc); +else +return -EIO ; + }return error; }
Signature · 1 line
2.7.4 (Apple Git-66)
Thanks Mike for fixing.
This was my first attempt to fix something in kernel so I wasn't sure about the patch itself.
- Lukas
Quoted 103 lines · Mike Snitzer
Quoted 10 lines · Mike Snitzer
Quoted 3 lines · Lukas Herbolt
- http://people.redhat.com/~lherbolt/dm-flakey/v4.7-dm_flakey.tar.gz
Lukas
Please post an incremental patch relative to 4.7 or latest Linus kernel. Don't make people suffer with tarballs of whatever you've packaged above.
I pulled out your incremental diff. Your proposed fix isn't correct. It breaks the
corrupt_bio_bytefeature. We cannot blindly drop reads early inflakey_map(), like you've proposed, because thecorrupt_bio_bytefeature relies on corrupt data being returned on read during thedown_interval.The issue reported is: reads aren't dropped during the "
down_interval".I do agree that this needs fixing, and it was commit
a3998799fb4df("dm
flakey: addcorrupt_bio_bytefeature") that caused this regression.But a fix must not break the
corrupt_bio_bytefeature.This fix should resolve the problem, I'll be staging it to go upstream during the 4.8-rc cycle (Akira, please test to verify your test fails as expected now):
From: Mike Snitzer <[email protected]>
Date: Fri, 29 Jul 2016 13:19:55 -0400
Subject: [PATCH] dm flakey: error READ bios during thedown_intervalWhen the
corrupt_bio_bytefeature was introduced it caused READ bios to no longer be errored with-EIOduring thedown_interval. This had to do with the complexity of needing to submit READs if thecorrupt_bio_bytefeature was used.Fix it so READ bios are properly errored with
-EIO; doing so early inflakey_map()as long as there isn't a match for thecorrupt_bio_bytefeature.Fixes a3998799fb4df ("dm flakey: add corrupt_bio_byte feature")Reported-by Akira Hayakawa <[email protected]>Signed-off-by Mike Snitzer <[email protected]>--- drivers/md/dm-flakey.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)drivers/md/dm-flakey.c +3
-3@@ -289,10 +289,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) pb->bio_submitted = true;/* -* Map reads as normal. +* Map reads as normal only if corrupt_bio_byte set. */ -if (bio_data_dir (bio) ==READ ) - goto map_bio; +if (bio_data_dir (bio) ==READ ) { +/* If flags were specified, only corrupt those that match. */
+ if (fc->corrupt_bio_byte&& (fc->corrupt_bio_rw==
READ) &&drivers/md/dm-flakey.c +11
-5+ all_corrupt_bio_flags_match(bio, fc)) + goto map_bio; + else + return -EIO; + }/* * Drop writes? @@ -330,12 +336,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error)/* * Corrupt successful READs while in down state. -* If flags were specified, only corrupt those that match. */ -if (fc->corrupt_bio_byte && !error && pb->bio_submitted && - (bio_data_dir (bio) ==READ ) && (fc->corrupt_bio_rw ==READ ) && -all_corrupt_bio_flags_match (bio, fc)) -corrupt_bio_data (bio, fc); +if (!error && pb->bio_submitted && (bio_data_dir (bio) ==READ )) { +if (fc->corrupt_bio_byte) +corrupt_bio_data (bio, fc); +else +return -EIO ; + }return error;}
--
2.7.4 (Apple Git-66)
Signature · 5 lines
Lukas Herbolt RHCE, RH436, BSc, SSc Senior Technical Support Engineer Global Support Services (GSS) Email: [email protected]
I just looked at the patch. (not tested yet)
I think the else part in the endio isn't necessary.
Review
Quoted 2 lines
(quoted diff) +2
-0+ else + return -EIO;
Akira
Quoted 96 lines · Mike Snitzer
Quoted 10 lines · Mike Snitzer
Quoted 3 lines · Lukas Herbolt
- http://people.redhat.com/~lherbolt/dm-flakey/v4.7-dm_flakey.tar.gz
Lukas
Please post an incremental patch relative to 4.7 or latest Linus kernel. Don't make people suffer with tarballs of whatever you've packaged above.
I pulled out your incremental diff. Your proposed fix isn't correct. It breaks the
corrupt_bio_bytefeature. We cannot blindly drop reads early inflakey_map(), like you've proposed, because thecorrupt_bio_bytefeature relies on corrupt data being returned on read during thedown_interval.The issue reported is: reads aren't dropped during the "
down_interval".I do agree that this needs fixing, and it was commit
a3998799fb4df("dm
flakey: addcorrupt_bio_bytefeature") that caused this regression.But a fix must not break the
corrupt_bio_bytefeature.This fix should resolve the problem, I'll be staging it to go upstream during the 4.8-rc cycle (Akira, please test to verify your test fails as expected now):
From: Mike Snitzer <[email protected]>
Date: Fri, 29 Jul 2016 13:19:55 -0400
Subject: [PATCH] dm flakey: error READ bios during thedown_intervalWhen the
corrupt_bio_bytefeature was introduced it caused READ bios to no longer be errored with-EIOduring thedown_interval. This had to do with the complexity of needing to submit READs if thecorrupt_bio_bytefeature was used.Fix it so READ bios are properly errored with
-EIO; doing so early inflakey_map()as long as there isn't a match for thecorrupt_bio_bytefeature.Fixes a3998799fb4df ("dm flakey: add corrupt_bio_byte feature")Reported-by Akira Hayakawa <[email protected]>Signed-off-by Mike Snitzer <[email protected]>--- drivers/md/dm-flakey.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)drivers/md/dm-flakey.c +15
-8@@ -289,10 +289,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) pb->bio_submitted = true;/* -* Map reads as normal. +* Map reads as normal only if corrupt_bio_byte set. */ -if (bio_data_dir (bio) ==READ ) - goto map_bio; +if (bio_data_dir (bio) ==READ ) { +/* If flags were specified, only corrupt those that match. */ +if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw ==READ ) && +all_corrupt_bio_flags_match (bio, fc)) + goto map_bio; +else +return -EIO ; + }/* * Drop writes? @@ -330,12 +336,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error)/* * Corrupt successful READs while in down state. -* If flags were specified, only corrupt those that match. */ -if (fc->corrupt_bio_byte && !error && pb->bio_submitted && - (bio_data_dir (bio) ==READ ) && (fc->corrupt_bio_rw ==READ ) && -all_corrupt_bio_flags_match (bio, fc)) -corrupt_bio_data (bio, fc); +if (!error && pb->bio_submitted && (bio_data_dir (bio) ==READ )) { +if (fc->corrupt_bio_byte) +corrupt_bio_data (bio, fc); +else +return -EIO ; + }return error; }
Mike,
Quoted 3 lines
This fix should resolve the problem, I'll be staging it to go upstream during the 4.8-rc cycle (Akira, please test to verify your test fails as expected now):
I tested with the patch and it's now ok.
Akira
Quoted 96 lines · Mike Snitzer
Quoted 10 lines · Mike Snitzer
Quoted 3 lines · Lukas Herbolt
- http://people.redhat.com/~lherbolt/dm-flakey/v4.7-dm_flakey.tar.gz
Lukas
Please post an incremental patch relative to 4.7 or latest Linus kernel. Don't make people suffer with tarballs of whatever you've packaged above.
I pulled out your incremental diff. Your proposed fix isn't correct. It breaks the
corrupt_bio_bytefeature. We cannot blindly drop reads early inflakey_map(), like you've proposed, because thecorrupt_bio_bytefeature relies on corrupt data being returned on read during thedown_interval.The issue reported is: reads aren't dropped during the "
down_interval".I do agree that this needs fixing, and it was commit
a3998799fb4df("dm
flakey: addcorrupt_bio_bytefeature") that caused this regression.But a fix must not break the
corrupt_bio_bytefeature.This fix should resolve the problem, I'll be staging it to go upstream during the 4.8-rc cycle (Akira, please test to verify your test fails as expected now):
From: Mike Snitzer <[email protected]>
Date: Fri, 29 Jul 2016 13:19:55 -0400
Subject: [PATCH] dm flakey: error READ bios during thedown_intervalWhen the
corrupt_bio_bytefeature was introduced it caused READ bios to no longer be errored with-EIOduring thedown_interval. This had to do with the complexity of needing to submit READs if thecorrupt_bio_bytefeature was used.Fix it so READ bios are properly errored with
-EIO; doing so early inflakey_map()as long as there isn't a match for thecorrupt_bio_bytefeature.Fixes a3998799fb4df ("dm flakey: add corrupt_bio_byte feature")Reported-by Akira Hayakawa <[email protected]>Signed-off-by Mike Snitzer <[email protected]>--- drivers/md/dm-flakey.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)drivers/md/dm-flakey.c +15
-8@@ -289,10 +289,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) pb->bio_submitted = true;/* -* Map reads as normal. +* Map reads as normal only if corrupt_bio_byte set. */ -if (bio_data_dir (bio) ==READ ) - goto map_bio; +if (bio_data_dir (bio) ==READ ) { +/* If flags were specified, only corrupt those that match. */ +if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw ==READ ) && +all_corrupt_bio_flags_match (bio, fc)) + goto map_bio; +else +return -EIO ; + }/* * Drop writes? @@ -330,12 +336,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error)/* * Corrupt successful READs while in down state. -* If flags were specified, only corrupt those that match. */ -if (fc->corrupt_bio_byte && !error && pb->bio_submitted && - (bio_data_dir (bio) ==READ ) && (fc->corrupt_bio_rw ==READ ) && -all_corrupt_bio_flags_match (bio, fc)) -corrupt_bio_data (bio, fc); +if (!error && pb->bio_submitted && (bio_data_dir (bio) ==READ )) { +if (fc->corrupt_bio_byte) +corrupt_bio_data (bio, fc); +else +return -EIO ; + }return error; }