From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755046AbcARNAN (ORCPT ); Mon, 18 Jan 2016 08:00:13 -0500 Received: from mail-pf0-f169.google.com ([209.85.192.169]:33947 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754809AbcARNAH (ORCPT ); Mon, 18 Jan 2016 08:00:07 -0500 Date: Mon, 18 Jan 2016 21:00:15 +0800 From: Minfei Huang To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, mhuang@redhat.com Subject: Re: [PATCH] bio: Make the test correct for idx in __bio_clone_fast Message-ID: <20160118130015.GA4069@dhcp-129-109.nay.redhat.com> References: <1450458597-20188-1-git-send-email-mnfhuang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450458597-20188-1-git-send-email-mnfhuang@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping. Any comment is appreciate. Thanks Minfei On 12/19/15 at 01:09P, Minfei Huang wrote: > It is more lucky that kernel crash does not happen, since we test the > bi_pool in function __bio_clone_fast. > > The idx will be still equal to BIO_POOL_NONE, if there is no bvec to be > allocated. > > Fix the bug_on condition to make the test correct. > > Signed-off-by: Minfei Huang > --- > block/bio.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/block/bio.c b/block/bio.c > index 4f184d9..041ece0 100644 > --- a/block/bio.c > +++ b/block/bio.c > @@ -573,8 +573,7 @@ EXPORT_SYMBOL(bio_phys_segments); > */ > void __bio_clone_fast(struct bio *bio, struct bio *bio_src) > { > - BUG_ON(bio->bi_pool && BIO_POOL_IDX(bio) != BIO_POOL_NONE); > - > + BUG_ON(BIO_POOL_IDX(bio) != BIO_POOL_NONE); > /* > * most users will be overriding ->bi_bdev with a new target, > * so we don't set nor calculate new physical/hw segment counts here > -- > 2.6.3 >