ubifs: Fix wrong orphan node deletion in ubifs_jnl_update|rename
authorZhihao Cheng <chengzhihao1@huawei.com>
Tue, 7 Jul 2020 12:51:40 +0000 (20:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 11:15:13 +0000 (13:15 +0200)
commitc394441530fabbeaff7e5b6437ef4ebf30b931c1
tree45d3b9d8f7bd132015b590eaac34dca9d6a1e0be
parent9a51a86041f798181f1470d32a0f17e13e977fe5
ubifs: Fix wrong orphan node deletion in ubifs_jnl_update|rename

[ Upstream commit 094b6d1295474f338201b846a1f15e72eb0b12cf ]

There a wrong orphan node deleting in error handling path in
ubifs_jnl_update() and ubifs_jnl_rename(), which may cause
following error msg:

  UBIFS error (ubi0:0 pid 1522): ubifs_delete_orphan [ubifs]:
  missing orphan ino 65

Fix this by checking whether the node has been operated for
adding to orphan list before being deleted,

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Fixes: 823838a486888cf484e ("ubifs: Add hashes to the tree node cache")
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ubifs/journal.c