From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83603C388F7 for ; Tue, 3 Nov 2020 21:47:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32AAD22384 for ; Tue, 3 Nov 2020 21:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604440076; bh=P6PU9YgYPvKsSgsFwFUTvABFrFkeAW6iIYmJKiRzi94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HknfgjONQSE80OWTRoHUHd7mKMSuSHOIz5xTBvj1ZnTzW0bVon+UGa4G8YnBYfD4w f0G5JzHL8UUe1YBf/swv3B0lK+C9zp4hLrONfLPy42HoZy0nXtteMT31L75RJ+OhRV /T/ml3Rhis3vRzT6h40GwZo6qO0YJEbSHnTeXdYs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732613AbgKCVry (ORCPT ); Tue, 3 Nov 2020 16:47:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:45244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731002AbgKCUut (ORCPT ); Tue, 3 Nov 2020 15:50:49 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 715C022404; Tue, 3 Nov 2020 20:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436648; bh=P6PU9YgYPvKsSgsFwFUTvABFrFkeAW6iIYmJKiRzi94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XDnlges5PXrN/ydr+NNo0xZMHIv+fO88zcLbcp6phou5HkcmXwHq4CGBmmAspsNEx lzYNiQDThBh37QIBRmbxPHI6XV5rXvQ2/JxJbwzxOMyWmpkpgcV231/ayPJFv6eb8B 1zH1oxC3UPyM1zF1kEGNluj+nCB3p87pQlV/QFAI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sascha Hauer , Kristof Havasi , Richard Weinberger Subject: [PATCH 5.9 305/391] ubifs: journal: Make sure to not dirty twice for auth nodes Date: Tue, 3 Nov 2020 21:35:56 +0100 Message-Id: <20201103203407.681366424@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Richard Weinberger commit 78c7d49f55d8631b67c09f9bfbe8155211a9ea06 upstream. When removing the last reference of an inode the size of an auth node is already part of write_len. So we must not call ubifs_add_auth_dirt(). Call it only when needed. Cc: Cc: Sascha Hauer Cc: Kristof Havasi Fixes: 6a98bc4614de ("ubifs: Add authentication nodes to journal") Reported-and-tested-by: Kristof Havasi Reviewed-by: Sascha Hauer Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -938,8 +938,6 @@ int ubifs_jnl_write_inode(struct ubifs_i inode->i_ino); release_head(c, BASEHD); - ubifs_add_auth_dirt(c, lnum); - if (last_reference) { err = ubifs_tnc_remove_ino(c, inode->i_ino); if (err) @@ -949,6 +947,8 @@ int ubifs_jnl_write_inode(struct ubifs_i } else { union ubifs_key key; + ubifs_add_auth_dirt(c, lnum); + ino_key_init(c, &key, inode->i_ino); err = ubifs_tnc_add(c, &key, lnum, offs, ilen, hash); }