If repair calls mk_orphanage and the /lost+found directory already
exists, we need to irele the root directory before exiting the function.
Fixes: 6c39a3cbda32 ("Don't trash lost+found in phase 4 Merge of master-melb:xfs-cmds:29144a by kenmcd.")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
xname.len = strlen(ORPHANAGE);
xname.type = XFS_DIR3_FT_DIR;
- if (libxfs_dir_lookup(NULL, pip, &xname, &ino, NULL) == 0)
- return ino;
+ /* If the lookup of /lost+found succeeds, return the inumber. */
+ error = -libxfs_dir_lookup(NULL, pip, &xname, &ino, NULL);
+ if (error == 0)
+ goto out_pip;
/*
* could not be found, create it
ORPHANAGE, error);
}
libxfs_irele(ip);
+out_pip:
libxfs_irele(pip);
return(ino);