<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Thanks Mike for fixing. </div><div class="gmail_default" style="font-family:monospace,monospace">This was my first attempt to fix something in kernel so I wasn't sure about the patch itself.</div><div class="gmail_default" style="font-family:monospace,monospace"> - Lukas</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 29, 2016 at 7:30 PM, Mike Snitzer <span dir="ltr"><<a href="mailto:snitzer@redhat.com" target="_blank">snitzer@redhat.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 Fri, Jul 29 2016 at 10:35am -0400,<br>
Mike Snitzer <<a href="mailto:snitzer@redhat.com">snitzer@redhat.com</a>> wrote:<br>
<br>
> On Fri, Jul 29 2016 at 10:31am -0400,<br>
> Lukas Herbolt <<a href="mailto:lherbolt@redhat.com">lherbolt@redhat.com</a>> wrote:<br>
><br>
> >  - <a href="http://people.redhat.com/~lherbolt/dm-flakey/v4.7-dm_flakey.tar.gz" rel="noreferrer" target="_blank">http://people.redhat.com/~lherbolt/dm-flakey/v4.7-dm_flakey.tar.gz</a><br>
> ><br>
> > Lukas<br>
><br>
> Please post an incremental patch relative to 4.7 or latest Linus<br>
> kernel.  Don't make people suffer with tarballs of whatever you've<br>
> packaged above.<br>
<br>
</span>I pulled out your incremental diff.  Your proposed fix isn't correct.  It<br>
breaks the corrupt_bio_byte feature.  We cannot blindly drop reads early<br>
in flakey_map(), like you've proposed, because the corrupt_bio_byte<br>
feature relies on corrupt data being returned on read during the<br>
down_interval.<br>
<br>
The issue reported is: reads aren't dropped during the "down_interval".<br>
<br>
I do agree that this needs fixing, and it was commit a3998799fb4df ("dm<br>
flakey: add corrupt_bio_byte feature") that caused this regression.<br>
<br>
But a fix must not break the corrupt_bio_byte feature.<br>
<br>
This fix should resolve the problem, I'll be staging it to go upstream<br>
during the 4.8-rc cycle (Akira, please test to verify your test fails as<br>
expected now):<br>
<br>
From: Mike Snitzer <<a href="mailto:snitzer@redhat.com">snitzer@redhat.com</a>><br>
Date: Fri, 29 Jul 2016 13:19:55 -0400<br>
Subject: [PATCH] dm flakey: error READ bios during the down_interval<br>
<br>
When the corrupt_bio_byte feature was introduced it caused READ bios to<br>
no longer be errored with -EIO during the down_interval.  This had to do<br>
with the complexity of needing to submit READs if the corrupt_bio_byte<br>
feature was used.<br>
<br>
Fix it so READ bios are properly errored with -EIO; doing so early in<br>
flakey_map() as long as there isn't a match for the corrupt_bio_byte<br>
feature.<br>
<br>
Fixes: a3998799fb4df ("dm flakey: add corrupt_bio_byte feature")<br>
Reported-by: Akira Hayakawa <<a href="mailto:ruby.wktk@gmail.com">ruby.wktk@gmail.com</a>><br>
Signed-off-by: Mike Snitzer <<a href="mailto:snitzer@redhat.com">snitzer@redhat.com</a>><br>
Cc: <a href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a><br>
---<br>
 drivers/md/dm-flakey.c | 23 +++++++++++++++--------<br>
 1 file changed, 15 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c<br>
index 29b99fb..19db13e 100644<br>
--- a/drivers/md/dm-flakey.c<br>
+++ b/drivers/md/dm-flakey.c<br>
@@ -289,10 +289,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio)<br>
                pb->bio_submitted = true;<br>
<br>
                /*<br>
-                * Map reads as normal.<br>
+                * Map reads as normal only if corrupt_bio_byte set.<br>
                 */<br>
-               if (bio_data_dir(bio) == READ)<br>
-                       goto map_bio;<br>
+               if (bio_data_dir(bio) == READ) {<br>
+                       /* If flags were specified, only corrupt those that match. */<br>
+                       if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) &&<br>
+                           all_corrupt_bio_flags_match(bio, fc))<br>
+                               goto map_bio;<br>
+                       else<br>
+                               return -EIO;<br>
+               }<br>
<br>
                /*<br>
                 * Drop writes?<br>
@@ -330,12 +336,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error)<br>
<br>
        /*<br>
<span class="">         * Corrupt successful READs while in down state.<br>
</span>-        * If flags were specified, only corrupt those that match.<br>
         */<br>
-       if (fc->corrupt_bio_byte && !error && pb->bio_submitted &&<br>
-           (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw == READ) &&<br>
-           all_corrupt_bio_flags_match(bio, fc))<br>
-               corrupt_bio_data(bio, fc);<br>
+       if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) {<br>
+               if (fc->corrupt_bio_byte)<br>
+                       corrupt_bio_data(bio, fc);<br>
+               else<br>
+                       return -EIO;<br>
+       }<br>
<br>
        return error;<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4 (Apple Git-66)<br>
<br>
</font></span></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>