dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Akira Hayakawa <ruby.wktk@gmail.com>
To: Lukas Herbolt <lherbolt@redhat.com>
Cc: device-mapper development <dm-devel@redhat.com>
Subject: Re: dm-flakey NOT to return -EIO on READ?
Date: Wed, 6 Jul 2016 21:54:16 +0900	[thread overview]
Message-ID: <07b6affb-a09d-7d55-65f8-6d476a5471aa@gmail.com> (raw)
In-Reply-To: <CAM4Jq_5kBs2WKNOiLrVL8XMTSJQhPdvO-XKROhzpLXdOATFw7w@mail.gmail.com>

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

On 2016/07/06 18:52, Lukas Herbolt wrote:
> 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 <ruby.wktk@gmail.com> wrote:
> 
>> 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
>>
>> --
>> dm-devel mailing list
>> dm-devel@redhat.com
>> https://www.redhat.com/mailman/listinfo/dm-devel
>>
> 
> 
> 

  reply	other threads:[~2016-07-06 12:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06  6:33 dm-flakey NOT to return -EIO on READ? Akira Hayakawa
2016-07-06  9:52 ` Lukas Herbolt
2016-07-06 12:54   ` Akira Hayakawa [this message]
2016-07-17  1:36     ` Akira Hayakawa
2016-07-29  6:25       ` Lukas Herbolt
2016-07-29  6:32         ` Akira Hayakawa
2016-07-29 14:31           ` Lukas Herbolt
2016-07-29 14:35             ` Mike Snitzer
2016-07-29 17:30               ` Mike Snitzer
2016-07-29 18:00                 ` Lukas Herbolt
2016-07-29 22:55                 ` Akira Hayakawa
2016-07-30  0:26                 ` Akira Hayakawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07b6affb-a09d-7d55-65f8-6d476a5471aa@gmail.com \
    --to=ruby.wktk@gmail.com \
    --cc=dm-devel@redhat.com \
    --cc=lherbolt@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).