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.
This commit is contained in:
parent
cf51adc0a1
commit
6a52a06851
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user