Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp856268rwd; Thu, 15 Jun 2023 03:05:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6N8DDzQzB8DUkJI/4/+Ggy80A55hUTgTCmWvu4nyIzJCMhQsSrfoE6mTfLjLO3ORVDtGbr X-Received: by 2002:aa7:c2d6:0:b0:518:7a8b:5d4 with SMTP id m22-20020aa7c2d6000000b005187a8b05d4mr4353686edp.16.1686823544713; Thu, 15 Jun 2023 03:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686823544; cv=none; d=google.com; s=arc-20160816; b=Fj8HtiA3iRjoTHRBKrP0yNvOeTLM0K+8Md9A9BaqZOCCkN9k7UEmkQXjgLnDwvIxFa 0/dBM04dCV4qC8L/8P53OFBUlHdtPwf0vuUlKd3Ta3YknJkdYWnOmcFJctZVfUodIi2+ sBudBbojPrxZNQIEA6xX09O7DXoQ3a8Rwh1GR2ZjTUW1NbsMNGojtiV5X4Zr4wmxR7ej VcPuG4+NGonSdE2hjX1ohT0rzKJx/wkDGX6ZBoLHDIgCwrBFFKQdyJsJHYW7VsmExc1b 5AqMYsimr3wWn5fxdDR7xLpMUjv1fnkUdWtOAvTSACSnslJgfp7bIPqGGEs+HvfX+5EC NRTA== 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=zwc5Q6r8DSVlGqrN9RxoOtoujMWUGpkzJ9oA//lqUxk=; b=kzySGvUobZacOVR6W/1YZQ7IVpOksXFdGWU56GpH7LJQtb3GVCNgaDJwglt9eLVJJ1 mFV52F4mjauw+CjuFDAWYavnCZFOGv8x3iyaQZnxkQghXg9iLuOPTV6Dm24VWA7HS/kH wZ7BjIZXYmBAE67DNSaKu1TJ0+6mrBKD+DT+dFxy5hxf8tMtDmhbR3k5yFGcRLtzd42z qKi7RzXSsV/80eTvU1zNtUFyhD9RXbrVi2bDupKvX7DDdH6mfd/nY7qaLv64chKkt1PU U3Rf/Ukjb3mwYIJQEbyjgY3GXp58yY9ZeJ3Mk9121ri74EDcoYn8UC3YclXe7SuXRMbi PNsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AoQWYpRe; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-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 a6-20020aa7d746000000b005187bd113bcsi2396395eds.354.2023.06.15.03.05.02; Thu, 15 Jun 2023 03:05:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=AoQWYpRe; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241750AbjFOKBm (ORCPT + 99 others); Thu, 15 Jun 2023 06:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245550AbjFOKBa (ORCPT ); Thu, 15 Jun 2023 06:01:30 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFB94296F for ; Thu, 15 Jun 2023 03:01:27 -0700 (PDT) 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 AF159223EB; Thu, 15 Jun 2023 10:01:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1686823286; 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=zwc5Q6r8DSVlGqrN9RxoOtoujMWUGpkzJ9oA//lqUxk=; b=AoQWYpReUwVE51XJ86pLMV63wwgtBeCml6vcnuyWzV8KnucG7CzNsR/nqzNsAmZoZw5KFK CxwTQBAJlqCih1oO03IQU0toSGQYIbI/7R0zxqBqlx5zXrypZjPJL8XsCVY8Bd9UNwlN2u nGBDJIJ5ULOZXUgwUb3va01gUsly/UA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1686823286; 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=zwc5Q6r8DSVlGqrN9RxoOtoujMWUGpkzJ9oA//lqUxk=; b=/vjdkdPD+X5QQYnKp/Nj2MLs9OwAXRXPbAHkSnzcj21uSVMxZ3r52BCrFK3scgjcwZFUdD UjXjbrqTBOUYwsAA== 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 A2EAC13A47; Thu, 15 Jun 2023 10:01:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gtvCJ3bhimScYwAAMHmgww (envelope-from ); Thu, 15 Jun 2023 10:01:26 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 332C9A0755; Thu, 15 Jun 2023 12:01:26 +0200 (CEST) Date: Thu, 15 Jun 2023 12:01:26 +0200 From: Jan Kara To: Theodore Ts'o Cc: Ext4 Developers List , bagasdotme@gmail.com, nikolas.kraetzschmar@sap.com, jack@suse.cz Subject: Re: [PATCH 1/2] Revert "ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled" Message-ID: <20230615100126.othz2jtof4av4pur@quack3> References: <20230608044056.GA1418535@mit.edu> <20230608141805.1434230-1-tytso@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230608141805.1434230-1-tytso@mit.edu> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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-ext4@vger.kernel.org On Thu 08-06-23 10:18:04, Theodore Ts'o wrote: > This reverts commit a44be64bbecb15a452496f60db6eacfee2b59c79. > > Link: https://lore.kernel.org/r/653b3359-2005-21b1-039d-c55ca4cffdcc@gmail.com > Signed-off-by: Theodore Ts'o So I was looking more into how the warning in xattr code can trigger. Sadly the syzbot reproducer does not seem to reproduce the issue for me when I enable the warnings in xattr code. Anyway, after staring for some time into the code I think the problem has actually been introduced by the transition to the new mount API. Because in the old API, userspace could not start writes to the filesystem until we called set_mount_attributes() in do_remount() which cleared the MNT_READONLY flag on the mount (which happens after reconfigure_super(). In the new API, fsconfig(2) syscall allows you to toggle SB_RDONLY flag without touching the mount flags and so we can have userspace writing the filesystem as soon as we clear SB_RDONLY flag. I have checked and the other direction (i.e., remount read-only) is properly serialized in the VFS by setting sb->s_readonly_remount (and making sure we either return EBUSY or all writers are going to see s_readonly_remount set) before calling into filesystem's reconfigure code. I have actually a fixup within ext4 ready but I think it may be better to fix this within VFS and provide similar serialization like for the rw-ro transition there... Let's see what VFS people say to this. Honza -- Jan Kara SUSE Labs, CR