Skip to content

Commit

Permalink
ubifs: journal: Make sure to not dirty twice for auth nodes
Browse files Browse the repository at this point in the history
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: <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Kristof Havasi <[email protected]>
Fixes: 6a98bc4 ("ubifs: Add authentication nodes to journal")
Reported-and-tested-by: Kristof Havasi <[email protected]>
Reviewed-by: Sascha Hauer <[email protected]>
Signed-off-by: Richard Weinberger <[email protected]>
  • Loading branch information
richardweinberger committed Sep 29, 2020
1 parent 121b8fc commit 78c7d49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ubifs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down

0 comments on commit 78c7d49

Please sign in to comment.