linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ubifs: journal: Make sure to not dirty twice for auth nodes
@ 2020-09-28 19:06 Richard Weinberger
  2020-09-29  8:32 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2020-09-28 19:06 UTC (permalink / raw)
  To: linux-mtd
  Cc: linux-kernel, Richard Weinberger, stable, Sascha Hauer, Kristof Havasi

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@vger.kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Kristof Havasi <havasiefr@gmail.com>
Fixes: 6a98bc4614de ("ubifs: Add authentication nodes to journal")
Reported-by: Kristof Havasi <havasiefr@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ubifs: journal: Make sure to not dirty twice for auth nodes
  2020-09-28 19:06 [PATCH] ubifs: journal: Make sure to not dirty twice for auth nodes Richard Weinberger
@ 2020-09-29  8:32 ` Sascha Hauer
  2020-09-29  8:44   ` Richard Weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2020-09-29  8:32 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: linux-mtd, linux-kernel, stable, Kristof Havasi

On Mon, Sep 28, 2020 at 09:06:12PM +0200, Richard Weinberger wrote:
> 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@vger.kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Kristof Havasi <havasiefr@gmail.com>
> Fixes: 6a98bc4614de ("ubifs: Add authentication nodes to journal")
> Reported-by: Kristof Havasi <havasiefr@gmail.com>
> Signed-off-by: Richard Weinberger <richard@nod.at>

Looked at the code until I understood what the problem is and how it is
fixed, so:

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ubifs: journal: Make sure to not dirty twice for auth nodes
  2020-09-29  8:32 ` Sascha Hauer
@ 2020-09-29  8:44   ` Richard Weinberger
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2020-09-29  8:44 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: linux-mtd, linux-kernel, stable, Kristof Havasi

----- Ursprüngliche Mail -----
> Von: "Sascha Hauer" <s.hauer@pengutronix.de>
> An: "richard" <richard@nod.at>
> CC: "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>, "stable"
> <stable@vger.kernel.org>, "Kristof Havasi" <havasiefr@gmail.com>
> Gesendet: Dienstag, 29. September 2020 10:32:32
> Betreff: Re: [PATCH] ubifs: journal: Make sure to not dirty twice for auth nodes

> On Mon, Sep 28, 2020 at 09:06:12PM +0200, Richard Weinberger wrote:
>> 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@vger.kernel.org>
>> Cc: Sascha Hauer <s.hauer@pengutronix.de>
>> Cc: Kristof Havasi <havasiefr@gmail.com>
>> Fixes: 6a98bc4614de ("ubifs: Add authentication nodes to journal")
>> Reported-by: Kristof Havasi <havasiefr@gmail.com>
>> Signed-off-by: Richard Weinberger <richard@nod.at>
> 
> Looked at the code until I understood what the problem is and how it is
> fixed, so:
> 
> Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>

Applied to fixes branch!

Thanks,
//richard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-29  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-28 19:06 [PATCH] ubifs: journal: Make sure to not dirty twice for auth nodes Richard Weinberger
2020-09-29  8:32 ` Sascha Hauer
2020-09-29  8:44   ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).