Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7620672rwd; Tue, 6 Jun 2023 13:40:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7co7zMPDni9difc9Q/SORCTsPtrB7AM8Q7QMO1jTrMIZHz3HVrGNNYsYjuymjuaH3gQ0KZ X-Received: by 2002:a05:6a21:340a:b0:100:5851:d4ba with SMTP id yn10-20020a056a21340a00b001005851d4bamr456927pzb.54.1686084029079; Tue, 06 Jun 2023 13:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686084029; cv=none; d=google.com; s=arc-20160816; b=uPwq4AInWVS7lmdiw2wdFYflC585Ttk3/NiIVGGn/Frv4HxEEhNZ6bruRo7Ky6JZ5d qoPirvEJa+DjYoQp5/fM27DZgHKvRHpneUHeu7wdMOooU9bazED1AoJxsIMl6lJSB8Pt +LUzneTVoiMSlI8vr67m6yugXjP6OIwS0AeaPimBKqQte3goNKhfEjiUm3A4fpdy9em2 bEEi7gAUp9ptCYbZdBwo0y08QlhoGmtmWBFRxZEtuOLd8n9dCOR0IBl/PiCyEnt47NZN whHwfxl5+WBsu2kp8hEWstIqvVlsAlShocj9OLW6hpRAmfIgZVzqgkv4NwBhSQ5M87PA +vjw== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:feedback-id:dkim-signature:dkim-signature; bh=/7YL0I/wdpR1Dyl/whVOKKeGk3Kq8M8MxbUJFQZ6VKA=; b=wKtpvl2ARJ6G3SNohs0PNTahrR925ne++VgwW1UDoPVl3lY+wRPMblo5WJ4y4rq+sA F+Ga8TKC6+oA0mGTYmhsjZUvnG1OXsddmxFUVkWbCkTzJ5ODmGMbakRS/5B0p2kkV0uO BJqiIanm25MCrYT3DjzSxJcga8eSNTpP6xyQtZ90Q8HD1BK0I40gIF7XvCAem7xUXiln OJ8uSv2aFi2XWXGOvU7kjYjttBgksiwQ8YGkDp1G+6nqDISiRy/JkVIUH7EnczZRTVeA ESZotJ9pvKgFBKaKjJYKaegLTLJ+WHaNhPddFL1qlzLhdEIVavm4oBxJqgAns8gJs1uZ NxDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fastmail.fm header.s=fm1 header.b=3RTJflr+; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=UrHmkgFO; 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=fastmail.fm Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a170902bd9600b001ac36e5ec0esi7513170pls.299.2023.06.06.13.40.14; Tue, 06 Jun 2023 13:40:29 -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=@fastmail.fm header.s=fm1 header.b=3RTJflr+; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=UrHmkgFO; 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=fastmail.fm Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239711AbjFFUSc (ORCPT + 99 others); Tue, 6 Jun 2023 16:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239706AbjFFUSb (ORCPT ); Tue, 6 Jun 2023 16:18:31 -0400 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFC241A7; Tue, 6 Jun 2023 13:18:29 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5C91B5C0189; Tue, 6 Jun 2023 16:18:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 06 Jun 2023 16:18:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1686082707; x=1686169107; bh=/7YL0I/wdpR1Dyl/whVOKKeGk3Kq8M8MxbU JFQZ6VKA=; b=3RTJflr+Jr/ONLWddDwxwFKO98Mg53p2jZEW/c+lCMYnOA1YjDJ o2CWUmyc5gs3vBQLTNQnl7hKEFX6gmtHof7EoxFxeXVw91ua6hQnyNeQHEpiaUus YuyaAp/tYVq8PuXLhsBJGliRqEDOt9gm+A2Ssqgw/Ek1tF3YMgy43f/cOD+uRsG6 0/oQpbjK1EyjHiXJGzEKLMe8SCk0sp8yUzfFqX/0i4hwEZNn7hMmwa22Z2HreLto o26zhtaj1/15Gs2CA+cJZXfJ+a/NKfJVFXShjmLE/QEAcF/NyVWP8K92zgVL324Z +tb+j9G0ShWOKvp3WAfkEaKOUxiPnRRir9Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1686082707; x=1686169107; bh=/7YL0I/wdpR1Dyl/whVOKKeGk3Kq8M8MxbU JFQZ6VKA=; b=UrHmkgFO7902chnScDG+wfosItXrw46HGp5V/ecfTHQv/eGutyG b7uW1QhMFanTqncPAlQu/Nq0tfv9lnSJmhHzv9pml9XDgk+1/XTyCw493fxOYKdV TPZs/qdoDmws82lAiv5P+XvtKIChCtA2/4kY/4Xja+MurwF/ehz+7YBo7FnGIm33 oH5d833ukWKCrP/lPd/LEd4ojlLFpoQVde5NB66O0F4zmdYuYn/j5DnRbvQKB1XU Wu1DStCfwzNEXCZaFks6oD2AZrNk8GFGVz4bit8pUJEt1YwtgKLOVtqYBwhfdKv0 G+8WYqRyc413wBCF640XHfB5lrtp/nYx1+g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtuddgudehtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepuegv rhhnugcuufgthhhusggvrhhtuceosggvrhhnugdrshgthhhusggvrhhtsehfrghsthhmrg hilhdrfhhmqeenucggtffrrghtthgvrhhnpedtueejffeuhedtfeejtdefleetvdfhhfet heffvedulefhgeeitdduvdetkefghfenucffohhmrghinhepkhgvrhhnvghlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsggvrhhn ugdrshgthhhusggvrhhtsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Feedback-ID: id8a24192:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Jun 2023 16:18:26 -0400 (EDT) Message-ID: <5d69a11e-c64e-25dd-a982-fd4c935f2bf3@fastmail.fm> Date: Tue, 6 Jun 2023 22:18:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH 0/6] vfs: provide automatic kernel freeze / resume To: Miklos Szeredi , Askar Safin Cc: Luis Chamberlain , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, fuse-devel References: Content-Language: en-US, de-DE From: Bernd Schubert In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 6/6/23 16:37, Miklos Szeredi wrote: > On Sun, 14 May 2023 at 00:04, Askar Safin wrote: >> >> Will this patch fix a long-standing fuse vs suspend bug? ( >> https://bugzilla.kernel.org/show_bug.cgi?id=34932 ) > > No. > > The solution to the fuse issue is to freeze processes that initiate > fuse requests *before* freezing processes that serve fuse requests. > > The problem is finding out which is which. This can be complicated by > the fact that a process could be both serving requests *and* > initiating them (even without knowing). > > The best idea so far is to let fuse servers set a process flag > (PF_FREEZE_LATE) that is inherited across fork/clone. For example the > sshfs server would do the following before starting request processing > or starting ssh: > > echo 1 > /proc/self/freeze_late > > This would make the sshfs and ssh processes be frozen after processes > that call into the sshfs mount. Hmm, why would this need to be done manually on the server (daemon) side? It could be automated on the fuse kernel side, for example in process_init_reply() using current task context? A slightly better version would give scores, the later the daemon/server is created the higher its freezing score - would help a bit with stacked fuse file systems, although not perfectly. For that struct task would need to be extended, though. > > After normal (non-server) processes are frozen, server processes > should not be getting new requests and can be frozen. > > Issues remaining: > > - if requests are stuck (e.g. network is down) then the requester > process can't be frozen and suspend will still fail. > > - if server process is generating filesystem activity (new fuse > requests) spontaneously, then there's nothing to differentiate between > server processes and we are back to the original problem > > Solution to both these are probably non-kernel: impacted servers need > to receive notification from systemd when suspend is starting and act > accordingly. > > Attaching work-in-progress patch. This needs to be improved to freeze > server processes in a separate phase from kernel threads, but it > should be able to demonstrate the idea. Thanks, Bernd