[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200928190612.12074-1-richard@nod.at>
Date: Mon, 28 Sep 2020 21:06:12 +0200
From: Richard Weinberger <richard@....at>
To: linux-mtd@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org, Richard Weinberger <richard@....at>,
stable@...r.kernel.org, Sascha Hauer <s.hauer@...gutronix.de>,
Kristof Havasi <havasiefr@...il.com>
Subject: [PATCH] ubifs: journal: Make sure to not dirty twice for auth nodes
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: <stable@...r.kernel.org>
Cc: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Kristof Havasi <havasiefr@...il.com>
Fixes: 6a98bc4614de ("ubifs: Add authentication nodes to journal")
Reported-by: Kristof Havasi <havasiefr@...il.com>
Signed-off-by: Richard Weinberger <richard@....at>
---
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);
- 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_info *c, const struct inode *inode)
} 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);
}
--
2.26.2
Powered by blists - more mailing lists