Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6232890rwb; Wed, 18 Jan 2023 02:51:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1pl/2yARufLIyPTbNahBxLhJFKJw7/mbzXocOfeRECO/QQegskRYecaxJoWWPt0eCZ9TS X-Received: by 2002:a17:906:d19a:b0:86f:3d33:4750 with SMTP id c26-20020a170906d19a00b0086f3d334750mr7889436ejz.1.1674039099439; Wed, 18 Jan 2023 02:51:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039099; cv=none; d=google.com; s=arc-20160816; b=FL9mCFj4rLYFYiPgyUN+j90u5tLTnX5E0Xb6omNlIfCwgdcohe5CHIZhw3vQpd9ETQ nkdvfKhDANF1/+jQ0sHbGIOwi5DfhqGWbEj2fkHUCeD0/kaxVJWXY4rwUSLnbNkgajFd kXYMb/AGM9d5FOSJUNpEOZealmqt1F8uxjFMnW9aWZepe05BiKQOwpvRgQjJrRtHk3x8 3NhO+tdlzZmKiMtvkQSk7zPU3/WuBpd5hZ9fhnCzq4FjGkZbiEjsWm/U67UUiKxaFpZZ W0g3SXkbeEGrC09tTRv+p0DTJS17FmrkR4IzzHkm0eYKbSOplXjffBq/S09JXC+DlAjY IHrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=EUsADbHHhbF3+iRirD38aung5TJEhF+NitEiQGxyElk=; b=0i0tudfKgUns04vu1Kjbue3r66Xk3TURaUqnynKf52F8gJxybIsM/6Qzz4XjgPkLto cAy3/+1VodoYM0bFQiEMGubPWJRvyWlYpnpJOWed0rnYr10tuYPW5v6r1HhLv8OxxSaN kIZAUpz+M9BD/1CewsQa8ErFI1amKMhExWjGtOHMgxx75/Ux66j94a4qsqgBGCvI8Vvm OYBeX7M+iENhsy80VsdMx/m59PzCe1y3JxxrU5B/VanpavGbDI/cSeImxx/LJF5nofzb +EY42BxmNXl+3e96XNYapOS5g+lL58leCG09DjvkxBawsoZg072D/w4ddgIvXiY5KtTj 3JXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=WtBb5x68; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fd22-20020a1709072a1600b00871160a1e90si6391654ejc.999.2023.01.18.02.51.28; Wed, 18 Jan 2023 02:51:39 -0800 (PST) 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=@suse.cz header.s=susede2_rsa header.b=WtBb5x68; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbjARKYH (ORCPT + 45 others); Wed, 18 Jan 2023 05:24:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbjARKWz (ORCPT ); Wed, 18 Jan 2023 05:22:55 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43B7DA793D; Wed, 18 Jan 2023 01:28:16 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D114C3EC2F; Wed, 18 Jan 2023 09:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1674034094; h=from:from:reply-to: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=EUsADbHHhbF3+iRirD38aung5TJEhF+NitEiQGxyElk=; b=WtBb5x68i+kgdj5rIe9oOMm3j2eFxHYFTKUce3+sSYZ+e05OKTheZ0sYDkj5WVP4Hwe/8K QAcieeizwYHpiP2a0INYRKv2PhqYrFheMTCsNFEDwdUSBYcWvQuJL/U03Xi9USxGvFRZwH 3KKgeJxjavOZ7ZwU7w4JczgqVqElM5I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1674034094; h=from:from:reply-to: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=EUsADbHHhbF3+iRirD38aung5TJEhF+NitEiQGxyElk=; b=Fs8/sMuj8JJZsofEJTyRfdehftt6tZAP6OMz7klPmw9kb9C2wkDTvnpWKM+dUWaIC03mf8 PpZ+6ivzv8lhBhBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 70469139D2; Wed, 18 Jan 2023 09:28:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id jj1kG667x2MMOAAAMHmgww (envelope-from ); Wed, 18 Jan 2023 09:28:14 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 3F58DA06B2; Wed, 18 Jan 2023 10:28:12 +0100 (CET) Date: Wed, 18 Jan 2023 10:28:12 +0100 From: Jan Kara To: "Darrick J. Wong" Cc: Luis Chamberlain , hch@infradead.org, song@kernel.org, rafael@kernel.org, gregkh@linuxfoundation.org, viro@zeniv.linux.org.uk, jack@suse.cz, bvanassche@acm.org, ebiederm@xmission.com, mchehab@kernel.org, keescook@chromium.org, p.raghav@samsung.com, linux-fsdevel@vger.kernel.org, kernel@tuxforce.de, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, xfs Subject: Re: [RFC v3 03/24] fs: distinguish between user initiated freeze and kernel initiated freeze Message-ID: <20230118092812.2gl3cde6mocbngli@quack3> References: <20230114003409.1168311-1-mcgrof@kernel.org> <20230114003409.1168311-4-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL 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 Tue 17-01-23 18:25:40, Darrick J. Wong wrote: > [add linux-xfs to cc on this one] > > On Fri, Jan 13, 2023 at 04:33:48PM -0800, Luis Chamberlain wrote: > > Userspace can initiate a freeze call using ioctls. If the kernel decides > > to freeze a filesystem later it must be able to distinguish if userspace > > had initiated the freeze, so that it does not unfreeze it later > > automatically on resume. > > Hm. Zooming out a bit here, I want to think about how kernel freezes > should behave... > > > Likewise if the kernel is initiating a freeze on its own it should *not* > > fail to freeze a filesystem if a user had already frozen it on our behalf. > > ...because kernel freezes can absorb an existing userspace freeze. Does > that mean that userspace should be prevented from undoing a kernel > freeze? Even in that absorption case? > > Also, should we permit multiple kernel freezes of the same fs at the > same time? And if we do allow that, would they nest like freeze used to > do? > > (My suggestions here are 'yes', 'yes', and '**** no'.) Yeah, makes sense to me. So I think the mental model to make things safe is that there are two flags - frozen_by_user, frozen_by_kernel - and the superblock is kept frozen as long as either of these is set. Honza -- Jan Kara SUSE Labs, CR