summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2005-05-18 22:18:21 +0000
committermckusick <mckusick@FreeBSD.org>2005-05-18 22:18:21 +0000
commit72bafed72fb51c19757071ca9427f514ca991ae5 (patch)
tree29bab4769a0ae861de089071399ed2960249f9d0 /sys/ufs
parentc7cb7f73179267054730156854cf59ee8a5f6a5f (diff)
downloadFreeBSD-src-72bafed72fb51c19757071ca9427f514ca991ae5.zip
FreeBSD-src-72bafed72fb51c19757071ca9427f514ca991ae5.tar.gz
Allow removal of empty directories with high link counts. These can
occur on a filesystem running with soft updates after a crash and before a background fsck has been run. To prevent discrepancies from arising in a background fsck that may already be running, the directory is removed but its inode is not freed and is left with the residual reference count. When encountered by the background fsck it will be reclaimed.
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/ufs_vnops.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 2ed5bff..36dad08 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1645,12 +1645,11 @@ ufs_rmdir(ap)
* tries to remove a locally mounted on directory).
*/
error = 0;
- if (ip->i_flag & IN_RENAME) {
+ if ((ip->i_flag & IN_RENAME) || ip->i_effnlink < 2) {
error = EINVAL;
goto out;
}
- if (ip->i_effnlink != 2 ||
- !ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) {
+ if (!ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) {
error = ENOTEMPTY;
goto out;
}
OpenPOWER on IntegriCloud