Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7631834rdb; Thu, 4 Jan 2024 02:47:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHJZZpkwkPC5ZbOkw+m7gX5Ax0WA5IqLxaO2gxOvfqJjB2bd6rj6nCtN+tiqzRaDuhf8ZG X-Received: by 2002:a05:6214:d4d:b0:67f:1683:3906 with SMTP id 13-20020a0562140d4d00b0067f16833906mr496561qvr.48.1704365276201; Thu, 04 Jan 2024 02:47:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704365276; cv=none; d=google.com; s=arc-20160816; b=k5R010IykYF/PHguJVPrRgSGK1YLCLEaNBcDBIXRwGaIT458yKIJcVDUhf813WU3xM uBRrfb0lrBvmWQ43s3hE9DeJP+lgaiYAOQpLz70k+rWJVFGV92K2A7Y1Amkb4ZDD/nWY bM7oXa6P5Dwibx8lgLlCwnCvor4dzjodmY5Me/E+iLQDs3xqHWj1uFaS+JBcoBqv8vUv stZCOUzjxpC7dLWopruH2FthuiwYicYvsd5uSWdCTFkHcbHy4pkoBzGCsRrrdTN+MrbH uBX92DnQ6yLOdEOJVu92YMCahPuoMXwnRboZEN8Fspvv62Krj40Krt/go769AqJsP/TQ CeGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=0xDR6XwHytPud1CbM6v6PSB56naMx2aLdGVZIy/AXAE=; fh=kP4L/kBnbdgLqRw7petdwzYVQ2IiFZuax3mulIw1HZM=; b=xJBylWsRYObxAoamvJgpgkOjfy9GohQtlRxIDvf9zL3vE2Y8hPzaHM0oP6GyqqhhnW eGzpPKizLVtvTLy9RK4YOOGeFrdNxXpqfgv+Pt775LzcLARpW2Zhl1oKv5950lfMNSXv Tj1ZrXao0Ye2LMM5n/7i77V71UKsbntUKIzjAP3CgIqHAB0EtQruNWePiZDELQsoDEYH GaVqzl9d4OWl5mYdtYMWJp51IeW3WXNpqKda7HcDIcf8TOmr2nOxUOpZ47Y9u7EfJ/TK tinCom5IedqnpEpIP3zEXop/awvbIqI3tUbV8ktWwVEntmcayH2KrHZyP2IX9gJNgjTM WlAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dbDtUjiK; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=cpu22t34; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dbDtUjiK; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4+bounces-675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-675-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u3-20020a0cdd03000000b0067a5330c2c7si31217147qvk.459.2024.01.04.02.47.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 02:47:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dbDtUjiK; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=cpu22t34; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=dbDtUjiK; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4+bounces-675-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-ext4+bounces-675-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F0C671C23D2A for ; Thu, 4 Jan 2024 10:47:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D417420DEA; Thu, 4 Jan 2024 10:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="dbDtUjiK"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="cpu22t34"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="dbDtUjiK"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="cpu22t34" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2406210EC; Thu, 4 Jan 2024 10:47:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 13EA61FCD8; Thu, 4 Jan 2024 10:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1704365254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0xDR6XwHytPud1CbM6v6PSB56naMx2aLdGVZIy/AXAE=; b=dbDtUjiKOkor6Y3Xfq4BCOUXIDTPuiKUNoLANs4QrHuWa3kXncpygSdaQTzERkZYJUIayp IouCbPh+T/wu5w2GJ+ULJW5+kotiw1qCmz4J0jmIp5g05blUsOJ4KenGJL1PZybw+/yrja EVEjqFpLGL4Xq9RFb+ANhQ8QCS/Qjhg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1704365254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0xDR6XwHytPud1CbM6v6PSB56naMx2aLdGVZIy/AXAE=; b=cpu22t34NOp7Xz0hFfc1RZVzbaX08YP3sjEGuE3c+Qm6NQXyjLsoxizFJQuVU76h2NdKHm UIUZxm6gyeiPJlAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1704365254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0xDR6XwHytPud1CbM6v6PSB56naMx2aLdGVZIy/AXAE=; b=dbDtUjiKOkor6Y3Xfq4BCOUXIDTPuiKUNoLANs4QrHuWa3kXncpygSdaQTzERkZYJUIayp IouCbPh+T/wu5w2GJ+ULJW5+kotiw1qCmz4J0jmIp5g05blUsOJ4KenGJL1PZybw+/yrja EVEjqFpLGL4Xq9RFb+ANhQ8QCS/Qjhg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1704365254; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0xDR6XwHytPud1CbM6v6PSB56naMx2aLdGVZIy/AXAE=; b=cpu22t34NOp7Xz0hFfc1RZVzbaX08YP3sjEGuE3c+Qm6NQXyjLsoxizFJQuVU76h2NdKHm UIUZxm6gyeiPJlAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F1D7F13722; Thu, 4 Jan 2024 10:47:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id egsHO8WMlmXmdwAAD6G6ig (envelope-from ); Thu, 04 Jan 2024 10:47:33 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id ADDE4A07EF; Thu, 4 Jan 2024 11:47:33 +0100 (CET) Date: Thu, 4 Jan 2024 11:47:33 +0100 From: Jan Kara To: Baokun Li Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, yukuai3@huawei.com Subject: Re: [PATCH v2 7/8] ext4: avoid allocating blocks from corrupted group in ext4_mb_find_by_goal() Message-ID: <20240104104733.d6oyepneq7ky7ote@quack3> References: <20231221150558.2740823-1-libaokun1@huawei.com> <20231221150558.2740823-8-libaokun1@huawei.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231221150558.2740823-8-libaokun1@huawei.com> X-Spam-Score: 1.61 X-Spamd-Result: default: False [1.61 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-0.29)[74.55%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[10]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[vger.kernel.org,mit.edu,dilger.ca,suse.cz,gmail.com,huawei.com]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: * X-Spam-Flag: NO On Thu 21-12-23 23:05:57, Baokun Li wrote: > Places the logic for checking if the group's block bitmap is corrupt under > the protection of the group lock to avoid allocating blocks from the group > with a corrupted block bitmap. > > Signed-off-by: Baokun Li Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/ext4/mballoc.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index 2bb29f0077bd..b862ca2750fd 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -2340,12 +2340,10 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, > if (err) > return err; > > - if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) { > - ext4_mb_unload_buddy(e4b); > - return 0; > - } > - > ext4_lock_group(ac->ac_sb, group); > + if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) > + goto out; > + > max = mb_find_extent(e4b, ac->ac_g_ex.fe_start, > ac->ac_g_ex.fe_len, &ex); > ex.fe_logical = 0xDEADFA11; /* debug value */ > @@ -2378,6 +2376,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, > ac->ac_b_ex = ex; > ext4_mb_use_best_found(ac, e4b); > } > +out: > ext4_unlock_group(ac->ac_sb, group); > ext4_mb_unload_buddy(e4b); > > -- > 2.31.1 > -- Jan Kara SUSE Labs, CR