From: Richard Weinberger Date: Mon, 28 Sep 2020 18:58:59 +0000 (+0200) Subject: ubifs: journal: Make sure to not dirty twice for auth nodes X-Git-Tag: v5.4.75~44 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bc202c839b5d38096210a7b466313af0c8fe2202;p=users%2Fdwmw2%2Flinux.git ubifs: journal: Make sure to not dirty twice for auth nodes 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 --- diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 037b7a7549f5c..f78c3e3ef9314 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); }