summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2009-08-17 16:12:28 +0000
committerrmacklem <rmacklem@FreeBSD.org>2009-08-17 16:12:28 +0000
commitea9d3c1b1e51a28d55859019f8468155dfc3e16a (patch)
tree7bd2fff698c80813d1c48608445f1b73f858004c /sys
parent43210c51b3ac52f90290cb27c662db85c3ac6dcc (diff)
downloadFreeBSD-src-ea9d3c1b1e51a28d55859019f8468155dfc3e16a.zip
FreeBSD-src-ea9d3c1b1e51a28d55859019f8468155dfc3e16a.tar.gz
Apply the same patch as r196205 for nfs_upgrade_lock() and
nfs_downgrade_lock() to the experimental nfs client. Approved by: re (kensmith), kib (mentor)
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/nfsclient/nfs_clsubs.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/sys/fs/nfsclient/nfs_clsubs.c b/sys/fs/nfsclient/nfs_clsubs.c
index 7ae2860..a217a21 100644
--- a/sys/fs/nfsclient/nfs_clsubs.c
+++ b/sys/fs/nfsclient/nfs_clsubs.c
@@ -129,28 +129,25 @@ int
ncl_upgrade_vnlock(struct vnode *vp)
{
int old_lock;
-
- if ((old_lock = VOP_ISLOCKED(vp)) != LK_EXCLUSIVE) {
- if (old_lock == LK_SHARED) {
- /* Upgrade to exclusive lock, this might block */
- vn_lock(vp, LK_UPGRADE | LK_RETRY);
- } else {
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- }
+
+ ASSERT_VOP_LOCKED(vp, "ncl_upgrade_vnlock");
+ old_lock = VOP_ISLOCKED(vp);
+ if (old_lock != LK_EXCLUSIVE) {
+ KASSERT(old_lock == LK_SHARED,
+ ("ncl_upgrade_vnlock: wrong old_lock %d", old_lock));
+ /* Upgrade to exclusive lock, this might block */
+ vn_lock(vp, LK_UPGRADE | LK_RETRY);
}
- return old_lock;
+ return (old_lock);
}
void
ncl_downgrade_vnlock(struct vnode *vp, int old_lock)
{
if (old_lock != LK_EXCLUSIVE) {
- if (old_lock == LK_SHARED) {
- /* Downgrade from exclusive lock, this might block */
- vn_lock(vp, LK_DOWNGRADE);
- } else {
- VOP_UNLOCK(vp, 0);
- }
+ KASSERT(old_lock == LK_SHARED, ("wrong old_lock %d", old_lock));
+ /* Downgrade from exclusive lock. */
+ vn_lock(vp, LK_DOWNGRADE | LK_RETRY);
}
}
OpenPOWER on IntegriCloud