Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6032168rwb; Mon, 14 Nov 2022 13:11:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf7dEvOCgA0wVhnk3wsHiXVqYnEsQ8qsxzjeHGmZlsBy/OQOVBGewBssVMn1D4Nx3NwiEFcs X-Received: by 2002:a05:6402:22f1:b0:462:1e07:1dd7 with SMTP id dn17-20020a05640222f100b004621e071dd7mr12790345edb.293.1668460311358; Mon, 14 Nov 2022 13:11:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668460311; cv=none; d=google.com; s=arc-20160816; b=KVxo0OHQKcyIVZNtZzrQeT2H7G86qApS4vXVFEgIl55OwefwL6mpUmlZTs6G9bzC/F swIiJkaqdPpg150EiLLxR8p44T73P5eqnZBt+6izpOUnbATUNG8SEW9i8ma92TCuG7bn OSZoMmmkYMWse5dYHC7hzZ+Sj683ZLfDismtUKm0Nw17KreFoqEKG9s78b4UzUTaJUon Zv84iBDmjATs8PQOhf5yaCSJGsX5woTCusjt7p/L5xMLGInse+JV3OBJ9CDmcIyce5SZ 0YfZ5pCcingXyUpd/IC7M6nk9/vxlBxnGZgo99o5Sjiexho8t4PSTm1oHRAODkTgAPBi mJ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=wb4O7lLXD9XIPmsq/fgChivZD1DA6NsEAi7ItoReySI=; b=I5dAucYfxsNOuY6wQ07gvp4i5IhLorqkAKcmLbJcuVCIyBTGbpxgwJP01zerc+Gx2I h5s1BP/agJgYjC9xqtkkUO320QLR97KDfWhjLnT3/AbEtBvOHsc/vnstRRFwcxOX04Az 0x/LJnrngfRWKKRPsspzPNGaZzm+81jprvo2YXUSQJ53n04nglOPXJfEIxLYYTcZLEba byy+ihLhm1LndCpVzmUMIXIgTyN+PZ3S15Pv8b+n4UBFp0UdzA78Uh0Z9f1OECsttB0m BiJVk/brwrmPaqaslP/gUE/7hY0TNmJc0Ny/XRfy61h7pv7m1i7mRsjPe+o+FF9fmN1q OMkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="zV5n/LJk"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=KYC+LG7l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a1709063ac200b0079bf804c0c4si7273982ejd.103.2022.11.14.13.11.29; Mon, 14 Nov 2022 13:11:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="zV5n/LJk"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=KYC+LG7l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237054AbiKNUqP (ORCPT + 88 others); Mon, 14 Nov 2022 15:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237062AbiKNUqN (ORCPT ); Mon, 14 Nov 2022 15:46:13 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B0C21A7; Mon, 14 Nov 2022 12:46:12 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 969AF202CF; Mon, 14 Nov 2022 20:46:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1668458771; h=from:from:reply-to: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=wb4O7lLXD9XIPmsq/fgChivZD1DA6NsEAi7ItoReySI=; b=zV5n/LJkrjMApj9pcYixvHtBQxMhgst7PvBJhFMosUSFekJO3P93V557ZUEXHiNCeMp+tA a10oMsgDSNVLmKhNbiZngufxZqPiKw4b83sqPEk5ue9rbZOwPJ9EqaIyhaVepiNG76ukoJ Z5eq9SQAjr0T2HamFZViIhEvX9at2sQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1668458771; h=from:from:reply-to: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=wb4O7lLXD9XIPmsq/fgChivZD1DA6NsEAi7ItoReySI=; b=KYC+LG7lwwa2agl/O+HdnbT1z24eFyUEJlZRIOmLHuTBubf7Eb3ArF/5lQLNMP3+5ELS0t GHmThhdyBf1XMJDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4B57E13A92; Mon, 14 Nov 2022 20:46:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id q3laEROpcmMzOwAAMHmgww (envelope-from ); Mon, 14 Nov 2022 20:46:11 +0000 Date: Mon, 14 Nov 2022 21:45:45 +0100 From: David Sterba To: Qu Wenruo Cc: Li zeming , clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] btrfs: volumes: Increase bioc pointer check Message-ID: <20221114204545.GB5824@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20221026013611.2900-1-zeming@nfschina.com> <26b65420-2609-26a5-9cc2-c12cabd310e0@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <26b65420-2609-26a5-9cc2-c12cabd310e0@gmx.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 26, 2022 at 02:42:51PM +0800, Qu Wenruo wrote: > On 2022/10/26 09:36, Li zeming wrote: > > The __GFP_NOFAIL flag will cause memory to be allocated an infinite > > number of times until the allocation is successful, but it is best to > > use it only for very necessary code, and try not to use it. > > > > The alloc_btrfs_io_context function looks a little closer to normal > > (excuse my analysis), but I think we can remove __GFP_NOFAIL from it and > > add a bioc pointer allocation check that returns NULL if the allocation > > fails. > > > > Signed-off-by: Li zeming > > --- > > v2: Add annotation vocabulary modify, remove __GFP_NOFAIL flag. > > v3: Modifying the Description. > > > > fs/btrfs/volumes.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c > > index 064ab2a79c80..b8d901f58995 100644 > > --- a/fs/btrfs/volumes.c > > +++ b/fs/btrfs/volumes.c > > @@ -5891,7 +5891,9 @@ static struct btrfs_io_context *alloc_btrfs_io_context(struct btrfs_fs_info *fs_ > > * and the stripes. > > */ > > sizeof(u64) * (total_stripes), > > - GFP_NOFS|__GFP_NOFAIL); > > + GFP_NOFS); > > + if (!bioc) > > + return NULL; > > > > atomic_set(&bioc->error, 0); > > refcount_set(&bioc->refs, 1); > > @@ -6071,7 +6073,7 @@ struct btrfs_discard_stripe *btrfs_map_discard(struct btrfs_fs_info *fs_info, > > * array of stripes. > > * For READ, it also needs to be supported using the same mirror number. > > * > > - * If the requested block is not left of the left cursor, EIO is returned. This > > + * If the requested block is not left of the left cursor, EIO should be returned. This > > Is there any need for this change? > > I don't think your patch has even touched the call chain of > get_extra_mirror_from_replace(). That's maybe an accidental change, not relevant to the NOFAIL removal.