Date: Mon, 17 Aug 2009 16:12:29 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r196332 - head/sys/fs/nfsclient Message-ID: <200908171612.n7HGCTIL083163@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Mon Aug 17 16:12:28 2009 New Revision: 196332 URL: http://svn.freebsd.org/changeset/base/196332 Log: 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) Modified: head/sys/fs/nfsclient/nfs_clsubs.c Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Mon Aug 17 15:51:31 2009 (r196331) +++ head/sys/fs/nfsclient/nfs_clsubs.c Mon Aug 17 16:12:28 2009 (r196332) @@ -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); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908171612.n7HGCTIL083163>