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=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 37DBEC4741F for ; Mon, 28 Sep 2020 19:15:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4C1B2071E for ; Mon, 28 Sep 2020 19:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbgI1TPH (ORCPT ); Mon, 28 Sep 2020 15:15:07 -0400 Received: from lilium.sigma-star.at ([109.75.188.150]:41100 "EHLO lilium.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbgI1TPH (ORCPT ); Mon, 28 Sep 2020 15:15:07 -0400 X-Greylist: delayed 520 seconds by postgrey-1.27 at vger.kernel.org; Mon, 28 Sep 2020 15:15:06 EDT Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id D95401816FACD; Mon, 28 Sep 2020 21:06:24 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id RyaKbBkj8g-T; Mon, 28 Sep 2020 21:06:24 +0200 (CEST) Received: from lilium.sigma-star.at ([127.0.0.1]) by localhost (lilium.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id C2466gc1w1W9; Mon, 28 Sep 2020 21:06:24 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Richard Weinberger , stable@vger.kernel.org, Sascha Hauer , Kristof Havasi Subject: [PATCH] ubifs: journal: Make sure to not dirty twice for auth nodes Date: Mon, 28 Sep 2020 21:06:12 +0200 Message-Id: <20200928190612.12074-1-richard@nod.at> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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-by: Kristof Havasi Signed-off-by: Richard Weinberger --- fs/ubifs/journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index cb1fa0c37322..091c2ad8f211 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -938,8 +938,6 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const= struct inode *inode) inode->i_ino); release_head(c, BASEHD); =20 - ubifs_add_auth_dirt(c, lnum); - if (last_reference) { err =3D ubifs_tnc_remove_ino(c, inode->i_ino); if (err) @@ -949,6 +947,8 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const= struct inode *inode) } else { union ubifs_key key; =20 + ubifs_add_auth_dirt(c, lnum); + ino_key_init(c, &key, inode->i_ino); err =3D ubifs_tnc_add(c, &key, lnum, offs, ilen, hash); } --=20 2.26.2