Print this page
7203 unlinking a directory on tmpfs does not remove the directory entries
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Alexander Stetsenko <astetsenko@racktopsystems.com>
@@ -25,10 +25,11 @@
*/
/*
* Copyright (c) 2015, Joyent, Inc. All rights reserved.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2016 RackTop Systems.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/t_lock.h>
@@ -1102,11 +1103,12 @@
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);
+ 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);