From: Matthew Dillon Date: Sun, 21 Feb 2010 16:41:15 +0000 (-0800) Subject: kernel - TMPFS - Stabilization pass, fix assertion in nrmdir X-Git-Tag: v2.6.0~155 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/38e5e60484f827fe6e856e8f0e00d476f4044bcd kernel - TMPFS - Stabilization pass, fix assertion in nrmdir * Have tmpfs_nrmdir() test whether the vp is a directory and return the proper error before asserting that it is a directory. * Fixes assertion panic if you attempt to rmdir a file in tmpfs. --- diff --git a/sys/vfs/tmpfs/tmpfs_vnops.c b/sys/vfs/tmpfs/tmpfs_vnops.c index ec4e553..76e4598 100644 --- a/sys/vfs/tmpfs/tmpfs_vnops.c +++ b/sys/vfs/tmpfs/tmpfs_vnops.c @@ -1062,12 +1062,17 @@ tmpfs_nrmdir(struct vop_nrmdir_args *v) struct vnode *dvp = v->a_dvp; struct namecache *ncp = v->a_nch->ncp; struct vnode *vp; - - int error; struct tmpfs_dirent *de; struct tmpfs_mount *tmp; struct tmpfs_node *dnode; struct tmpfs_node *node; + int error; + + /* + * Prevalidate so we don't hit an assertion later + */ + if (vp->v_type != VDIR) + return ENOTDIR; /* * We have to acquire the vp from v->a_nch because