Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp474610rwl; Wed, 29 Mar 2023 04:47:07 -0700 (PDT) X-Google-Smtp-Source: AKy350ZSl2dMVDlbThG/7dSGs/QLAMS8x+Jf3gzI56MiX+mwiwb4VvbnEskiFwm2kB0chdlZ3LLv X-Received: by 2002:a17:907:9b06:b0:946:f71c:3b11 with SMTP id kn6-20020a1709079b0600b00946f71c3b11mr1663954ejc.76.1680090427615; Wed, 29 Mar 2023 04:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680090427; cv=none; d=google.com; s=arc-20160816; b=Hk4dIZFbDk4TsszcpxMC9h2rqqh9BV1ZOYVonmYu5NWUp4coN9M8KQ3mtVuzTFKZtk xgj9unlYMXIfHD/ew4qrLQmSS1f1oRMLTLdjspNX9dZMGGHkjlD5HDzkN7kXOPtw3IFX Vqv5pO9YtXUiho2JzWSQjNx0krUR0Kpeef1cFIpKieT9LToUC3KSwb4POKPeCnUazF5Y CzeYe9p4fD7KruygmOvwbDEOM7/du4xjTjmkzWXgQRN6HDu3oYWuADLLByLUIhCzKUuy 0KoOcVfU3ppHbkeHIa0c1PTh57R108haHAyx+gX43FG4BnTp7LJtURCu62FB0pAvgfX/ x+lA== 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:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=9rtdQyV0q9oVWf7iT9zqh6jDfdmbrVZm1KuGQCRjagw=; b=nSjhBi5mUhjvtvcmsQNTX8ac6UjrVmgfeRmgx+2nqInj08tiK3zny1l1wanX5aaYUw FFmx6P8lek6OQm7VikXWzSt3MUY6yg/qxrt1o2Tdpo00CqAyMTO7+f3HvV6uqnHOBNTk zBEpL9iaMxIkcCRiKNbpoLP2F3o/xPlXYLwsIjWElk/i79SLJThrtE7N2/kVLAEF5Rwc v6WLgVZq1GS32mIiCY7vx5UZMZ8+oZwofr+VU41YktFC/W2hFcr0WrKy5jpuO0TIQqsK /7FHRkv4lOJF10BuSbVjpiR6WcLWzxZcBjfgkzqLlqhk+5mDpmKuQ/vb77I90+ayLIm6 BNJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Se1EbJ5Q; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t6-20020a170906608600b0093afada55b4si17391963ejj.351.2023.03.29.04.46.42; Wed, 29 Mar 2023 04:47:07 -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=@bytedance.com header.s=google header.b=Se1EbJ5Q; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbjC2LnT (ORCPT + 99 others); Wed, 29 Mar 2023 07:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjC2LnS (ORCPT ); Wed, 29 Mar 2023 07:43:18 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2849310F for ; Wed, 29 Mar 2023 04:42:53 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id h12-20020a17090aea8c00b0023d1311fab3so15856574pjz.1 for ; Wed, 29 Mar 2023 04:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1680090172; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=9rtdQyV0q9oVWf7iT9zqh6jDfdmbrVZm1KuGQCRjagw=; b=Se1EbJ5QdV7CwGZKR2MPJqTyvXrNSkMYRY9I4ZB75dhn5fOGk6RHn6GTwO05Moaj1+ eJCdNSfTgVCBnuwzelj/LB40TfMPd+T/vZIV58OmKQSRCOzCPpyKG/kHdi/6kHXI9GPX 5yW+j08hKi5BQ0/Apb8TC3t5gTMFSvh9RDAQ/A3RDcbr0BkeZyOxOkchF33TUywjqgoS CWYe2VMr6KQXoBVe0eO+6XIqqcm5sb3HQlBiWMwxkSfVW7iIMDXgpsfeIG7RDzsWLEZB /JQBe1N6E8vFNHCasrw2qtQXeC9ZntT6FIkbAl1NMRyeRiOqG5sgAIQFs0AatYl+tONI 40KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680090172; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=9rtdQyV0q9oVWf7iT9zqh6jDfdmbrVZm1KuGQCRjagw=; b=deV6/LeJWMfzNA2L3bDdYFzUeFj4KXxqGE68at5bg5TjgbWBq0Rc3ITbRhmLHh/s7j 3EPC76rsQnzK0KAeQLDKNGipinhQkzr1oyy4gWzJfVhWfkmJqol0kNv0cx9ojZLiabi6 iP2eY6+weDGpn3wyAfqTV+uW7rtY5xT38v+rokI3VBzThkuUjbm2rDpU5U19bmMoXIJA lrltLsCUocDeW1LDT/vD9LG+mcG+T9VzlhBTYd43Nd0TwmYVHaBt8LAagXz7jETVQhXt fKxHYqGmIHIbv/aac9tZycFprIGGk5FV2uVsefKh/WgA5ovlAln56sNKC5AjNf7XqK0U tbHA== X-Gm-Message-State: AAQBX9chWYgmIYV2gYlUjWKwAoQs8MYOf0MnKT0DatrTyuRVHiHIKSls kOdZamQTuyt9FImUXy3+nO4hbA== X-Received: by 2002:a17:903:28c8:b0:1a2:19c1:a974 with SMTP id kv8-20020a17090328c800b001a219c1a974mr14861215plb.68.1680090172616; Wed, 29 Mar 2023 04:42:52 -0700 (PDT) Received: from [10.3.144.50] ([61.213.176.11]) by smtp.gmail.com with ESMTPSA id p8-20020a1709026b8800b0019ab151eb90sm5144283plk.139.2023.03.29.04.42.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Mar 2023 04:42:52 -0700 (PDT) Message-ID: <029453d7-1b2d-3d3c-cd8e-64f5be4420bf@bytedance.com> Date: Wed, 29 Mar 2023 19:42:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: Re: [PATCH V4 3/5] cachefiles: resend an open request if the read request's object is closed To: David Howells Cc: linux-cachefs@redhat.com, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, Xin Yin , Jingbo Xu , zhujia.zj@bytedance.com References: <20230111052515.53941-4-zhujia.zj@bytedance.com> <20230111052515.53941-1-zhujia.zj@bytedance.com> <132777.1680012744@warthog.procyon.org.uk> From: Jia Zhu In-Reply-To: <132777.1680012744@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 在 2023/3/28 22:12, David Howells 写道: > Jia Zhu wrote: > >> + struct cachefiles_object *object = >> + ((struct cachefiles_ondemand_info *)work)->object; > > container_of(). Thanks, will revise it. > >> + continue; >> + } else if (cachefiles_ondemand_object_is_reopening(object)) { > > The "else" is unnecessary. Will remove it. > >> +static void ondemand_object_worker(struct work_struct *work) >> +{ >> + struct cachefiles_object *object = >> + ((struct cachefiles_ondemand_info *)work)->object; >> + >> + cachefiles_ondemand_init_object(object); >> +} > > I can't help but feel there's some missing exclusion/locking. It's indeed kind of complicated here since the async operation. Thus we paid much attention to catching the race scenarios during coding and reviewing. Here are several corner case have been considered: 1. Don't repeatedly push the @work of same object into workqueue: Use state to represent this object. Once the object is set to atomicly, which means the work has been pushed to workqueue. And other concurrent threads will not pick the object to workqueue. 2. Don't repeatedly set state for the same object: Hold the xa_lock during searching reqs and setting it to . Once object is set to , the same object will be skipped. 3. etc. Would you mind providing more hints for this issue? > This feels like > it really ought to be driven from the fscache object state machine. It's a great idea. But the problem is if we add a new state to indicate this reopening status and use fscache state machine to drive the cookie to do reopen(), thus reopen() (in fscache module) ought to invoke cachefiles_ondemand_init_object() (in cachefile module) to require user daemon to open the backend file. But it seems that fscache module should not depend on cachefiles module. >