Stop using dirhash when a directory is removed, and ensure that we
never attempt to hash directories once they are deleted. This fixes a problem where operations on a deleted directory could trigger dirhash sanity panics.
This commit is contained in:
parent
874f2e78b4
commit
be70fc04ce
sys/ufs/ufs
@ -135,6 +135,10 @@ ufsdirhash_build(struct inode *ip)
|
||||
ufsdirhash_free(ip);
|
||||
}
|
||||
|
||||
/* Don't hash removed directories. */
|
||||
if (ip->i_effnlink == 0)
|
||||
return (-1);
|
||||
|
||||
vp = ip->i_vnode;
|
||||
/* Allocate 50% more entries than this dir size could ever need. */
|
||||
KASSERT(ip->i_size >= DIRBLKSIZ, ("ufsdirhash_build size"));
|
||||
|
@ -77,6 +77,9 @@
|
||||
#include <ufs/ufs/dir.h>
|
||||
#include <ufs/ufs/ufsmount.h>
|
||||
#include <ufs/ufs/ufs_extern.h>
|
||||
#ifdef UFS_DIRHASH
|
||||
#include <ufs/ufs/dirhash.h>
|
||||
#endif
|
||||
|
||||
static int ufs_access __P((struct vop_access_args *));
|
||||
static int ufs_advlock __P((struct vop_advlock_args *));
|
||||
@ -1691,6 +1694,11 @@ ufs_rmdir(ap)
|
||||
cnp->cn_proc);
|
||||
}
|
||||
cache_purge(vp);
|
||||
#ifdef UFS_DIRHASH
|
||||
/* Kill any active hash; i_effnlink == 0, so it will not come back. */
|
||||
if (ip->i_dirhash != NULL)
|
||||
ufsdirhash_free(ip);
|
||||
#endif
|
||||
out:
|
||||
VN_KNOTE(vp, NOTE_DELETE);
|
||||
return (error);
|
||||
|
Loading…
x
Reference in New Issue
Block a user