Skip to content

Commit 4ab25ac

Browse files
ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
Orphans are allowed to point to deleted inodes. So -ENOENT is not a fatal error. Reported-by: Кочетков Максим <[email protected]> Reported-and-tested-by: "Christian Berger" <[email protected]> Tested-by: Karl Olsen <[email protected]> Tested-by: Jef Driesen <[email protected]> Fixes: ee1438c ("ubifs: Check link count of inodes when killing orphans.") Signed-off-by: Richard Weinberger <[email protected]>
1 parent 16fbf79 commit 4ab25ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ubifs/orphan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,14 +688,14 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
688688

689689
ino_key_init(c, &key1, inum);
690690
err = ubifs_tnc_lookup(c, &key1, ino);
691-
if (err)
691+
if (err && err != -ENOENT)
692692
goto out_free;
693693

694694
/*
695695
* Check whether an inode can really get deleted.
696696
* linkat() with O_TMPFILE allows rebirth of an inode.
697697
*/
698-
if (ino->nlink == 0) {
698+
if (err == 0 && ino->nlink == 0) {
699699
dbg_rcvry("deleting orphaned inode %lu",
700700
(unsigned long)inum);
701701

0 commit comments

Comments
 (0)