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
This commit is contained in:
Christian S.J. Peron 2005-02-24 00:13:16 +00:00
parent aa2fe60500
commit cd13819433
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142348

View File

@ -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)