From patchwork Sun Jan 19 22:09:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Marineau X-Patchwork-Id: 312410 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 63D362C00AB for ; Mon, 20 Jan 2014 09:09:44 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752185AbaASWJn (ORCPT ); Sun, 19 Jan 2014 17:09:43 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:65415 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752105AbaASWJm (ORCPT ); Sun, 19 Jan 2014 17:09:42 -0500 Received: by mail-pd0-f177.google.com with SMTP id x10so4718206pdj.8 for ; Sun, 19 Jan 2014 14:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coreos.com; s=google; h=from:to:cc:subject:date:message-id; bh=E+4lcut4bHMIt9AGGM03qksjnwm8Gjqm/RBNnuvT+MI=; b=a+72o4wkKrVHjLSlaJw6Tldpw7Eay5VvgWXeqc8tveh5nFKmFNBv9epgLzeGb6u96f DXOC1KZU2K4vXwTd6LcgFzdByXwU8jTh3+FOM5/1w6E/ClRjY9vGFqkLef+Fo7XF/Zhv t+AxVhKDSlxik/3hDdlMU08l1H5Dbs1eC4jyU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=E+4lcut4bHMIt9AGGM03qksjnwm8Gjqm/RBNnuvT+MI=; b=LHebJAvNb9nzL5mPw1negw3Rzuw7mhdrNuyZPm93Oi+vhiAWcERA1TF4E3Xs0k1r3z RWjyP2kkCtPyOQcZXHjO16+FxELLo62JRDuivm1zm6/dYAGZbJ7+A2K09s07TDeZCFib t0oTyU+dWqUZ+wMZqHdogwmkD2072yNCnn6+eJZNZYFcTe0MuodNZ49D1hFidkjuZZDn GhGTw10muWxJZsjgreqX5RN3PSE+ueaRgwmuA3dCbYLLFYvLcN7x68XfcyODywAPNgWd 0CiKDRe3DFoTQoQlskLxgCJ93e6WGhShQzNzsIX3q0ytXCoTYns9d6s8CjMcXs+/CZoB v2UQ== X-Gm-Message-State: ALoCoQn3K2HRHxwS8Eh3HZveOKN6NGppfurBlfJFpeuQkwKGhq8rXYOasiIfTkdqZxVLjKbmcQY5 X-Received: by 10.66.186.174 with SMTP id fl14mr15052428pac.108.1390169382351; Sun, 19 Jan 2014 14:09:42 -0800 (PST) Received: from crispin.eieie.io (50-0-204-17.dsl.static.sonic.net. [50.0.204.17]) by mx.google.com with ESMTPSA id nw11sm55812756pab.13.2014.01.19.14.09.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jan 2014 14:09:41 -0800 (PST) From: Michael Marineau To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, Michael Marineau Subject: [PATCH] e2fsck: skip fixing UUID on a mounted filesystem with csums Date: Sun, 19 Jan 2014 14:09:34 -0800 Message-Id: <1390169374-1775-1-git-send-email-michael.marineau@coreos.com> X-Mailer: git-send-email 1.8.5.3 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This fix is similar to 66457fcb for tune2fs. When booting from a root filesystem with an empty UUID which fsck fixes the following remount step reliably fails, leaving the filesystem in an inconsistent state. Like the tune2fs fix this patch resolves the issue by simply refusing to update the UUID if the filesystem is mounted. Signed-off-by: Michael Marineau --- This patch is against master but is equally applicable to maint, it applies to maint with 1 line of fuzz (ext2fs_init_csum_seed). I've tested it on top of v1.42.9. It may also be possible to fix this issue with a patch to ext4_remount in the kernel but I have not investigated that. e2fsck/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/e2fsck/super.c b/e2fsck/super.c index 59c1f97..3c92df2 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -734,8 +734,11 @@ void check_super_block(e2fsck_t ctx) #ifndef EXT2_SKIP_UUID /* * If the UUID field isn't assigned, assign it. + * Skip if checksums are enabled and the filesystem is mounted, + * if the id changes under the kernel remounting rw may fail. */ - if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid)) { + if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid) && + (!csum_flag || !(ctx->mount_flags & EXT2_MF_MOUNTED))) { if (fix_problem(ctx, PR_0_ADD_UUID, &pctx)) { uuid_generate(sb->s_uuid); ext2fs_init_csum_seed(fs);