summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2005-06-10 17:37:42 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2005-06-10 17:37:42 +0000
commit68d15a1fd2a4d26cadf36a84d448a8b6ef287a59 (patch)
tree44cc2d71aeb8bc180485008eb8c1572ad5e4a10d /sys/ufs/ffs
parent5467aef96876d36ffa948f5ae06c61ba5e4ca5aa (diff)
Tweak softdep_change_linkcnt() so we can specify whether we're willing
to be co-opted by softdep or not, and use this new interface to inform softdep in ufs_inactive() that the inode mode has changed. We don't want to be co-opted there as that might lead to undesired circular dependencies such as a vput() depending on another vput() to complete, or a process that is trying to free up a vnode being blocked trying to acquire a new vnode. Okay tedu@ deraadt@, thanks to all those who tested.
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r--sys/ufs/ffs/ffs_softdep.c18
-rw-r--r--sys/ufs/ffs/ffs_softdep_stub.c5
2 files changed, 18 insertions, 5 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 17fda288d6b..8cd281c25a7 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep.c,v 1.56 2005/05/24 04:33:35 pedro Exp $ */
+/* $OpenBSD: ffs_softdep.c,v 1.57 2005/06/10 17:37:40 pedro Exp $ */
/*
* Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
*
@@ -2901,18 +2901,30 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir)
* inode has been written.
*/
void
-softdep_change_linkcnt(ip)
+softdep_change_linkcnt(ip, nodelay)
struct inode *ip; /* the inode with the increased link count */
+ int nodelay; /* do background work or not */
{
struct inodedep *inodedep;
+ int flags;
+
+ /*
+ * If requested, do not allow background work to happen.
+ */
+ flags = DEPALLOC;
+ if (nodelay)
+ flags |= NODELAY;
ACQUIRE_LOCK(&lk);
- (void) inodedep_lookup(ip->i_fs, ip->i_number, DEPALLOC, &inodedep);
+
+ (void) inodedep_lookup(ip->i_fs, ip->i_number, flags, &inodedep);
if (ip->i_ffs_nlink < ip->i_effnlink) {
FREE_LOCK(&lk);
panic("softdep_change_linkcnt: bad delta");
}
+
inodedep->id_nlinkdelta = ip->i_ffs_nlink - ip->i_effnlink;
+
FREE_LOCK(&lk);
}
diff --git a/sys/ufs/ffs/ffs_softdep_stub.c b/sys/ufs/ffs/ffs_softdep_stub.c
index 6b6b4f57d1b..36d55c1cdf7 100644
--- a/sys/ufs/ffs/ffs_softdep_stub.c
+++ b/sys/ufs/ffs/ffs_softdep_stub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep_stub.c,v 1.8 2004/12/07 06:06:51 deraadt Exp $ */
+/* $OpenBSD: ffs_softdep_stub.c,v 1.9 2005/06/10 17:37:40 pedro Exp $ */
/*
* Copyright 1998 Marshall Kirk McKusick. All Rights Reserved.
@@ -202,8 +202,9 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir)
}
void
-softdep_change_linkcnt(ip)
+softdep_change_linkcnt(ip, nodelay)
struct inode *ip;
+ int nodelay;
{
panic("softdep_change_linkcnt called");