Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2182499pxp; Mon, 21 Mar 2022 13:15:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHWozg18A2h7OvOd1k9nxQ60jo6+11IfmN6pSrw6STGCDBzS9vd9EYyCY/9PW6MSs1iXXh X-Received: by 2002:a05:6402:2706:b0:418:fcb2:3a02 with SMTP id y6-20020a056402270600b00418fcb23a02mr7535990edd.111.1647893713215; Mon, 21 Mar 2022 13:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647893713; cv=none; d=google.com; s=arc-20160816; b=jCu+PlG/dBhdUMdMkpLFvVCDrTkoILRjprSvj0NQCOhlCSpOLi8mU5SyY7r7lTs+M/ aAcjP3nRpIPRwmGP6fM2IvXjGXXNUO28zB/RH/Jk1skXUb5KdfSnuvKB89KPIoF06H5A VrxYbVduPSnYVAZcznK6FyqaSfAJIrcy7wfVy97kbHq8NnMlx1raVnEqMRh2IHh4i2EW RLvh7LADZsJv5t7FkratRrj8Lb0ObM1E5TUdeP3sPtGcT1G2meEJ3z3tm8BIn/NF95ob o66c/WVeS4wgd34WxD3++pR7VfHje4SFrqYY84yj1rpcARRjM5XIEKvrR/QYojaBAPqO 2aPA== 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=hgfNYOuqSvtqosHT/IRWDVMrQ8Za/QEFpUudMxJqUF8=; b=ViNH8nGn2cV60QLmCOyveHpe8/Voy0ektj7FA9mEoqNl5/wnjtU91GZdAxaDPuJLpv wHnoU1g7fCHAJ2hra8stLN3wuNnJlI3xaFbNNBh77qHf9yzfQpHml0PLaaOO8M0/rsvl 3exy/NudgIXUuSoYce5ss6YHWcYbHVtKvtlfk/8R32L8nyg4ddYk3dvnC1gsJ/RsHjm4 OofeeaApUeLqp/WAFCivoVAj46KUhPjtcPb/WNk+92UZ0G7o+l8iMvpRviYCgy2t0bHX PSrwj4IiwNQFLLc61DQCIxpJBFXhhlg0e9LTSHY7fvB7p3WPkaFY7duTxFq8rEIhG05s YfNQ== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v29-20020a50d59d000000b00418c2b5be93si9762658edi.373.2022.03.21.13.14.45; Mon, 21 Mar 2022 13:15:13 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349531AbiCUOoy (ORCPT + 99 others); Mon, 21 Mar 2022 10:44:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349508AbiCUOow (ORCPT ); Mon, 21 Mar 2022 10:44:52 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4898E3BBC6; Mon, 21 Mar 2022 07:43:26 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0V7rWiGy_1647873800; Received: from 192.168.31.65(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V7rWiGy_1647873800) by smtp.aliyun-inc.com(127.0.0.1); Mon, 21 Mar 2022 22:43:22 +0800 Message-ID: Date: Mon, 21 Mar 2022 22:43:20 +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 v5 04/22] cachefiles: notify user daemon with anon_fd when looking up 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 References: <20220316131723.111553-5-jefflexu@linux.alibaba.com> <20220316131723.111553-1-jefflexu@linux.alibaba.com> <1029248.1647871294@warthog.procyon.org.uk> From: JeffleXu In-Reply-To: <1029248.1647871294@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 3/21/22 10:01 PM, David Howells wrote: > Jeffle Xu wrote: > >> + read_lock(&cache->reqs_lock); >> + >> + /* recheck dead state under lock */ >> + if (test_bit(CACHEFILES_DEAD, &cache->flags)) { >> + read_unlock(&cache->reqs_lock); >> + ret = -EIO; >> + goto out; >> + } >> + >> + xa_lock(xa); >> + ret = __xa_alloc(xa, &id, req, xa_limit_32b, GFP_KERNEL); > > You're holding a spinlock. You can't use GFP_KERNEL. Oh yes... I've dropped into this for second time... Sorry for that. > >> +static int cachefiles_ondemand_cinit(struct cachefiles_cache *cache, char *args) >> +{ >> ... >> + tmp = kstrdup(args, GFP_KERNEL); > > No need to copy the string. The caller already did that and added a NUL for > good measure. Right. > > I would probably move most of the functions added in this patch to > fs/cachefiles/ondemand.c. Alright. -- Thanks, Jeffle