From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55703CA9EA0 for ; Tue, 22 Oct 2019 09:26:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 28D522064B for ; Tue, 22 Oct 2019 09:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731422AbfJVJ0A (ORCPT ); Tue, 22 Oct 2019 05:26:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:50542 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728182AbfJVJ0A (ORCPT ); Tue, 22 Oct 2019 05:26:00 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C0C21B78C; Tue, 22 Oct 2019 09:25:58 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 0E2EB1E4812; Tue, 22 Oct 2019 11:25:55 +0200 (CEST) Date: Tue, 22 Oct 2019 11:25:55 +0200 From: Jan Kara To: Chengguang Xu Cc: jack@suse.com, linux-ext4@vger.kernel.org Subject: Re: [PATCH v2] ext2: add missing brelse in ext2_new_blocks() Message-ID: <20191022092555.GH2436@quack2.suse.cz> References: <20191022091738.9160-1-cgxu519@mykernel.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022091738.9160-1-cgxu519@mykernel.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue 22-10-19 17:17:38, Chengguang Xu wrote: > There is a missing brelse of bitmap_bh in the > case of retry. > > Signed-off-by: Chengguang Xu Thanks. Patch applied with small update to the comment - this can also hit in case our reservation window was alredy full. Honza > --- > v1->v2: > - Add comment to explain why the fix is needed. > > fs/ext2/balloc.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c > index 924c1c765306..18e75adcd2f6 100644 > --- a/fs/ext2/balloc.c > +++ b/fs/ext2/balloc.c > @@ -1313,6 +1313,13 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal, > if (free_blocks > 0) { > grp_target_blk = ((goal - le32_to_cpu(es->s_first_data_block)) % > EXT2_BLOCKS_PER_GROUP(sb)); > + /* > + * In a special case that allocated blocks are in system zone, > + * we will retry block allocation due to failing to pass sanity > + * check. In this case, the bitmap_bh is non-null pointer and we > + * have to release it before calling read_block_bitmap(). > + */ > + brelse(bitmap_bh); > bitmap_bh = read_block_bitmap(sb, group_no); > if (!bitmap_bh) > goto io_error; > -- > 2.20.1 > > > -- Jan Kara SUSE Labs, CR