Print this page
7653 tmpfs: calling unlink() on a directory which isn't empty should fail

*** 1103,1114 **** rw_enter(&parent->tn_rwlock, RW_WRITER); rw_enter(&tp->tn_rwlock, RW_WRITER); if (tp->tn_type != VDIR || (error = secpolicy_fs_linkdir(cred, dvp->v_vfsp)) == 0) ! error = tdirdelete(parent, tp, nm, tp->tn_type == VDIR ? ! DR_RMDIR : DR_REMOVE, cred); rw_exit(&tp->tn_rwlock); rw_exit(&parent->tn_rwlock); vnevent_remove(TNTOV(tp), dvp, nm, ct); tmpnode_rele(tp); --- 1103,1113 ---- rw_enter(&parent->tn_rwlock, RW_WRITER); rw_enter(&tp->tn_rwlock, RW_WRITER); if (tp->tn_type != VDIR || (error = secpolicy_fs_linkdir(cred, dvp->v_vfsp)) == 0) ! error = tdirdelete(parent, tp, nm, DR_REMOVE, cred); rw_exit(&tp->tn_rwlock); rw_exit(&parent->tn_rwlock); vnevent_remove(TNTOV(tp), dvp, nm, ct); tmpnode_rele(tp);
*** 1426,1449 **** if (vn_mountedvfs(vp) != NULL) { error = EBUSY; goto done; } - /* - * Check for an empty directory - * i.e. only includes entries for "." and ".." - */ - if (self->tn_dirents > 2) { - error = EEXIST; /* SIGH should be ENOTEMPTY */ - /* - * Update atime because checking tn_dirents is logically - * equivalent to reading the directory - */ - gethrestime(&self->tn_atime); - goto done; - } - error = tdirdelete(parent, self, nm, DR_RMDIR, cred); done: vn_vfsunlock(vp); done1: rw_exit(&self->tn_rwlock); --- 1425,1434 ----