Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2507266pxb; Sun, 3 Apr 2022 09:16:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQotI9lNnjV/2vCvwwF95dhqL8SDIBno78ASNIz8HSh/No/CFPFGX2QRN4b45RULCmJ8Y6 X-Received: by 2002:a17:907:3c81:b0:6e6:9387:3d74 with SMTP id gl1-20020a1709073c8100b006e693873d74mr5772587ejc.589.1649002613042; Sun, 03 Apr 2022 09:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649002613; cv=none; d=google.com; s=arc-20160816; b=X2esBYANZU6hDdu/5AZZ7dc9o5gCWoIGmL+rnFM45ff0JkjdAEW9xGUNEnuyHKMPyJ DZXbpKr03CbGRkTMlna0vHvsYGUV/ZPTAPAStp/dRo955tHW0Ocz+C5uLwBNCOCzl1lG ZFw1fnc8NdPuimJ0TVtXiCboI3kM5ltSUl6n0WpEZmu4Ll1MmnLTijVEoPXk3rkE568h 1xhdxPXljNjmRvnvFCEwXEPRp8MSgcPuNRK3oqMqLz/+FxBmhowh6odqYD/VjmF80tjM THIYfivzsOv2S7VKRnULMPp8sm1mroD73yl15HfsFrp82gQcVUj1D6sPGyZkvNR2bkj/ 8B8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+YeRyrIelAzlbv0mk7sknMueE1AFF77dV1ezjSpjf9M=; b=HhShXOxhqZwSPmID0HsqvKWISM7TZLcuutPp/Wl2pZMtOs4GmMVdwntKMwvGA+0pse uKQruCYFYGVbJSiElhryFLVZYptrrXyf865iMiBqgAeLBJGhNqhUQ4uqu4LGS+55WD/j SVUlg32czC3w5kEDwvhC2GtG3a2vHKG7EJe1Rks1ACu8CvTsGL3adtbovfebci4M08ct 06d4rf2NkwHxLR+M5fwrkTr9UPgXFTRQfWk+nowDDZaWArhz+oEWTUpi2kA0iyGV37vT F7j3BrLjeEsRIiJvYrhUgHqX9qSIUQ0lFcoeYnCAsO45PlMeap5/r+OBnlCiY+vjk/uI eQUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Jzo+Ql7P; 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 s7-20020a056402520700b00418c2b5be11si5820468edd.243.2022.04.03.09.16.21; Sun, 03 Apr 2022 09:16:53 -0700 (PDT) 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=@infradead.org header.s=bombadil.20210309 header.b=Jzo+Ql7P; 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 S244898AbiDAEsW (ORCPT + 99 others); Fri, 1 Apr 2022 00:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232741AbiDAEsU (ORCPT ); Fri, 1 Apr 2022 00:48:20 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E84621017EB for ; Thu, 31 Mar 2022 21:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+YeRyrIelAzlbv0mk7sknMueE1AFF77dV1ezjSpjf9M=; b=Jzo+Ql7PmZZzg7nbMNgS36Km8B rNxsS1ptqZ0SUy/718K1NPLLR/hkT0vxorgavG8Aodstw9jCrZxYGMX5V/xwLv5XNCs1FdFQBuosm ZJCigRKoASOHqDycPeS1jIXUoQtaETniiUa8Q/q3bS9juyXSjgd0oCZmjT2ytw8HPP945ZFoYqmdC hyVT80mvY/ip9Y/FmjvBIFYGp19meuX7gAc+9kfYSb080Ld0G0HZd35j4jvIdrYbzqK9fPlIU9Fbk 1BzdKS2HyakUBOnWMMNDBQOXvgSGrH30AxhJCS0lO5+QLplp/v1XEwFULVNJ1k11n71mRBbtEHc1r C6gQpkdw==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1na9Az-004Tk9-PQ; Fri, 01 Apr 2022 04:46:21 +0000 Date: Thu, 31 Mar 2022 21:46:21 -0700 From: Christoph Hellwig To: Jiasheng Jiang Cc: hch@infradead.org, rpeterso@redhat.com, agruenba@redhat.com, cluster-devel@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [Cluster-devel] [PATCH] gfs2: Add check for mempool_alloc Message-ID: References: <20220401033755.1892644-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220401033755.1892644-1-jiasheng@iscas.ac.cn> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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_NONE,T_SCC_BODY_TEXT_LINE 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 Fri, Apr 01, 2022 at 11:37:55AM +0800, Jiasheng Jiang wrote: > >> Fixes: e8c92ed76900 ("GFS2: Clean up log write code path") > >> Signed-off-by: Jiasheng Jiang > > > > Please explain how it could fail to start with. > > I think that for safety, the cost of redundant and harmless > check is acceptable. > Also, checking after allocation is a good program pattern. > Therefore, it should be better to check it although it is > hard to fail. Please take a look at the implemetation and documentation of mempool_alloc again. Thewhole point of that function is that it will not fail for allocations that can sleep.