Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2502712lqb; Tue, 28 May 2024 01:38:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCURy5GN97e55kNedHpbrnOluzhgcGLXrFSeiBe2az++YoVSNhKqi9iIIpAcZSatD1KC9ZgVkFFSbUBKYps1XLGQBC0XhP2zmzoi+JHuSQ== X-Google-Smtp-Source: AGHT+IEcrguxP/Alm8kLCp4wW/uu4j4YOCKD6+Vt6++vwL+MJj1if37r7F7eUBGEA9eK+Xpowxky X-Received: by 2002:a05:620a:1b82:b0:792:c25e:2d49 with SMTP id af79cd13be357-794ab05790fmr1332352885a.4.1716885525700; Tue, 28 May 2024 01:38:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716885525; cv=pass; d=google.com; s=arc-20160816; b=DyO/LUXL1GJGghtEPD2VEC8NcegSHll2Vkht2PX/XYu1gfycyos0SnupCq8otVPr9D s58fQViAVTpqKFqkHE254JfBUghA0s7P4Fc/hVG3OZ+LafqRR8mJHbAeEE0zisz9iixO JkrCgXb2Ng6+EzmpY8TnijDZbSYgmwsOpKIz2HlojBGFhA/fgmoQuuPdZqyoq9dSSc5N V5j9aVv8c7eY26e2QLKpWSJ9ykRqslU6H4EaOtrbwY7PRkhRN+UaSM1nTQ2rwC+v3my0 uW1ZxJPKM4v2RAYlNA8clbwF2npVM332b6eMh2FmizWygXiVc2m2d+FjxIw9p5MNLSrx 54jQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=taAHhIMY3xJ3MUJYsq9dWz7PmGgg/+qhPotRBU7Kd08=; fh=JGxswaDgA2b/6uh/enKh4+K8naAUdbLqsuKYCYBvuzA=; b=rjKfgt438llzlfGRoGvCDGvxLeqwoOFViuUlGTgUzRvH9YB564GZVyMu4gPxEfUBI2 tuZ5pGplBsm1p5u+bTaRcqnqKfVYdnqdsSQv39omszFADN+UIZSBrz4gfvGATMOJLgWy YYqfa+oTFaKJCsBMbvzopWDYZfmLwx8z1dOZff+WHMe+KHhpF+1F8b3v+9Tnl1yuLeP8 qh2LYzi7VRsYmIYN63BvYB73d83k3PEu+zWy7lJDDf5T3pUaznmPuboWAsV0mPri3uC0 Wln5tbKHdYKgB2wEPQfiq8FOmM3OFZwH8KzrvvncdP8dwabDXh6NLdI+5bN/qyRh3/2X 88LQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J9UlsoCF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191943-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abd4e7c6si949401285a.587.2024.05.28.01.38.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 01:38:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J9UlsoCF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191943-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6C75A1C21E58 for ; Tue, 28 May 2024 08:38:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E6CF13C83E; Tue, 28 May 2024 08:38:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J9UlsoCF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7499B6EB64; Tue, 28 May 2024 08:38:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716885516; cv=none; b=fK1678+SB27ckdZY6lLcaZQLALnn/iU5budP8Qpe02HPcUQBuhGIA7biAXClTjJq/8KQ7/VZ8B74WvqUAIzoG2KFddg5HQzyq9jQZk0KUTcrIDNB/nYd7nQaSJprs528QOOE/urBbhdqbwHguOGXuH9F5ziz9v7duq+NpeL7Yz4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716885516; c=relaxed/simple; bh=Pp1h9rKnlXC+BzTr3QzZgGdZk7UnGky0ZpYWvwodtdA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sFgFncxxHy5gdSBPzLu5ZhXc5vdk5jYITCfYt0MXbGK/i9cPa8CNWax4UhqejMwNDSAiyhxK9SXzaqAKEAXZZ2xNnN9TvT24e/svGP4yD8AU6uJ2xcF+7HHmzm/xq+nGNSgJQwimGmNyUb9B4lObU4B4ZwyiYbE0hizqXkYYMvo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J9UlsoCF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88E79C32781; Tue, 28 May 2024 08:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716885515; bh=Pp1h9rKnlXC+BzTr3QzZgGdZk7UnGky0ZpYWvwodtdA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=J9UlsoCFveDXOijNN7ysl3SGOeVuvAmdhwmZ590h1U4JzkLrD1hXQK9F7g0i/9K/h zWldbRoimxOPTKDupJ8fI71QoLUJKTmpk+hI3ooGNs1eknT2xgmwh9LRatComsjVe3 48K5vKpBGZKn84GvBjKs4QHZ/JXy0JesDITJecj51ZGlgeCrxbpvD4fqBA0UZrXR9Q wYCvNYhm6UOD7a99xeGfWTD+3qiBfepeCmZkagNlHYSUJ/D3dJbN1tKn3GJH8oU5U1 543HYmApBJGRZK+XvOyjQoEY2UulgaCOE/p7OBpoNcw7ANc8XECxoMNANXE7N9osYz RhyM5wlJVXBpA== Date: Tue, 28 May 2024 10:38:31 +0200 From: Christian Brauner To: Jingbo Xu Cc: miklos@szeredi.hu, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, winters.zc@antgroup.com Subject: Re: [RFC 0/2] fuse: introduce fuse server recovery mechanism Message-ID: <20240528-jucken-inkonsequent-60b0a15d7ede@brauner> References: <20240524064030.4944-1-jefflexu@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240524064030.4944-1-jefflexu@linux.alibaba.com> On Fri, May 24, 2024 at 02:40:28PM +0800, Jingbo Xu wrote: > Background > ========== > The fd of '/dev/fuse' serves as a message transmission channel between > FUSE filesystem (kernel space) and fuse server (user space). Once the > fd gets closed (intentionally or unintentionally), the FUSE filesystem > gets aborted, and any attempt of filesystem access gets -ECONNABORTED > error until the FUSE filesystem finally umounted. > > It is one of the requisites in production environment to provide > uninterruptible filesystem service. The most straightforward way, and > maybe the most widely used way, is that make another dedicated user > daemon (similar to systemd fdstore) keep the device fd open. When the > fuse daemon recovers from a crash, it can retrieve the device fd from the > fdstore daemon through socket takeover (Unix domain socket) method [1] > or pidfd_getfd() syscall [2]. In this way, as long as the fdstore > daemon doesn't exit, the FUSE filesystem won't get aborted once the fuse > daemon crashes, though the filesystem service may hang there for a while > when the fuse daemon gets restarted and has not been completely > recovered yet. > > This picture indeed works and has been deployed in our internal > production environment until the following issues are encountered: > > 1. The fdstore daemon may be killed by mistake, in which case the FUSE > filesystem gets aborted and irrecoverable. That's only a problem if you use the fdstore of the per-user instance. The main fdstore is part of PID 1 and you can't kill that. So really, systemd needs to hand the fds from the per-user instance to the main fdstore. > 2. In scenarios of containerized deployment, the fuse daemon is deployed > in a container POD, and a dedicated fdstore daemon needs to be deployed > for each fuse daemon. The fdstore daemon could consume a amount of > resources (e.g. memory footprint), which is not conducive to the dense > container deployment. > > 3. Each fuse daemon implementation needs to implement its own fdstore > daemon. If we implement the fuse recovery mechanism on the kernel side, > all fuse daemon implementations could reuse this mechanism. You can just the global fdstore. That is a design limitation not an inherent limitation.