import a fix from FreeBSD (rev.1.185):

After a rmdir()ed directory has been truncated, force an update of
the directory's inode after queuing the dirrem that will decrement
the parent directory's link count.  This will force the update of
the parent directory's actual link to actually be scheduled.  Without
this change the parent directory's actual link count would not be
updated until ufs_inactive() cleared the inode of the newly removed
directory, which might be deferred indefinitely.  ufs_inactive()
will not be called as long as any process holds a reference to the
removed directory, and ufs_inactive() will not clear the inode if
the link count is non-zero, which could be the result of an earlier
system crash.
[plus description about problems woth background fsck solved
by this; irrelevant to NetBSD]

For me, the good effect is at least that I'm getting less filesystem
inconsistencies after a crash.

Approved by christos quite a while ago.
This commit is contained in:
drochner 2006-10-24 19:36:26 +00:00
parent 747abe99e5
commit bffbce1754
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_softdep.c,v 1.79 2006/10/14 07:26:29 yamt Exp $ */
/* $NetBSD: ffs_softdep.c,v 1.80 2006/10/24 19:36:26 drochner Exp $ */
/*
* Copyright 1998 Marshall Kirk McKusick. All Rights Reserved.
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.79 2006/10/14 07:26:29 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_softdep.c,v 1.80 2006/10/24 19:36:26 drochner Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -3321,6 +3321,8 @@ handle_workitem_remove(dirrem)
}
WORKLIST_INSERT(&inodedep->id_inowait, &dirrem->dm_list);
FREE_LOCK(&lk);
ip->i_flag |= IN_CHANGE;
ffs_update(vp, NULL, NULL, 0);
vput(vp);
}