<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Hi Akira,</div><div class="gmail_default" style="font-family:monospace,monospace">Sorry I was on holiday.</div><div class="gmail_default" style="font-family:monospace,monospace">I have patch ready, would you be able to test it before posting it.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Let me know if I should build the kernel for you or just share the source with you. </div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Lukas</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 17, 2016 at 3:36 AM, Akira Hayakawa <span dir="ltr"><<a href="mailto:ruby.wktk@gmail.com" target="_blank">ruby.wktk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> On 2016/07/06 18:52, Lukas Herbolt wrote:<br>
>> Hi,<br>
>> Yes this part is wrong and reads are not dropped.<br>
>> I have a patch ready, just have to send it out.<br>
<br>
</span>btw, is this fix going to be included in the next release?<br>
<div class="HOEnZb"><div class="h5"><br>
On 2016/07/06 21:54, Akira Hayakawa wrote:<br>
> Thanks,<br>
><br>
> I want the patch in the main-tree quickly.<br>
> Because without it, my tests will not be green.<br>
> This is really annoying.<br>
><br>
> I made a quick reproducer of this problem.<br>
> If you are looking for one, this will help.<br>
> (You need to install sbt first)<br>
><br>
> <a href="https://github.com/akiradeveloper/writeboost-test-suite" rel="noreferrer" target="_blank">https://github.com/akiradeveloper/writeboost-test-suite</a><br>
><br>
>   test("flakey (read)") {<br>
>     Memory(Sector.M(16)) { a =><br>
>       Flakey.Table(a, 0, 1).create { b =><br>
>         intercept[Exception] {<br>
>           Shell(s"dd status=none if=${b.bdev.path} iflag=direct of=/dev/null")<br>
>         }<br>
>       }<br>
>     }<br>
>   }<br>
><br>
> $ sudo sbt "testOnly dmtest.FlakeyTest"<br>
> 12:44:00.643 [pool-2-thread-3-ScalaTest-running-FlakeyTest] INFO dmtest - [TEST] flakey (read)<br>
> 12:44:00.752 [pool-2-thread-3-ScalaTest-running-FlakeyTest] DEBUG dmtest - reload: table=0 32768 flakey /dev/loop0 0 0 1<br>
> [info] FlakeyTest:<br>
> [info] - flakey (read) *** FAILED ***<br>
> [info]   Expected exception java.lang.Exception to be thrown, but no exception was thrown. (FlakeyTest.scala:9)<br>
> [info] Run completed in 2 seconds, 781 milliseconds.<br>
> [info] Total number of tests run: 1<br>
> [info] Suites: completed 1, aborted 0<br>
> [info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0<br>
><br>
> - Akira<br>
><br>
> On 2016/07/06 18:52, Lukas Herbolt wrote:<br>
>> Hi,<br>
>> Yes this part is wrong and reads are not dropped.<br>
>> I have a patch ready, just have to send it out.<br>
>><br>
>> Lukas<br>
>><br>
>> On Wed, Jul 6, 2016 at 8:33 AM, Akira Hayakawa <<a href="mailto:ruby.wktk@gmail.com">ruby.wktk@gmail.com</a>> wrote:<br>
>><br>
>>> Hi,<br>
>>><br>
>>> I am using dm-flakey to emulate a broken device that should return -EIO on<br>
>>> both read and write.<br>
>>> I use the parameter up_interval=0 and down_interval=1.<br>
>>><br>
>>> But when I am dd-ing the flakey device, while write fails, read succeeds.<br>
>>> This isn't the behavior I expect.<br>
>>><br>
>>> Then I looked into the code.<br>
>>><br>
>>> 326 static int flakey_end_io(struct dm_target *ti, struct bio *bio, int<br>
>>> error)<br>
>>> 327 {<br>
>>> 328         struct flakey_c *fc = ti->private;<br>
>>> 329         struct per_bio_data *pb = dm_per_bio_data(bio, sizeof(struct<br>
>>> per_bio_data));<br>
>>> 330<br>
>>> 331         /*<br>
>>> 332          * Corrupt successful READs while in down state.<br>
>>> 333          * If flags were specified, only corrupt those that match.<br>
>>> 334          */<br>
>>> 335         if (fc->corrupt_bio_byte && !error && pb->bio_submitted &&<br>
>>> 336             (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw ==<br>
>>> READ) &&<br>
>>> 337             all_corrupt_bio_flags_match(bio, fc))<br>
>>> 338                 corrupt_bio_data(bio, fc);<br>
>>> 339<br>
>>> 340         return error;<br>
>>> 341 }<br>
>>><br>
>>> When the bio direction is READ and currupt_bio_bytes isn't specified<br>
>>> the READ bio is handled normally right?<br>
>>><br>
>>> I think READ requests should return -EIO if<br>
>>><br>
>>> 1. corrupt_bio_bytes isn't specified<br>
>>> 2. but the requested is handled during down interval.<br>
>>><br>
>>> as well as WRITE requests:<br>
>>><br>
>>> 305                 /*<br>
>>> 306                  * Corrupt matching writes.<br>
>>> 307                  */<br>
>>> 308                 if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw ==<br>
>>> WRITE)) {<br>
>>> 309                         if (all_corrupt_bio_flags_match(bio, fc))<br>
>>> 310                                 corrupt_bio_data(bio, fc);<br>
>>> 311                         goto map_bio;<br>
>>> 312                 }<br>
>>> 313<br>
>>> 314                 /*<br>
>>> 315                  * By default, error all I/O.<br>
>>> 316                  */<br>
>>> 317                 return -EIO;<br>
>>> 318         }<br>
>>><br>
>>> This code is similar to what we see in the end_io.<br>
>>><br>
>>> If my understanding is correct, I would like to modify dm-flakey to return<br>
>>> -EIO in the end_io.<br>
>>><br>
>>> I would like to request for comments.<br>
>>><br>
>>> Thanks,<br>
>>><br>
>>> - Akira<br>
>>><br>
>>> --<br>
>>> dm-devel mailing list<br>
>>> <a href="mailto:dm-devel@redhat.com">dm-devel@redhat.com</a><br>
>>> <a href="https://www.redhat.com/mailman/listinfo/dm-devel" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/dm-devel</a><br>
>>><br>
>><br>
>><br>
>><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-family:monospace,monospace;font-size:12.8px">Lukas Herbolt</span><br></div><div><font face="monospace, monospace">RHCE, RH436, BSc, SSc</font></div><div><font face="monospace, monospace">Senior Technical Support Engineer</font></div><div><font face="monospace, monospace">Global Support Services (GSS)</font></div><div><font face="monospace, monospace">Email:    <a href="mailto:lherbolt@redhat.com" target="_blank">lherbolt@redhat.com</a></font></div><div><br></div></div></div></div></div></div>
</div>