<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Hi,</div><div class="gmail_default" style="font-family:monospace,monospace">Yes this part is wrong and reads are not dropped.</div><div class="gmail_default" style="font-family:monospace,monospace">I have a patch ready, just have to send it out.</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 Wed, Jul 6, 2016 at 8:33 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">Hi,<br>
<br>
I am using dm-flakey to emulate a broken device that should return -EIO on 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 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 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 == 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 == 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 -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>
</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>