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 04B80C6FA82 for ; Mon, 12 Sep 2022 14:35:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230014AbiILOfn (ORCPT ); Mon, 12 Sep 2022 10:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbiILOfl (ORCPT ); Mon, 12 Sep 2022 10:35:41 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 405562F019 for ; Mon, 12 Sep 2022 07:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662993339; 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=yxBrb62A1CiBnIX1UMvfEzop9eEkwJ1FcPBxjds5oeQ=; b=h4GJTa8eVshhBajUHJzVHChYF0jDRk7wvbFRp2qZDpJu6TupmhydvtQXZNyoYTGvj+eUKW oCUGEGhCf8XWkq5yYLetp8/HKpyu9hjP5HILC64fkBp1mw27dNK0pbqDPWA7IndrLKlx7t SQ/5YwSt9GdCr2qvQ0zjxJ3JPk4pXXU= 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-451-cQ_uu3dDM-C6QVcBXRX4vw-1; Mon, 12 Sep 2022 10:35:37 -0400 X-MC-Unique: cQ_uu3dDM-C6QVcBXRX4vw-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 28DFE185A7A4; Mon, 12 Sep 2022 14:35:37 +0000 (UTC) Received: from horse.redhat.com (unknown [10.22.32.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11CFE2166B29; Mon, 12 Sep 2022 14:35:37 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id C13DD2209F9; Mon, 12 Sep 2022 10:35:36 -0400 (EDT) Date: Mon, 12 Sep 2022 10:35:36 -0400 From: Vivek Goyal To: Amir Goldstein Cc: Miklos Szeredi , linux-fsdevel , Hanna Reitz Subject: Re: Persistent FUSE file handles (Was: virtiofs uuid and file handles) Message-ID: References: <1bb71cbf-0a10-34c7-409d-914058e102f6@virtuozzo.com> <20200922210445.GG57620@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Sep 12, 2022 at 04:38:48PM +0300, Amir Goldstein wrote: > On Mon, Sep 12, 2022 at 4:16 PM Vivek Goyal wrote: > > > > On Sun, Sep 11, 2022 at 01:14:49PM +0300, Amir Goldstein wrote: > > > On Wed, Sep 23, 2020 at 10:44 AM Miklos Szeredi wrote: > > > > > > > > One proposal was to add LOOKUP_HANDLE operation that is similar to > > > > LOOKUP except it takes a {variable length handle, name} as input and > > > > returns a variable length handle *and* a u64 node_id that can be used > > > > normally for all other operations. > > > > > > > > The advantage of such a scheme for virtio-fs (and possibly other fuse > > > > based fs) would be that userspace need not keep a refcounted object > > > > around until the kernel sends a FORGET, but can prune its node ID > > > > based cache at any time. If that happens and a request from the > > > > client (kernel) comes in with a stale node ID, the server will return > > > > -ESTALE and the client can ask for a new node ID with a special > > > > lookup_handle(fh, NULL). > > > > > > > > Disadvantages being: > > > > > > > > - cost of generating a file handle on all lookups > > > > - cost of storing file handle in kernel icache > > > > > > > > I don't think either of those are problematic in the virtiofs case. > > > > The cost of having to keep fds open while the client has them in its > > > > cache is much higher. > > > > > > > > > > I was thinking of taking a stab at LOOKUP_HANDLE for a generic > > > implementation of persistent file handles for FUSE. > > > > Hi Amir, > > > > I was going throug the proposal above for LOOKUP_HANDLE and I was > > wondering how nodeid reuse is handled. > > LOOKUP_HANDLE extends the 64bit node id to be variable size id. Ok. So this variable size id is basically file handle returned by host? So this looks little different from what Miklos had suggested. IIUC, he wanted LOOKUP_HANDLE to return both file handle as well as *node id*. ********************************* One proposal was to add LOOKUP_HANDLE operation that is similar to LOOKUP except it takes a {variable length handle, name} as input and returns a variable length handle *and* a u64 node_id that can be used normally for all other operations. *************************************** > A server that declares support for LOOKUP_HANDLE must never > reuse a handle. > > That's the basic idea. Just as a filesystem that declares to support > exportfs must never reuse a file handle. > > > IOW, if server decides to drop > > nodeid from its cache and reuse it for some other file, how will we > > differentiate between two. Some sort of generation id encoded in > > nodeid? > > > > That's usually the way that file handles are implemented in > local fs. The inode number is the internal lookup index and the > generation part is advanced on reuse. > > But for passthrough fs like virtiofsd, the LOOKUP_HANDLE will > just use the native fs file handles, so virtiofsd can evict the inodes > entry from its cache completely, not only close the open fds. Ok, got it. Will be interesting to see how kernel fuse changes look to accomodate this variable sized nodeid. > > That is what my libfuse_passthough POC does. Where have you hosted corresponding kernel changes? Thanks Vivek