Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp143617rdb; Tue, 31 Oct 2023 03:31:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNg22/44Zhm2ZqjJyRA54BQaWklSbwPeDAL7i5UMmtGbbNjdUlkaKgfDX8bHpGzKFDsVzM X-Received: by 2002:a05:6a00:2d0c:b0:6b8:a6d6:f51a with SMTP id fa12-20020a056a002d0c00b006b8a6d6f51amr15461769pfb.31.1698748264134; Tue, 31 Oct 2023 03:31:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698748264; cv=none; d=google.com; s=arc-20160816; b=tnu/XNkNxxsA3OabUvOawzYJKloUskcySPBCapVHDkmPf/xWPSSVlxfyX82WkgEDgz 9Su2Llqq2dmMx+e/RRR58rbb+If0p7dyXE1x55RN7GnN/V2TwLJ5X+zlrhRx30G4osps qBkfeN/8X7YfmkKmILQSI6nb4iQaqFI1SfZ5rbsq3ONAOvz6vqYnRwUIPqatIRxzEb+i YMCJCW0PFsRQVzuh0sXZj02wqK1gojWNttPNZJGNhkn4FKAD9ICmhFjliyRS/PBf7dQQ a1oHechEkzhgE9QAwsK17WMw3wg8BvIUuv7gDGmXLo1n+YtlYyGjHBDUlunOF1Drn6i7 nU5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=s9BdPUbUEIiftAttUGG76Db2G36AG99FTf1ttgahHFw=; fh=jsJwwuYTy3Q3bk3qROGtmq2W5LGrWtFhrJYiKtfg4qQ=; b=Sb7fdiMm7NJMGs9BSZD8e5xV2UNK2FpTbB5GeLdYreEiAfmCXXYkiVms41Ef5LaQ+g /NUdqk+8Kky92DowuIMLl9WfeWWMgqfhcm7eKwyvx+1I3QSzR5Rn66FdDC7aOCr6nQ9B YrHbFjBgZ6c5O1WkAFrhfaxoUJbaqb5kN/axSECpFQ18Ilh8+nRhO8pbQQwEzk1HNNek HozFhXVmCfi4eFPEo6aqBQDwKh5+dfUtvE0LdfnDYDGtsUpsoAzXIXni9rWTgL330LGi QVRAk8W4YLh8Uo2Xg4QvueY+Peqav9NjGnbOviP5pxPlSw/3kdeygXzBlv6yQiPCvNCl 9prw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fC2f98N9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id b6-20020a056a000a8600b006bd0842622asi810778pfl.239.2023.10.31.03.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 03:31:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fC2f98N9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 0BBE48080D79; Tue, 31 Oct 2023 03:30:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231169AbjJaKaC (ORCPT + 99 others); Tue, 31 Oct 2023 06:30:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234913AbjJaKaB (ORCPT ); Tue, 31 Oct 2023 06:30:01 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B21C310D for ; Tue, 31 Oct 2023 03:29:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55BF2C433C8; Tue, 31 Oct 2023 10:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698748198; bh=2ve8baLNLJx1j/DE/18O2xVsUvR0jKzzYfVZElQOVg8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=fC2f98N9B/E/C5ZWiobhoexBLUU/nOZA6/4Fwumqon44CfQeKTplbvPOSpsWcGXE5 j6GKWNzd/yIucMGlkfpo3fHNpjX0FSlVVGF9JA1XJfH7dxa1npm7dICwOCHf9eeLZ/ IxPcK1GeDsRUEg+R/d7Ko9Hl58/zQ/pHzb4/Kix5F04XpDe27nKf0l7XsaJNgunvaP fm22n78oLz2ZZ3CoXokOsFiSKMY9F5JY2mzwyUHhngo3/ktHgpkXhV0rhit27Tbu+K sQxIVcs9M/Xxg2O3bb25SMtIhHs4219c/PgoR++6XcdATSmXrSC1754KK5UdKOF71j BZPPKLihbwtWg== Message-ID: Date: Tue, 31 Oct 2023 18:29:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH] erofs: fix erofs_insert_workgroup() lockref usage Content-Language: en-US To: Gao Xiang , linux-erofs@lists.ozlabs.org Cc: LKML References: <20231031060524.1103921-1-hsiangkao@linux.alibaba.com> From: Chao Yu In-Reply-To: <20231031060524.1103921-1-hsiangkao@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 31 Oct 2023 03:30:16 -0700 (PDT) On 2023/10/31 14:05, Gao Xiang wrote: > As Linus pointed out [1], lockref_put_return() is fundamentally > designed to be something that can fail. It behaves as a fastpath-only > thing, and the failure case needs to be handled anyway. > > Actually, since the new pcluster was just allocated without being > populated, it won't be accessed by others until it is inserted into > XArray, so lockref helpers are actually unneeded here. > > Let's just set the proper reference count on initializing. > > [1] https://lore.kernel.org/r/CAHk-=whCga8BeQnJ3ZBh_Hfm9ctba_wpF444LpwRybVNMzO6Dw@mail.gmail.com > Fixes: 7674a42f35ea ("erofs: use struct lockref to replace handcrafted approach") > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks,