From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14B1BC77B72 for ; Fri, 14 Apr 2023 13:54:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbjDNNyQ (ORCPT ); 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 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