Received: by 2002:a05:6512:3d0e:0:0:0:0 with SMTP id d14csp49059lfv; Tue, 12 Apr 2022 16:49:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaa5pFa/n3LygQRfeMtm2xP1AhoOYC6eAes8vAkD1TSeh0nM6s6kkdLyhDLdWzjBb9m864 X-Received: by 2002:a17:90b:1d82:b0:1c6:d549:7b94 with SMTP id pf2-20020a17090b1d8200b001c6d5497b94mr7673216pjb.49.1649807362402; Tue, 12 Apr 2022 16:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649807362; cv=none; d=google.com; s=arc-20160816; b=gvOIUmihBcpM4lv8wTrx482KJqWaSOFgUtf+0UceohRJrqX//xItiFmrxOk0zEbOEL n8/J+kuhj44/aVFZ0VcEVmmcW4biW+U1Xrmy3DAHccyQcdFNm6zuWngZ3r6UOQvhWxVp 1nYnDKW9tU2CbF3fL1GpgNKP+Zt/AUZ3Oqz1+/NTnCxYlwo0jmBS9iau/PPAwfjbZiyk VTXahOS+NdjnryoVdv5rTsVmzqwl2th0lQYqeVws938hloON0gXQf90JasYj5RQDIVW6 FPhmnc/O1AEqsSEuLS3XarICcyXOHzNoD4jY5LdFE/SXFnBr76HSymi7AJJU8YtUHV40 dAMA== 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; bh=vigGZchKPsxBZJjhiM+/JIYXSSG43PCuWRnvFurC7yg=; b=X9jjFquxhb3k+fExwTZHV7sNSsrsH0ybF0GWjbL280wRmgfmgl7nEAa5YaQpunxevB M/RCC3bgRS00NAUww9kpzxFjRh84n6sIETtS8dSgUe89uWN4qetLX8m0+fGJxQc/xGDD pI58pzSK7wg1TzAhyJmS+8rMOZeK7Gy2e9vhGtq5jslqw7sPUfqMw+dWbC+C/UlrVWYk 8xTcIa+r++t2jrf0Nwhudd2x+lS4EUBcheMNcU4qbBNKn3bmjrRb8H4JqIlYLsgAyV+d uYJd4KFZ6KmgxbfAW+74peYXbvUzYQ5/9gafA+iR0ex+ZJlmsHaR8oTK95os5j6k01IZ wqyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b13-20020a056a000a8d00b004fa3a8e0028si14808211pfl.223.2022.04.12.16.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 16:49:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 70D601DE6FF; Tue, 12 Apr 2022 14:42:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243143AbiDLDiR (ORCPT + 99 others); Mon, 11 Apr 2022 23:38:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbiDLDiO (ORCPT ); Mon, 11 Apr 2022 23:38:14 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0589186D2; Mon, 11 Apr 2022 20:35:57 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0V9sqOTP_1649734551; Received: from 30.225.24.141(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V9sqOTP_1649734551) by smtp.aliyun-inc.com(127.0.0.1); Tue, 12 Apr 2022 11:35:53 +0800 Message-ID: Date: Tue, 12 Apr 2022 11:35:51 +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 v8 04/20] cachefiles: notify user daemon when withdrawing cookie 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 References: <542f749c-b0f1-1de6-cb41-26e296afb2df@linux.alibaba.com> <20220406075612.60298-5-jefflexu@linux.alibaba.com> <20220406075612.60298-1-jefflexu@linux.alibaba.com> <1091405.1649680508@warthog.procyon.org.uk> <1094493.1649684554@warthog.procyon.org.uk> From: JeffleXu In-Reply-To: <1094493.1649684554@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=unavailable 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 4/11/22 9:42 PM, David Howells wrote: > JeffleXu wrote: > >>> >>>> + if (fd == 0) >>>> + return -ENOENT; >>> >>> 0 is a valid fd. >> >> Yeah, but IMHO fd 0 is always for stdin? I think the allocated anon_fd >> won't install at fd 0. Please correct me if I'm wrong. > > If someone has closed 0, then you'll get 0 next, I'm pretty sure. Try it and > see. Good catch. > >> In fact I wanna use "fd == 0" as the initial state as struct >> cachefiles_object is allocated with kmem_cache_zalloc(). > > I would suggest presetting it to something like -2 to avoid confusion. Okay, as described in the previous email, I'm going to replace @fd to @object_id. I will define some symbols to make it more readable, something like ``` struct cachefiles_object { ... #ifdef CONFIG_CACHEFILES_ONDEMAND #define CACHEFILES_OBJECT_ID_DEFAULT -2 #define CACHEFILES_OBJECT_ID_DEAD -1 int object_id; #endif ... } ``` Thanks for your time. -- Thanks, Jeffle