Skip to content

Commit 78c7d49

Browse files
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@vger.kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Kristof Havasi <havasiefr@gmail.com> Fixes: 6a98bc4 ("ubifs: Add authentication nodes to journal") Reported-and-tested-by: Kristof Havasi <havasiefr@gmail.com> Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 121b8fc commit 78c7d49

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/ubifs/journal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,6 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
938938
inode->i_ino);
939939
release_head(c, BASEHD);
940940

941-
ubifs_add_auth_dirt(c, lnum);
942-
943941
if (last_reference) {
944942
err = ubifs_tnc_remove_ino(c, inode->i_ino);
945943
if (err)
@@ -949,6 +947,8 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
949947
} else {
950948
union ubifs_key key;
951949

950+
ubifs_add_auth_dirt(c, lnum);
951+
952952
ino_key_init(c, &key, inode->i_ino);
953953
err = ubifs_tnc_add(c, &key, lnum, offs, ilen, hash);
954954
}

0 commit comments

Comments
 (0)