From patchwork Thu Oct 31 19:38:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mason X-Patchwork-Id: 3123121 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 02D99BEEB2 for ; Fri, 1 Nov 2013 06:56:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 468052039F for ; Fri, 1 Nov 2013 06:56:42 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mail.kernel.org (Postfix) with ESMTP id 172D320457 for ; Fri, 1 Nov 2013 06:56:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rA16qoJV007071; Fri, 1 Nov 2013 02:52:53 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9VJcX7m006274 for ; Thu, 31 Oct 2013 15:38:33 -0400 Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9VJcWtD002115 for ; Thu, 31 Oct 2013 15:38:33 -0400 Received: from dkim1.fusionio.com (dkim1.fusionio.com [66.114.96.53]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9VJcRnu005503 for ; Thu, 31 Oct 2013 15:38:27 -0400 Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim1.fusionio.com (Postfix) with ESMTP id E94FE7C06AE for ; Thu, 31 Oct 2013 13:38:26 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1383248306; bh=g8QeFNuaht/SBPsZovyeoAEOECsRnaPA9/kKky8iz94=; h=From:CC:To:Subject:Date; b=sN94FixAiKSW+3/UiPBik55PljPkOyjU3wtqVAib2YXVo5zGqOfjBd0xkwT3JwpZk Dgxkzw5SQ2XzFdQOaLQKFFQZi9J0LWUEAbS3u3XpBAnQ6slsIDFmmi/XF3tmHdcKXR /8Hx7WkWwek1Ltvk/o/6IPa4ifqilTswcW96SLAk= X-ASG-Debug-ID: 1383248306-03d6a54d19a7540001-pvc9sj Received: from CAS1.int.fusionio.com (cas1.int.fusionio.com [10.101.1.40]) by mx1.fusionio.com with ESMTP id yJX1leldUFnz1Pdr (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Thu, 31 Oct 2013 13:38:26 -0600 (MDT) X-Barracuda-Envelope-From: clmason@fusionio.com Received: from localhost (10.101.1.160) by mail.fusionio.com (10.101.1.40) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 31 Oct 2013 13:38:25 -0600 MIME-Version: 1.0 From: Chris Mason User-Agent: alot/0.3.4 To: Kent Overstreet , Jens Axboe Message-ID: <20131031193820.10239.79827@localhost.localdomain> Date: Thu, 31 Oct 2013 15:38:20 -0400 X-ASG-Orig-Subj: [PATCH] Btrfs: update bi_remaining to relfect our bio endio chaining X-Originating-IP: [10.101.1.160] X-Barracuda-Connect: cas1.int.fusionio.com[10.101.1.40] X-Barracuda-Start-Time: 1383248306 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.141940 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-RedHat-Spam-Score: -2.532 (BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_PASS, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.21 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id r9VJcX7m006274 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 01 Nov 2013 02:52:48 -0400 Cc: Christoph@redhat.com, linux-kernel@vger.kernel.org, Hellwig , dm-devel@redhat.com, linux-fsdevel@vger.kernel.org Subject: [dm-devel] [PATCH] Btrfs: update bi_remaining to relfect our bio endio chaining X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Btrfs is sometimes calling bio_endio twice on the same bio while we chain things. This makes sure we don't trip over new assertions in fs/bio.c Signed-off-by: Chris Mason --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 7fcac70..5b30360 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c @@ -2289,6 +2289,10 @@ static void btrfsic_bio_end_io(struct bio *bp, int bio_error_status) block = next_block; } while (NULL != block); + /* + * since we're not using bio_endio here, we don't need to worry about + * the remaining count + */ bp->bi_end_io(bp, bio_error_status); } diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 62176ad..786ddac 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1684,7 +1684,7 @@ static void end_workqueue_fn(struct btrfs_work *work) bio->bi_private = end_io_wq->private; bio->bi_end_io = end_io_wq->end_io; kfree(end_io_wq); - bio_endio(bio, error); + bio_endio_nodec(bio, error); } static int cleaner_kthread(void *arg) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index ef48947..a31448f 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -5284,9 +5284,17 @@ static void btrfs_end_bio(struct bio *bio, int err) } } - if (bio == bbio->orig_bio) + if (bio == bbio->orig_bio) { is_orig_bio = 1; + /* + * eventually we will call the bi_endio for the original bio, + * make sure that we've properly bumped bi_remaining to reflect + * our chain of endios here + */ + atomic_inc(&bio->bi_remaining); + } + if (atomic_dec_and_test(&bbio->stripes_pending)) { if (!is_orig_bio) { bio_put(bio);