Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2286831pxp; Mon, 21 Mar 2022 15:56:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJXK8ZIhSFdNJ1r05lJNA5hAbCQPhoC4boi4XmnNWKhcVJDHgXol/CMS6/tQL8TAMT/70Y X-Received: by 2002:a05:6a00:2296:b0:4f7:9e15:57e0 with SMTP id f22-20020a056a00229600b004f79e1557e0mr26549215pfe.17.1647903413369; Mon, 21 Mar 2022 15:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647903413; cv=none; d=google.com; s=arc-20160816; b=V5asdodxQLS0nrdvK5f66z6TvDKukyT1jub45KCe23rfTYxZsXu07F78WE5DZ2puXu I2XaSTr4QxB8sJ0UR2TXXXHPHjkg4maBn6n/vHjuipADKM/8fP8kXnNfHunF+kEO/z8l IOPdq2QNtgR9Da004D6FI3HAfaKWY0xAlgDhmChst+3yWaC7dylLa92Jt4eefkj+nH9y Lha616l0CIvOn2BbsxOvd9oFL+KR9uhhpLPMVGSFfnZR6eJcRvql3zTOclygrOSUQzY9 CekVv9SyUNmNZUsnXq/1PuxUv0KTJmwh3f6tKlfRDuTPrFOba4xQcMDloU1by4ti6NLJ mAug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=e08TBu9LXeju0JfJXQDlbeITBDevreGVnW43wNE54QU=; b=OWs03UtDTF21WZwrrBbD8d+9c8GdHitHGKBhncliHdrmj9j/w0GLU+upCYNwsLa2xN 8fwaj5vZpv1TgxoofFl/VadPV35JGlwUFuOjENAM+VmSUmN1SKvqBvE/R4Hhgh3AQeAB Z2TXUhiKOi1B4+gVqOyZiOLbFRvTtawvYA1QFO6TIJEZv9xWzzSQmJFK38X31x7N2ZOT 1VoT2K8xeWFggh9VwY6xrNNdbVtXDsQ5XQVi68G0mZuIVNkX6vrkwSXtMcI5XalkFuNa 3wGFpFFBH6eB4RFVNRoe+os1qMgIxaZAXDpw8GXAgtMfnlxBkt/KGyLshHw/v63UQe+7 f/mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BbLMlC4q; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h12-20020a170902eecc00b00153b2d165c1si11971762plb.457.2022.03.21.15.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:56:53 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BbLMlC4q; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5975B633AA; Mon, 21 Mar 2022 15:09:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346510AbiCUONv (ORCPT + 99 others); Mon, 21 Mar 2022 10:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348579AbiCUOGx (ORCPT ); Mon, 21 Mar 2022 10:06:53 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8CB9538BDD for ; Mon, 21 Mar 2022 07:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647871312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e08TBu9LXeju0JfJXQDlbeITBDevreGVnW43wNE54QU=; b=BbLMlC4qYcZq6m5/4hva+u+LQsJ9mogro+Rgaa+jVFBXJnmC/Vk58CQ0Iu4xoYdVCjQwZV pCLmnXdA+rsrcWiBmwVSkYzQ8fu0xwEyOWk/Rchhbi+5nurWQHh8zGYq5XW2trqA+NLOjG oYKpTrMsUnpZ1UULX6EiH6dBuR25F9c= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-H3oEy_SQPG2zWEEw1fs1Sw-1; Mon, 21 Mar 2022 10:01:46 -0400 X-MC-Unique: H3oEy_SQPG2zWEEw1fs1Sw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CCF028035F1; Mon, 21 Mar 2022 14:01:45 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5DB92166B2D; Mon, 21 Mar 2022 14:01:34 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20220316131723.111553-5-jefflexu@linux.alibaba.com> References: <20220316131723.111553-5-jefflexu@linux.alibaba.com> <20220316131723.111553-1-jefflexu@linux.alibaba.com> To: Jeffle Xu Cc: dhowells@redhat.com, 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 Subject: Re: [PATCH v5 04/22] cachefiles: notify user daemon with anon_fd when looking up cookie MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1029247.1647871294.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Mon, 21 Mar 2022 14:01:34 +0000 Message-ID: <1029248.1647871294@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =3D -EIO; > + goto out; > + } > + > + xa_lock(xa); > + ret =3D __xa_alloc(xa, &id, req, xa_limit_32b, GFP_KERNEL); You're holding a spinlock. You can't use GFP_KERNEL. > +static int cachefiles_ondemand_cinit(struct cachefiles_cache *cache, ch= ar *args) > +{ > ... > + tmp =3D kstrdup(args, GFP_KERNEL); No need to copy the string. The caller already did that and added a NUL f= or good measure. I would probably move most of the functions added in this patch to fs/cachefiles/ondemand.c. David