Skip to content

Commit

Permalink
ubifs: Fix ubifs_tnc_lookup() usage in do_kill_orphans()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
richardweinberger committed Mar 30, 2020
1 parent 16fbf79 commit 4ab25ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ubifs/orphan.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,14 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,

ino_key_init(c, &key1, inum);
err = ubifs_tnc_lookup(c, &key1, ino);
if (err)
if (err && err != -ENOENT)
goto out_free;

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

Expand Down

0 comments on commit 4ab25ac

Please sign in to comment.