Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp556532rwe; Fri, 14 Apr 2023 06:55:04 -0700 (PDT) X-Google-Smtp-Source: AKy350Yl2Hd5kcr5laThhbr+NRgYfh1NHsvNnnOf0Yp1g8ccKNWOUU1g+ue9hyKtN9GP+7VgFffV X-Received: by 2002:a05:6a20:3b89:b0:eb:c6f5:10b1 with SMTP id b9-20020a056a203b8900b000ebc6f510b1mr5466349pzh.53.1681480504236; Fri, 14 Apr 2023 06:55:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681480504; cv=none; d=google.com; s=arc-20160816; b=J5yEXRxMHG5Vwye4PzjIHSp+o22AldmEr3K4H9fy9E2I4ZSwFrVsNV28rnz8gSfw3N yToKOGxvi1S6IPCrGHz3chfkzdm97x0OYs51diCtTcdTOxxo8dzHh96AlTy1wgnzj9jz 3al5HUY8xlxZn9JRNh/GBmjToj+OupPmlETSYApKEsBgjuX5Ok8Gb/JgbwDoThv/9Tem HbTh0bVOFvKN04+hApyuvOvdNsxnBDh68D+ah5WPwKio3O8TU9YHqqzVKe053dDcfxHz yrtCugqmqtvNE3zsSXamyCdNKoBgLfS3obWlOooa/2ruURt+Oq8W0ne0Rcx/EB7crfm7 SiAA== 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-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=C/e8KjFHs61uEyXVXMB8pUc3YDR+G8woISfuf6Pj1AE=; b=LhRof0XtQSroSCkPZUnTAhEjGmLuhONLQZtKWFE1b6YEP+Y81iGrIstRsEo1jHIjad lEJTgUsxu7GDvEOVBtvI/RTcgEiJDwcbqufl4Scqk2kcsu0PHKqSDRtJiCUt/RTmy/E3 2zr/Etm+tj3MLjPoLgVsjYWbKWrGz0nEZad59JU/GpQ/syWHbZqts3NKhPCP4VnQKbcK F0ItfLIbLJpNyvOgK8A2uLWj+5g21VSZPPM5vXt4SoYUm7Jn9CoG2TS6jt8HKsSIfiJG 4XqlYiDOHpiw1gcxHtKPp7m/zUeSa5i4fvfg+IHh8WYtxM4ZCAFwGxOzje0pVXqz6aAk 1bWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ao/HRrMg"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w184-20020a6382c1000000b0050f736a8d3dsi4953418pgd.64.2023.04.14.06.54.50; Fri, 14 Apr 2023 06:55:04 -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=@redhat.com header.s=mimecast20190719 header.b="ao/HRrMg"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229848AbjDNNyQ (ORCPT + 99 others); Fri, 14 Apr 2023 09:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjDNNyP (ORCPT ); Fri, 14 Apr 2023 09:54:15 -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 ESMTPS id 6DC419EEE for ; Fri, 14 Apr 2023 06:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681480411; 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: in-reply-to:in-reply-to:references:references; bh=C/e8KjFHs61uEyXVXMB8pUc3YDR+G8woISfuf6Pj1AE=; b=ao/HRrMgS541L3N2O9yI0+PynVuZUNNnl4cIYS0KEYH6KqTXA6ByB+Eau7PiOJCwFwGNzH XPVtN0bo66zt8Ug4maMPqpTiDx6k4j/VuZjTAoB67cEIhVzthbpEXmq8SGkhgx4lTKh6Gt 0AaWvPBGwfQeWQXCZSdVocSPl+N0oeo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-128-2o5ch5vzO-yipSJ1W4Ip1w-1; Fri, 14 Apr 2023 09:53:26 -0400 X-MC-Unique: 2o5ch5vzO-yipSJ1W4Ip1w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8AEC018A63EB; Fri, 14 Apr 2023 13:53:25 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F6492027044; Fri, 14 Apr 2023 13:53:24 +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: <20230329140155.53272-6-zhujia.zj@bytedance.com> References: <20230329140155.53272-6-zhujia.zj@bytedance.com> <20230329140155.53272-1-zhujia.zj@bytedance.com> To: Jia Zhu Cc: dhowells@redhat.com, linux-cachefs@redhat.com, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, jefflexu@linux.alibaba.com, hsiangkao@linux.alibaba.com, yinxin.x@bytedance.com Subject: Re: [PATCH V5 5/5] cachefiles: add restore command to recover inflight ondemand read requests MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1250438.1681480404.1@warthog.procyon.org.uk> Date: Fri, 14 Apr 2023 14:53:24 +0100 Message-ID: <1250439.1681480404@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Jia Zhu wrote: > +int cachefiles_ondemand_restore(struct cachefiles_cache *cache, char *args) > +{ > + struct cachefiles_req *req; > + > + XA_STATE(xas, &cache->reqs, 0); > + > + if (!test_bit(CACHEFILES_ONDEMAND_MODE, &cache->flags)) > + return -EOPNOTSUPP; > + > + /* > + * Reset the requests to CACHEFILES_REQ_NEW state, so that the > + * requests have been processed halfway before the crash of the > + * user daemon could be reprocessed after the recovery. > + */ > + xas_lock(&xas); > + xas_for_each(&xas, req, ULONG_MAX) > + xas_set_mark(&xas, CACHEFILES_REQ_NEW); > + xas_unlock(&xas); > + > + wake_up_all(&cache->daemon_pollwq); > + return 0; > +} Should there be a check to see if this is needed? David