Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp199582pxb; Fri, 5 Mar 2021 19:35:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxf1SUbNRtdU31+euN3GAEO5hXAGU8MY6s596yxX2WqvAE+KuGtk5hIyF8/w3fOMOfPJMfW X-Received: by 2002:a05:6402:484:: with SMTP id k4mr900908edv.321.1615001757229; Fri, 05 Mar 2021 19:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615001757; cv=none; d=google.com; s=arc-20160816; b=mqb9jMIOd7r4ra8D/SyTwoTOTvoo2cPnmILE5tfGMmokUfZZT56ng815xrKPThPRTB SwJyFFh6aK7HsR1UGR0+9zJlIln/A8J/7bI9cVIYNeQtrn6p43BcPHHpOtVtSMy9Z7MD CnBLCFJ4OCWzMZmibYKIaMzoaW3mhkwhYwFZ9cMM3TaCGBU9FLfWB7BHsthaObrh8vuo UcpQnKWcm2+AH5Ak5dXQVsoGjoEtXu3IJKvJh319reV5WAjUFX1MRVjdFZ6vVPWQ7P2Q pThZnYTeHat0Wrb+PH5an2+PX03NjbNdx+vlx8ksfQAb3NGZW0ZUQqeubm2Gl6cn2nZO M2lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=WTZlgHwHuNHyiLsLmt9SWDk/mGiniogRMSZlyd7d8fM=; b=YJlySyhexxA0PlSgwg2no5c+14MfH8cpgNUlscZhMNjMjctU2p8B/ny2M33stiwI8m zUBS7fnZ7hgyT1V3lMdlESlFAoQbPoheHt5hAxcSlSDujsLGBTYGeS6n1jtV9chnCqXM XC7LhW/z5G6g2alNQ/6E/vunZ1FsvamNsms14hVSJUW0VVSboZGMz0Hpkf6WoW0fUW7V RoWotGrueyQh1kFedvX/IEtrtNUj4O5bd36vRg9Rt7HUeCuQtIjLi9EeEcPIdBRCWFLc Rd2lm3EqVHR/fK32fat2uIgI972XpcQNoTPpT1c+eU5j4cL0fvJnw+VcZbxCmElrmGn9 GulQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aol.com header.s=a2048 header.b=hncvcM6n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=aol.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp13si2474648ejc.24.2021.03.05.19.35.34; Fri, 05 Mar 2021 19:35:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@aol.com header.s=a2048 header.b=hncvcM6n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=aol.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbhCFDbV (ORCPT + 99 others); Fri, 5 Mar 2021 22:31:21 -0500 Received: from sonic301-20.consmr.mail.gq1.yahoo.com ([98.137.64.146]:39983 "EHLO sonic301-20.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbhCFDbU (ORCPT ); Fri, 5 Mar 2021 22:31:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1615001479; bh=WTZlgHwHuNHyiLsLmt9SWDk/mGiniogRMSZlyd7d8fM=; h=From:To:Cc:Subject:Date:References:From:Subject:Reply-To; b=hncvcM6nobQJ93XeRg2X2tYm/rrSX9X0FdlwNajV7lmWHXK9etBLSZz5U/8bNJWdX9Bf6TUbNWVI/TUWibtZE9lt/Lp0le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GoahxBjngr1lYV Idi_v8w.vXRLPqqEMkSi_IX_S1imHPgpbKRdY.Ga9Np2qFPOhIUNwUACHxwt2T5GXWePZI.oataJ rhTjLfjGNm6J8fvOmfgNnR4hKDUv_w9pfCXekYAt3xaByaZF.up0HPUju7CfyCCu_N5zHNWQnJGv 3jGUjbClTM.lRVYo9TJ7JGs.kAh0ytmqtpHQhqJuA3NZChwdT91UEpP22o6z9C32fD6KVRo1N5d3 cxgqSt1l8JJWy0tyCkor8.DXyZJn1 X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Sat, 6 Mar 2021 03:31:19 +0000 Received: by kubenode570.mail-prod1.omega.gq1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID ba4481e697bdb030390431d4eb2e8ed0; Sat, 06 Mar 2021 03:31:18 +0000 (UTC) From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu , Chao Yu Cc: linux-kernel@vger.kernel.org, Gao Xiang , Martin DEVERA Subject: [PATCH] erofs: fix bio->bi_max_vecs behavior change Date: Sat, 6 Mar 2021 11:31:09 +0800 Message-Id: <20210306033109.28466-1-hsiangkao@aol.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit References: <20210306033109.28466-1-hsiangkao.ref@aol.com> Content-Length: 2009 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gao Xiang Martin reported an issue that directory read could be hung on the latest -rc kernel with some certain image. The root cause is that commit baa2c7c97153 ("block: set .bi_max_vecs as actual allocated vector number") changes .bi_max_vecs behavior. bio->bi_max_vecs is set as actual allocated vector number rather than the requested number now. Let's avoid using .bi_max_vecs completely instead. Reported-by: Martin DEVERA Signed-off-by: Gao Xiang --- Hi Chao, Could you take some time on reviewing this patchset in advance? I'd like to upstream this regression fix asap since it has noticable impact on 5.12-rc kernel. Thanks, Gao Xiang fs/erofs/data.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index f88851c5c250..fa25d0eab5de 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -231,14 +231,6 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, goto submit_bio_retry; *last_block = current_block; - - /* shift in advance in case of it followed by too many gaps */ - if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) { - /* err should reassign to 0 after submitting */ - err = 0; - goto submit_bio_out; - } - return bio; err_out: @@ -252,7 +244,6 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, /* if updated manually, continuous pages has a gap */ if (bio) -submit_bio_out: submit_bio(bio); return err ? ERR_PTR(err) : NULL; } @@ -274,7 +265,8 @@ static int erofs_raw_access_readpage(struct file *file, struct page *page) if (IS_ERR(bio)) return PTR_ERR(bio); - DBG_BUGON(bio); /* since we have only one bio -- must be NULL */ + if (bio) + submit_bio(bio); return 0; } @@ -305,7 +297,6 @@ static void erofs_raw_access_readahead(struct readahead_control *rac) put_page(page); } - /* the rare case (end in gaps) */ if (bio) submit_bio(bio); } -- 2.20.1