From patchwork Mon Aug 22 14:53:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Herbolt X-Patchwork-Id: 9293657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E0F36607D0 for ; Mon, 22 Aug 2016 14:53:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D389828832 for ; Mon, 22 Aug 2016 14:53:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C85A828A0F; Mon, 22 Aug 2016 14:53:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5B5828832 for ; Mon, 22 Aug 2016 14:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755890AbcHVOxV (ORCPT ); Mon, 22 Aug 2016 10:53:21 -0400 Received: from mail-qk0-f169.google.com ([209.85.220.169]:33256 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755309AbcHVOxT (ORCPT ); Mon, 22 Aug 2016 10:53:19 -0400 Received: by mail-qk0-f169.google.com with SMTP id z190so85168379qkc.0 for ; Mon, 22 Aug 2016 07:53:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ttC+ir4tjKOaoIo7eMPht+r3qmNTL6sN7j22mk5VXj4=; b=UhtsdmQ54TB7qaw4zU4wXmf67FzQo6ISSOiLfCYq2kH7qWQhxYF4pbUIhNxKXi3CYi JNnoI4a238mUlW0b0apoZaShDv/vDcclWu6vHYHl+DfZ+oBcpxBYgPxOmA0GssClx98t gVYdkUOfW3H0HBBOc9ZBap3bXMXu1oeyMKGH7wtOwtD97uCXtugtrDq9Q/lVAwkKXvt6 LQstPfSd2Tdt1U0UKgIOKEYBdvWagPwm6q3t/juoQp5/IazenjDjagOlbj/+y8vOKVci SGE7RkdDggFpKGTh0g1fLajHHSAIQ4UhOv8YpszcVYbcmWw3S60FM+z+LzfIxnFlZWNz HDqw== X-Gm-Message-State: AEkoouvUgRmGpG1xRIya78/hinxsx/eUToePwbuMQhNn/6MsMw8TFSizay4YsKExcO2Y+38teHfl4yQp5PNBuISZ X-Received: by 10.55.75.17 with SMTP id y17mr24240262qka.83.1471877597970; Mon, 22 Aug 2016 07:53:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.44.5 with HTTP; Mon, 22 Aug 2016 07:53:17 -0700 (PDT) In-Reply-To: References: From: Lukas Herbolt Date: Mon, 22 Aug 2016 16:53:17 +0200 Message-ID: Subject: Re: [dm-devel] [Regression/Behavior change]dm-flakey corrupt read bio, even the feature is drop_writes To: Qu Wenruo Cc: Mike Snitzer , device-mapper development , btrfs Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Qu, Sorry for the confusion. Reading the email again and the code it seems that the READS are really returned as -EIO if you set the drop_writes. I just tested it and you are right. If I was reading the fstest correctly the flakey is created as: --- flakey: 0 409600 flakey 8:64 0 0 180 1 drop_writes --- I believe the READs are dropped because it does not have any flags set. --- 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; } --- with conclusion of setting: --- /* * Flag this bio as submitted while down. */ pb->bio_submitted = true; --- I have quick test patch ready, but it probably broke more thing than fixes so I will continue on it. Just in case you want to test it. Diff is done again 4.8-rc1 that match. */ if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && all_corrupt_bio_flags_match(bio, fc)) On Mon, Aug 22, 2016 at 10:05 AM, Lukas Herbolt wrote: > Hello, > > There is patch from Mike. It's part of current pull request to 4.8-rc1 > For more details check: > - https://www.redhat.com/archives/dm-devel/2016-July/msg00561.html > - https://www.redhat.com/archives/dm-devel/2016-August/msg00109.html > > Lukas > > On Mon, Aug 22, 2016 at 9:31 AM, Qu Wenruo wrote: >> Hi, Mike and btrfs and dm guys >> >> When doing regression test on v4.8-rc1, we found that fstests/btrfs/056 >> always fails. With the following dmesg: >> --- >> Buffer I/O error on dev dm-0, logical block 1310704, async page read >> Buffer I/O error on dev dm-0, logical block 16, async page read >> Buffer I/O error on dev dm-0, logical block 16, async page read >> --- >> >> And bisect leads to the following commits: >> --- >> commit 99f3c90d0d85708e7401a81ce3314e50bf7f2819 >> Author: Mike Snitzer >> Date: Fri Jul 29 13:19:55 2016 -0400 >> >> dm flakey: error READ bios during the down_interval >> --- >> >> While according to the document of dm-flakey, it says that when using >> drop_writes feature, read bios are not affected: >> --- >> drop_writes: >> All write I/O is silently ignored. >> Read I/O is handled correctly. >> --- >> >> If I understand the word "correctly" correctly, it should means READ I/0 is >> handled without problem. >> >> However with this commit, it also corrupt the read bio, leading to the test >> failure. >> >> >> At least there are two fixes available here; >> 1) Fix fstest scripts >> The related macro is "_flakey_drop_and_remount yes", which will >> check the fs during the "drop_writes" time. >> >> Currently, only btrfs/056 calls "_flakey_drop_and_remount" with >> "yes". So other test cases are not affected. >> >> However, even we move the fsck outside of the "drop_writes" range, >> although test case can pass without problem, but we will still >> get a dmesg error: >> "Buffer I/O error on dev dm-0, logical block 1310704, async page read" >> >> 2) Revert to flakey behavior to allow READ bio >> Then everything is back to the old good days. >> >> Not sure which one is correct for current use case, as I'm not familiar with >> dm codes. >> >> Any idea to fix dm-flaky and keep the READ bio behavior? >> >> Thanks, >> Qu >> >> >> >> >> >> -- >> dm-devel mailing list >> dm-devel@redhat.com >> https://www.redhat.com/mailman/listinfo/dm-devel > > > > -- > Lukas Herbolt > RHCE, RH436, BSc, SSc > Senior Technical Support Engineer > Global Support Services (GSS) > Email: lherbolt@redhat.com --- a/drivers/md/dm-flakey.c +++ b/drivers/md/dm-flakey.c @@ -292,6 +292,11 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) * Map reads as normal only if corrupt_bio_byte set. */ if (bio_data_dir(bio) == READ) { + /* We should retunr all READS as ok in case of DROP WRITES flag is set. */ + if (test_bit(DROP_WRITES, &fc->flags)) { + pb->bio_submitted = false; + goto map_bio; + } /* If flags were specified, only corrupt those