From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28016C433EF for ; Fri, 22 Apr 2022 02:44:46 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KkzJs1tdfz3bY5 for ; Fri, 22 Apr 2022 12:44:45 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.54; helo=out30-54.freemail.mail.aliyun.com; envelope-from=jefflexu@linux.alibaba.com; receiver=) Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4KkzJg3fW7z2xsW for ; Fri, 22 Apr 2022 12:44:32 +1000 (AEST) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R101e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04395; MF=jefflexu@linux.alibaba.com; NM=1; PH=DS; RN=19; SR=0; TI=SMTPD_---0VAjn9jI_1650595459; Received: from 30.225.24.197(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VAjn9jI_1650595459) by smtp.aliyun-inc.com(127.0.0.1); Fri, 22 Apr 2022 10:44:22 +0800 Message-ID: Date: Fri, 22 Apr 2022 10:44:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v9 03/21] cachefiles: unbind cachefiles gracefully in on-demand mode Content-Language: en-US To: David Howells References: <20220415123614.54024-4-jefflexu@linux.alibaba.com> <20220415123614.54024-1-jefflexu@linux.alibaba.com> <1444916.1650549738@warthog.procyon.org.uk> From: JeffleXu In-Reply-To: <1444916.1650549738@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-erofs@lists.ozlabs.org, fannaihao@baidu.com, willy@infradead.org, linux-kernel@vger.kernel.org, tianzichen@kuaishou.com, joseph.qi@linux.alibaba.com, zhangjiachen.jaycee@bytedance.com, linux-cachefs@redhat.com, gregkh@linuxfoundation.org, linux-fsdevel@vger.kernel.org, luodaowen.backend@bytedance.com, gerry@linux.alibaba.com, torvalds@linux-foundation.org Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" On 4/21/22 10:02 PM, David Howells wrote: > Jeffle Xu wrote: > >> + struct kref unbind_pincount;/* refcount to do daemon unbind */ > > Please use refcount_t or atomic_t, especially as this isn't the refcount for > the structure. Okay, will be done in the next version. > >> - cachefiles_daemon_unbind(cache); >> - >> /* clean up the control file interface */ >> cache->cachefilesd = NULL; >> file->private_data = NULL; >> cachefiles_open = 0; > > Please call cachefiles_daemon_unbind() before the cleanup. Since the cachefiles_struct struct will be freed once the pincount is decreased to 0, "cache->cachefilesd = NULL;" needs to be done before decreasing the pincount. BTW, "cachefiles_open = 0;" indeed should be done only when pincount has been decreased to 0. -- Thanks, Jeffle From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 672CDC433EF for ; Fri, 22 Apr 2022 02:44:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443480AbiDVCrT (ORCPT ); Thu, 21 Apr 2022 22:47:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241380AbiDVCrS (ORCPT ); Thu, 21 Apr 2022 22:47:18 -0400 Received: from out30-45.freemail.mail.aliyun.com (out30-45.freemail.mail.aliyun.com [115.124.30.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C00DC4B42E; Thu, 21 Apr 2022 19:44:26 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=19;SR=0;TI=SMTPD_---0VAjn9jI_1650595459; Received: from 30.225.24.197(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VAjn9jI_1650595459) by smtp.aliyun-inc.com(127.0.0.1); Fri, 22 Apr 2022 10:44:22 +0800 Message-ID: Date: Fri, 22 Apr 2022 10:44:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v9 03/21] cachefiles: unbind cachefiles gracefully in on-demand mode Content-Language: en-US To: David Howells Cc: linux-cachefs@redhat.com, xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, torvalds@linux-foundation.org, gregkh@linuxfoundation.org, willy@infradead.org, linux-fsdevel@vger.kernel.org, joseph.qi@linux.alibaba.com, bo.liu@linux.alibaba.com, tao.peng@linux.alibaba.com, gerry@linux.alibaba.com, eguan@linux.alibaba.com, linux-kernel@vger.kernel.org, luodaowen.backend@bytedance.com, tianzichen@kuaishou.com, fannaihao@baidu.com, zhangjiachen.jaycee@bytedance.com References: <20220415123614.54024-4-jefflexu@linux.alibaba.com> <20220415123614.54024-1-jefflexu@linux.alibaba.com> <1444916.1650549738@warthog.procyon.org.uk> From: JeffleXu In-Reply-To: <1444916.1650549738@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 4/21/22 10:02 PM, David Howells wrote: > Jeffle Xu wrote: > >> + struct kref unbind_pincount;/* refcount to do daemon unbind */ > > Please use refcount_t or atomic_t, especially as this isn't the refcount for > the structure. Okay, will be done in the next version. > >> - cachefiles_daemon_unbind(cache); >> - >> /* clean up the control file interface */ >> cache->cachefilesd = NULL; >> file->private_data = NULL; >> cachefiles_open = 0; > > Please call cachefiles_daemon_unbind() before the cleanup. Since the cachefiles_struct struct will be freed once the pincount is decreased to 0, "cache->cachefilesd = NULL;" needs to be done before decreasing the pincount. BTW, "cachefiles_open = 0;" indeed should be done only when pincount has been decreased to 0. -- Thanks, Jeffle