Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5388739ybg; Tue, 22 Oct 2019 02:27:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUw7X6goJLEP8k/v17XlTcdu9qUsZqHdE0BVFiKabW2gREVmNnkzSslhWjm/Yz4CkluOfQ X-Received: by 2002:a05:6402:68b:: with SMTP id f11mr3780445edy.173.1571736459318; Tue, 22 Oct 2019 02:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571736459; cv=none; d=google.com; s=arc-20160816; b=NuEANPS9thkCKEMSVjvcLK1WqA44NEkCv30wr9dbkoakbAmR0mUvf237NOpBmX1b7H 5M5AkDLkF9L5I54Edf+9dcUTc7Bm3sC8paRIzf6BAGdBFxqgPNnhM87SytYNEf4Ql598 jO7p4KZCkOpqOnvs19WGsIFP451/rcZRcn4PDFmrDKQFcq+6R2cy5u+ey9bCGItuQBmm lplMaYZgaRBefTyrLB0AsESNLO8/em3EWeMZqEjb3NnUoEN97G1W0ks0fsBDl7Vay8yW G8z6hs/ogp5tqe0SMo4S3cu4BI53IruBEmN9/IhsW2xDi5u/NqMEniBVZoAVwv38acKa 4B8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CRzLGnajq2LAdht+6afkTSrSSpPxKX2QAuW8Rz4C4lQ=; b=D46dm1F/R6wuyjPXAe4IEqPPhgwk2W1DvxoEST/f+wBLJER7mH/sm+RHyNmTrj/miv vLx3ofdR/6jUIT0IXfpJ1vFNgr9b+CrMlGg+yDmO8EfW9PXe5yiKzQUwoM5+CHXNHewy g7ICoHeYslDvgepHj3wb74cAikZDWd70txul7r8elaWxGw2JPKBJs8dsoDUnldivHCdy d0zw/xQeL77AvQKvMG5TAseGt233riZ2EF8ddlNb3x2GP+6ZmOfeAxhoOufGMHB+r0PO uE0WIZnSHN4TjSJeQpTaDP7+Rwj1+O4Ed0evvM8da5gSKXnlU+wfDn+6wmjxEucjumyV UCMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si635986eda.339.2019.10.22.02.27.14; Tue, 22 Oct 2019 02:27:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730619AbfJVJ0A (ORCPT + 99 others); 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