From 100f241571761fca0d60f1bb60e418d22bcb30cd Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Fri, 28 Dec 2007 00:38:13 +0000 Subject: [PATCH] Trimm out now unused option LK_EXCLUPGRADE from the lockmgr namespace. This option just adds complexity and the new implementation no longer will support it, so axing it now that it is unused is probabilly the better idea. FreeBSD version is bumped in order to reflect the KPI breakage introduced by this patch. In the ports tree, kris found that only old OSKit code uses it, but as it is thought to work only on 2.x kernels serie, version bumping will solve any problem. --- share/man/man9/VOP_LOCK.9 | 8 +++----- share/man/man9/lock.9 | 12 ++---------- sys/fs/unionfs/union_vnops.c | 1 - sys/kern/kern_lock.c | 13 ------------- sys/sys/lockmgr.h | 7 ------- sys/sys/param.h | 2 +- 6 files changed, 6 insertions(+), 37 deletions(-) diff --git a/share/man/man9/VOP_LOCK.9 b/share/man/man9/VOP_LOCK.9 index c519e46a3ce3..36fbe4e9a759 100644 --- a/share/man/man9/VOP_LOCK.9 +++ b/share/man/man9/VOP_LOCK.9 @@ -61,15 +61,13 @@ The vnode being locked or unlocked. .It Fa flags One of the lock request types: .Pp -.Bl -tag -width ".Dv LK_EXCLUPGRADE" -offset indent -compact +.Bl -tag -width ".Dv LK_CANRECURSE" -offset indent -compact .It Dv LK_SHARED Shared lock. .It Dv LK_EXCLUSIVE Exclusive lock. .It Dv LK_UPGRADE Shared-to-exclusive upgrade. -.It Dv LK_EXCLUPGRADE -First shared-to-exclusive upgrade. .It Dv LK_DOWNGRADE Exclusive-to-shared downgrade. .It Dv LK_RELEASE @@ -82,7 +80,7 @@ The lock type may be .Em or Ns 'ed with these lock flags: .Pp -.Bl -tag -width ".Dv LK_EXCLUPGRADE" -offset indent -compact +.Bl -tag -width ".Dv LK_CANRECURSE" -offset indent -compact .It Dv LK_NOWAIT Do not sleep to wait for lock. .It Dv LK_SLEEPFAIL @@ -95,7 +93,7 @@ The lock type may be .Em or Ns 'ed with these control flags: .Pp -.Bl -tag -width ".Dv LK_EXCLUPGRADE" -offset indent -compact +.Bl -tag -width ".Dv LK_CANRECURSE" -offset indent -compact .It Dv LK_INTERLOCK Specify when the caller already has a simple lock .Fn ( VOP_LOCK diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9 index 5968745caddf..ee73335d839e 100644 --- a/share/man/man9/lock.9 +++ b/share/man/man9/lock.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2006 +.Dd December 27, 2007 .Dt LOCK 9 .Os .Sh NAME @@ -113,7 +113,7 @@ Its arguments are: A pointer to the lock to manipulate. .It Fa flags Flags indicating what action is to be taken. -.Bl -tag -width ".Dv LK_EXCLUPGRADE" +.Bl -tag -width ".Dv LK_CANRECURSE" .It Dv LK_SHARED Acquire a shared lock. If an exclusive lock is currently held, it will be downgraded. @@ -127,14 +127,6 @@ is not set, the system will Downgrade exclusive lock to a shared lock. Downgrading a shared lock is not permitted. If an exclusive lock has been recursed, all references will be downgraded. -.It Dv LK_EXCLUPGRADE -Upgrade a shared lock to an exclusive lock. -Fails with -.Er EBUSY -if there is someone ahead of you in line waiting for an upgrade. -If this call fails, the shared lock is lost. -Attempts to upgrade an exclusive lock will cause a -.Xr panic 9 . .It Dv LK_UPGRADE Upgrade a shared lock to an exclusive lock. If this call fails, the shared lock is lost. diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 7a0cb6076f78..74c90b1bb560 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -81,7 +81,6 @@ static struct lk_lr_table un_llt[] = { {LK_SHARED, LK_RELEASE}, {LK_EXCLUSIVE, LK_RELEASE}, {LK_UPGRADE, LK_DOWNGRADE}, - {LK_EXCLUPGRADE, LK_DOWNGRADE}, {LK_DOWNGRADE, LK_UPGRADE}, {0, 0} }; diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index d4413def1baf..8d1a219dd462 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -299,19 +299,6 @@ _lockmgr(struct lock *lkp, u_int flags, struct mtx *interlkp, wakeup((void *)lkp); break; - case LK_EXCLUPGRADE: - /* - * If another process is ahead of us to get an upgrade, - * then we want to fail rather than have an intervening - * exclusive access. - */ - if (lkp->lk_flags & LK_WANT_UPGRADE) { - shareunlock(td, lkp, 1); - error = EBUSY; - break; - } - /* FALLTHROUGH normal upgrade */ - case LK_UPGRADE: /* * Upgrade a shared lock to an exclusive one. If another diff --git a/sys/sys/lockmgr.h b/sys/sys/lockmgr.h index 9765c364f0c1..6fe9e635dd3c 100644 --- a/sys/sys/lockmgr.h +++ b/sys/sys/lockmgr.h @@ -84,12 +84,6 @@ struct lock { * have upgraded to an exclusive lock. Other processes may get * exclusive access to the resource between the time that the upgrade * is requested and the time that it is granted. - * LK_EXCLUPGRADE - the process must hold a shared lock that it wants to - * have upgraded to an exclusive lock. If the request succeeds, no - * other processes will have gotten exclusive access to the resource - * between the time that the upgrade is requested and the time that - * it is granted. However, if another process has already requested - * an upgrade, the request will fail (see error returns below). * LK_DOWNGRADE - the process must hold an exclusive lock that it wants * to have downgraded to a shared lock. If the process holds multiple * (recursive) exclusive locks, they will all be downgraded to shared @@ -107,7 +101,6 @@ struct lock { #define LK_SHARED 0x00000001 /* shared lock */ #define LK_EXCLUSIVE 0x00000002 /* exclusive lock */ #define LK_UPGRADE 0x00000003 /* shared-to-exclusive upgrade */ -#define LK_EXCLUPGRADE 0x00000004 /* first shared-to-exclusive upgrade */ #define LK_DOWNGRADE 0x00000005 /* exclusive-to-shared downgrade */ #define LK_RELEASE 0x00000006 /* release any type of lock */ #define LK_DRAIN 0x00000007 /* wait for all lock activity to end */ diff --git a/sys/sys/param.h b/sys/sys/param.h index 1e46bebcf77e..67b0e744f67b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800007 /* Master, propagated to newvers */ +#define __FreeBSD_version 800008 /* Master, propagated to newvers */ #ifndef LOCORE #include