summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_vnops.c
diff options
context:
space:
mode:
authorcsjp <csjp@FreeBSD.org>2005-02-24 00:13:16 +0000
committercsjp <csjp@FreeBSD.org>2005-02-24 00:13:16 +0000
commit66182a4e8a3d95c2abbf4632c7480330b13fd340 (patch)
treeb7720e8e47ddf0c1aa93bb1931b598fa7f8461e9 /sys/kern/vfs_vnops.c
parenta8e1a0bef71f90c8abd8691bef00248d6f5668f4 (diff)
downloadFreeBSD-src-66182a4e8a3d95c2abbf4632c7480330b13fd340.zip
FreeBSD-src-66182a4e8a3d95c2abbf4632c7480330b13fd340.tar.gz
Add locking assertions into vn_extattr_set, vn_extattr_get and
vn_extattr_rm. This is meant to catch conditions where IO_NODELOCKED has been specified without the vnode being locked. Discussed with: rwatson MFC after: 1 week
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r--sys/kern/vfs_vnops.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 718d4e0..5c92ba8 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1080,6 +1080,8 @@ vn_extattr_get(struct vnode *vp, int ioflg, int attrnamespace,
if ((ioflg & IO_NODELOCKED) == 0)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ ASSERT_VOP_LOCKED(vp, "IO_NODELOCKED with no vp lock held");
+
/* authorize attribute retrieval as kernel */
error = VOP_GETEXTATTR(vp, attrnamespace, attrname, &auio, NULL, NULL,
td);
@@ -1123,6 +1125,8 @@ vn_extattr_set(struct vnode *vp, int ioflg, int attrnamespace,
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
}
+ ASSERT_VOP_LOCKED(vp, "IO_NODELOCKED with no vp lock held");
+
/* authorize attribute setting as kernel */
error = VOP_SETEXTATTR(vp, attrnamespace, attrname, &auio, NULL, td);
@@ -1147,6 +1151,8 @@ vn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace,
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
}
+ ASSERT_VOP_LOCKED(vp, "IO_NODELOCKED with no vp lock held");
+
/* authorize attribute removal as kernel */
error = VOP_DELETEEXTATTR(vp, attrnamespace, attrname, NULL, td);
if (error == EOPNOTSUPP)
OpenPOWER on IntegriCloud