1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-05 12:56:08 +00:00

ext2fs: fix a bug in dirindex and re-enable.

The IN_* flags should be set in i_flag instead of corrupting
i_flags [1].

Re-enable HTree dirindex as the last series of bug fixes
seems to have fixed the issues.

Reported by:	bde [1]
Tested by:	kevlo
MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni 2014-01-24 13:51:38 +00:00
parent 56ae078529
commit 1093104cf7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=261120
2 changed files with 1 additions and 6 deletions

View File

@ -89,12 +89,10 @@ static int ext2_htree_writebuf(struct ext2fs_htree_lookup_info *info);
int int
ext2_htree_has_idx(struct inode *ip) ext2_htree_has_idx(struct inode *ip)
{ {
#ifdef EXT2FS_HTREE
if (EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) && if (EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) &&
ip->i_flags & E4_INDEX) ip->i_flags & E4_INDEX)
return (1); return (1);
else else
#endif
return (0); return (0);
} }

View File

@ -884,13 +884,11 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, struct componentname *cnp)
bcopy(cnp->cn_nameptr, newdir.e2d_name, (unsigned)cnp->cn_namelen + 1); bcopy(cnp->cn_nameptr, newdir.e2d_name, (unsigned)cnp->cn_namelen + 1);
newentrysize = EXT2_DIR_REC_LEN(newdir.e2d_namlen); newentrysize = EXT2_DIR_REC_LEN(newdir.e2d_namlen);
#ifdef EXT2FS_HTREE
if (ext2_htree_has_idx(dp)) { if (ext2_htree_has_idx(dp)) {
error = ext2_htree_add_entry(dvp, &newdir, cnp); error = ext2_htree_add_entry(dvp, &newdir, cnp);
if (error) { if (error) {
/* XXX: These are set in the wrong place. */
dp->i_flags &= ~E4_INDEX; dp->i_flags &= ~E4_INDEX;
dp->i_flags |= IN_CHANGE | IN_UPDATE; dp->i_flag |= IN_CHANGE | IN_UPDATE;
} }
return (error); return (error);
} }
@ -906,7 +904,6 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, struct componentname *cnp)
return ext2_htree_create_index(dvp, cnp, &newdir); return ext2_htree_create_index(dvp, cnp, &newdir);
} }
} }
#endif /* EXT2FS_HTREE */
if (dp->i_count == 0) { if (dp->i_count == 0) {
/* /*