Use vnode lock assertion expression, and upgrade it to assert the

required exclusive state of the vnode lock in tmpfs chflags, chmod,
chown, chsize, chtimes operations.

Fix nearby style.

Reviewed by:	mjg
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2017-01-06 17:32:44 +00:00
parent 9a4d5dbbac
commit 305b422966

View file

@ -1462,7 +1462,7 @@ tmpfs_chflags(struct vnode *vp, u_long flags, struct ucred *cred,
int error;
struct tmpfs_node *node;
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chflags");
node = VP_TO_TMPFS_NODE(vp);
@ -1502,9 +1502,9 @@ tmpfs_chflags(struct vnode *vp, u_long flags, struct ucred *cred,
node->tn_flags = flags;
node->tn_status |= TMPFS_NODE_CHANGED;
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chflags2");
return 0;
return (0);
}
/*
@ -1518,7 +1518,7 @@ tmpfs_chmod(struct vnode *vp, mode_t mode, struct ucred *cred, struct thread *p)
int error;
struct tmpfs_node *node;
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chmod");
node = VP_TO_TMPFS_NODE(vp);
@ -1558,9 +1558,9 @@ tmpfs_chmod(struct vnode *vp, mode_t mode, struct ucred *cred, struct thread *p)
node->tn_status |= TMPFS_NODE_CHANGED;
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chmod2");
return 0;
return (0);
}
/*
@ -1579,7 +1579,7 @@ tmpfs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred,
uid_t ouid;
gid_t ogid;
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chown");
node = VP_TO_TMPFS_NODE(vp);
@ -1629,9 +1629,9 @@ tmpfs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred,
node->tn_mode &= ~(S_ISUID | S_ISGID);
}
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chown2");
return 0;
return (0);
}
/*
@ -1646,7 +1646,7 @@ tmpfs_chsize(struct vnode *vp, u_quad_t size, struct ucred *cred,
int error;
struct tmpfs_node *node;
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chsize");
node = VP_TO_TMPFS_NODE(vp);
@ -1684,9 +1684,9 @@ tmpfs_chsize(struct vnode *vp, u_quad_t size, struct ucred *cred,
/* tmpfs_truncate will raise the NOTE_EXTEND and NOTE_ATTRIB kevents
* for us, as will update tn_status; no need to do that here. */
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chsize2");
return error;
return (error);
}
/*
@ -1701,7 +1701,7 @@ tmpfs_chtimes(struct vnode *vp, struct vattr *vap,
int error;
struct tmpfs_node *node;
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chtimes");
node = VP_TO_TMPFS_NODE(vp);
@ -1730,9 +1730,9 @@ tmpfs_chtimes(struct vnode *vp, struct vattr *vap,
if (vap->va_birthtime.tv_sec != VNOVAL)
node->tn_birthtime = vap->va_birthtime;
MPASS(VOP_ISLOCKED(vp));
ASSERT_VOP_ELOCKED(vp, "chtimes2");
return 0;
return (0);
}
/* Sync timestamps */