Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp766734lqb; Wed, 29 May 2024 09:52:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWd0hM+Ir94emqc8RrLaVz2JM/Y77HN7l15GQXHRRZKCtUnGYFsOf1w6McdLAUVGfCylrUQ10p79NSlUFjnEyua7lL6jaaXxlXTrAOhhw== X-Google-Smtp-Source: AGHT+IHB3PF42m75Dv9iONCw1RlaIWlPfVA/ziMEZGpLTyxzSkNeS7+petdqRjI127NSkZk5Fe5B X-Received: by 2002:a05:6512:76:b0:521:9963:3896 with SMTP id 2adb3069b0e04-52964cab3a3mr10066829e87.41.1717001558624; Wed, 29 May 2024 09:52:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717001558; cv=pass; d=google.com; s=arc-20160816; b=kXwFzjRG61F5CrId+mvEGsmJcal4gyJq7HcyYC/2MbW50xpqWwRJRiWU6uXu6h3wFv Poy0sZg4qPIKSDiJbFsb78npR87kabvNIHpDNwptRuzcHDiA9M2aO6BGOpaNuCD5wps+ f7LICBzN507YRuRBfzMuk5J05qaifm8vQ/jcpZczzpllHbIlS1FBXs/6wXn2K4JgpFuz R9xu7xxNhABUf0qUtrJAAowvOW7GZTb+dHj71qkZqeXfLxqMBXl4zG8I01SDC6NTJW/h nz4nq19f2pFR83wJsFmHCgMmM4ZBK2hqI1vjIQPkeE5KmJMpMtGmqFJaXhSDeYldrhPQ f9ZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=7MEs2nLK5nYgOc+8YCIgrapGI28e79137f7LPZefBNU=; fh=4NTRq0sjZfm84OHOl/9Ibvg/+10i+Go0U38sR1tQaMI=; b=kfKImPoSC6nPIkRkO/hmMsXtOWwkyI8sbeKlGRUBTOhdDBaWgZTJ/kxNf+1iisGfYL u4q1sdtasAJEK8P+yFjzb4upcXV6HfEwQb2PnSFvpWMupNb5a4rnzmAQfbWVlyFbqXpZ CllFZjAWWsNQ0VyFQTqdVWR2cAZ0RaAs2PDwzdKL969W/ff/Bb3iT2t8lJJq7NvMW29Z aClzMiFdokjNXumAcVPZY5S+ouP6sM1ZpLFotRt9ZlgtOCQrnBQNscm8TF5XtEPjXXrJ OC7AzO0umn4KQQXD2RyQuKKSQEgo11cExHrAvlV0JqwlmDkT1kSkXVYZNsKsQMIperQP JvVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dyxSnmTn; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-ext4+bounces-2715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2715-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6355f7dd2fsi163537666b.703.2024.05.29.09.52.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 09:52:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dyxSnmTn; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-ext4+bounces-2715-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2715-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5481E1F24741 for ; Wed, 29 May 2024 16:52:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00E6C187320; Wed, 29 May 2024 16:52:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dyxSnmTn" X-Original-To: linux-ext4@vger.kernel.org Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B0FE156978; Wed, 29 May 2024 16:52:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717001549; cv=none; b=G01blq4gndxVOaC5gr2jgDU8RGll009gkdBBPs8R6BuLJtNbX4HjYRMYYHjhYsarB2ou85G2fwv3wyq1BQU8kaXTjmlYW0I4r/Q3g2ZgWyNFuao+7ArmeJ/B6uKaf0gDMtMX5Ob+zxzcLUuz5Qn8pgSQNVcVYmFitsyTufz88dk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717001549; c=relaxed/simple; bh=lhmTSP5KkBtml0allUWgmBZsBqqH1RON7RLAlmIh4ic=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=R1pE1vCgv3uZbsaKkSU+le3Uq5dm+UFVj4iUlb+lzRdMelmUW099pR59LXkD8RxKFrA14tFhqaK8azjPpS+1nuRzwsNBbBoAIEIlT8TH4pMZfPTyUTzer3cKxEC34Mn+dHl6/ggEtTh9UGZVTccjw5WdzQr2e2k6zf23yQ/IrLU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dyxSnmTn; arc=none smtp.client-ip=209.85.128.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-62a0809c805so24574727b3.0; Wed, 29 May 2024 09:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717001547; x=1717606347; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7MEs2nLK5nYgOc+8YCIgrapGI28e79137f7LPZefBNU=; b=dyxSnmTnWOY4rIHtkKt3TP5ySmhbynXsEr0NyK61bSsvq6h85bpWLKfNNsf7VgY+vR a6LOm/xoTj+pLTXGozeiHAvVBsDZjI+SL5589y0e9Dd1GqjKoFExDR5YGTPCww7dWI5S fI39KqLsHDpn6cZAMhrI4+jKxx+S1G8xr3BDL2HfEMqOqzDaAm8LbgLnxC+xy5sv6P8Z 5QuexAij+dAO+p5gRAOtHa7tYQ6skaS0as19AONNJmPWu+k2voAt9fjHogcZw3aMBJy0 GHZdtai7DimQSwqtbfjQDyZZzWAO2alpGUiiaY2QUG3kjdnMj79YhQcJEmoLARunW3UL oIqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717001547; x=1717606347; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7MEs2nLK5nYgOc+8YCIgrapGI28e79137f7LPZefBNU=; b=W8sthqj7VBTpfNISFCuxQA+K3u9pygdClmKrRJP7P1OzGgzk8DXDcmw01hINjDAfEn Kb3QYfYafbT4M0pWKVP+mJVUwxmnGYfwVxv+6jEK4ao0k3ViOizofz8ECECtcC+RA4xF aA4jk+SAjMRx4kDwfhwRbcfgc2pp27T60x9cjzg80vVpa2DrfLe3RmmYzeYkC/cSz7Sd LkD4+QrUfRHzRIEh88wrcB9UUB+BwSpl6KaExy+YQBNA+a+A3BTQIyGXMwLPRH1XG6oz An19/qDpm+AoYV/MIHoyBzv4hySGMGTBWtHgqv4FQj4nQylClvvkljsKVZ3kqHK5cVDH jJAQ== X-Forwarded-Encrypted: i=1; AJvYcCXEyXurPdmvv7REDbiyoa6mcqDX9xt7eyllLZbBh4P7lmNQajn8k7jMd7VNwhcx6pFycZ9OVSdDFYhTrswgsyh3JTLwKGSAJDLm0L6friSgI8RV3itqcc7hCXpR6AFP8cWLeHme2Pv/6w== X-Gm-Message-State: AOJu0YzT7lqqOOexQkiVw71HbHLMf7Xe1Ho6SnoxSVYnrhTjq0f7GUa6 z5o1z3a6iXqK92pdj+Yw6GGR/MMcx9XCkvzXIScFP2GCM+VdLu9cG/XwdnL8/CwnOpB57f98aia Zr5I8j84SayqKsg6NRPKIG1M3W135BWmd X-Received: by 2002:a05:690c:660d:b0:62a:530:1e53 with SMTP id 00721157ae682-62a35ec8f2cmr126279067b3.30.1717001547085; Wed, 29 May 2024 09:52:27 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240529092030.9557-1-luis.henriques@linux.dev> <20240529092030.9557-2-luis.henriques@linux.dev> <20240529095032.kax3nwtsofyk6qxz@quack3> In-Reply-To: <20240529095032.kax3nwtsofyk6qxz@quack3> From: harshad shirwadkar Date: Wed, 29 May 2024 09:52:15 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] ext4: fix fast commit inode enqueueing during a full journal commit To: Jan Kara Cc: "Luis Henriques (SUSE)" , "Theodore Ts'o" , Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Looks good! Reviewed-by: Harshad Shirwadkar On Wed, May 29, 2024 at 2:50=E2=80=AFAM Jan Kara wrote: > > On Wed 29-05-24 10:20:29, Luis Henriques (SUSE) wrote: > > When a full journal commit is on-going, any fast commit has to be enque= ued > > into a different queue: FC_Q_STAGING instead of FC_Q_MAIN. This enqueu= eing > > is done only once, i.e. if an inode is already queued in a previous fas= t > > commit entry it won't be enqueued again. However, if a full commit sta= rts > > _after_ the inode is enqueued into FC_Q_MAIN, the next fast commit need= s to > > be done into FC_Q_STAGING. And this is not being done in function > > ext4_fc_track_template(). > > > > This patch fixes the issue by re-enqueuing an inode into the STAGING qu= eue > > during the fast commit clean-up callback if it has a tid (i_sync_tid) > > greater than the one being handled. The STAGING queue will then be spl= iced > > back into MAIN. > > > > This bug was found using fstest generic/047. This test creates several= 32k > > bytes files, sync'ing each of them after it's creation, and then shutti= ng > > down the filesystem. Some data may be loss in this operation; for exam= ple a > > file may have it's size truncated to zero. > > > > Signed-off-by: Luis Henriques (SUSE) > > Looks good to me! Feel free to add: > > Reviewed-by: Jan Kara > > Just a typo correction below. > > > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c > > index 87c009e0c59a..088bd509b116 100644 > > --- a/fs/ext4/fast_commit.c > > +++ b/fs/ext4/fast_commit.c > > @@ -1282,8 +1282,17 @@ static void ext4_fc_cleanup(journal_t *journal, = int full, tid_t tid) > > list_del_init(&iter->i_fc_list); > > ext4_clear_inode_state(&iter->vfs_inode, > > EXT4_STATE_FC_COMMITTING); > > - if (iter->i_sync_tid <=3D tid) > > + if (iter->i_sync_tid <=3D tid) { > > ext4_fc_reset_inode(&iter->vfs_inode); > > + } else { > > + /* > > + * re-enqueue inode into STAGING, which later wil= l be > > + * splice back into MAIN > ^^^ spliced > > > + */ > > + list_add_tail(&EXT4_I(&iter->vfs_inode)->i_fc_lis= t, > > + &sbi->s_fc_q[FC_Q_STAGING]); > > + } > > + > > Honza > -- > Jan Kara > SUSE Labs, CR