extern struct xfs_dir2_data_free *xfs_dir2_data_freefind(
struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_unused *dup);
+extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
+
extern const struct xfs_buf_ops xfs_dir3_block_buf_ops;
extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops;
extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;
struct dir_context;
/* xfs_dir2.c */
-extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
xfs_dir2_db_t *dbp);
extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
* for the libxfs_dir_init() call).
*/
pip.i_ino = get_inode_parent(irec, ino_offset);
- if (pip.i_ino == NULLFSINO)
+ if (pip.i_ino == NULLFSINO ||
+ xfs_dir_ino_validate(mp, pip.i_ino))
pip.i_ino = mp->m_sb.sb_rootino;
xfs_bmap_init(&flist, &firstblock);
ASSERT(done);
- libxfs_dir_init(tp, ip, &pip);
+ error = libxfs_dir_init(tp, ip, &pip);
+ if (error) {
+ do_warn(_("xfs_dir_init failed -- error - %d\n"), error);
+ goto out_bmap_cancel;
+ }
error = libxfs_bmap_finish(&tp, &flist, &committed);