o Lock vnode before calling extattr_* VOP's, and modify vnode spec to
allow for that. o Remember to call NDFREE() if exiting as a result of a failed vn_start_write() when snapshotting. Reviewed by: mckusick Obtained from: TrustedBSD Project
This commit is contained in:
parent
7333848d98
commit
3ce7b7aa84
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=63893
@ -3548,11 +3548,14 @@ extattr_set_file(p, uap)
|
||||
error = copyin(SCARG(uap, attrname), attrname, EXTATTR_MAXNAMELEN);
|
||||
if (error)
|
||||
return (error);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
|
||||
SCARG(uap, path), p);
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return(error);
|
||||
if ((error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH)) != 0)
|
||||
goto done;
|
||||
if ((error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
NDFREE(&nd, 0);
|
||||
return (error);
|
||||
}
|
||||
iovlen = uap->iovcnt * sizeof(struct iovec);
|
||||
if (uap->iovcnt > UIO_SMALLIOV) {
|
||||
if (uap->iovcnt > UIO_MAXIOV) {
|
||||
@ -3617,7 +3620,8 @@ extattr_get_file(p, uap)
|
||||
error = copyin(SCARG(uap, attrname), attrname, EXTATTR_MAXNAMELEN);
|
||||
if (error)
|
||||
return (error);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
|
||||
SCARG(uap, path), p);
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return (error);
|
||||
iovlen = uap->iovcnt * sizeof (struct iovec);
|
||||
@ -3681,11 +3685,12 @@ extattr_delete_file(p, uap)
|
||||
error = copyin(SCARG(uap, attrname), attrname, EXTATTR_MAXNAMELEN);
|
||||
if (error)
|
||||
return(error);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
|
||||
NDINIT(&nd, LOOKUP | LOCKLEAF, FOLLOW, UIO_USERSPACE,
|
||||
SCARG(uap, path), p);
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return(error);
|
||||
if ((error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
vrele(nd.ni_vp);
|
||||
NDFREE(&nd, 0);
|
||||
return (error);
|
||||
}
|
||||
error = VOP_SETEXTATTR(nd.ni_vp, attrname, NULL, p->p_cred->pc_ucred,
|
||||
|
@ -3548,11 +3548,14 @@ extattr_set_file(p, uap)
|
||||
error = copyin(SCARG(uap, attrname), attrname, EXTATTR_MAXNAMELEN);
|
||||
if (error)
|
||||
return (error);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
|
||||
SCARG(uap, path), p);
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return(error);
|
||||
if ((error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH)) != 0)
|
||||
goto done;
|
||||
if ((error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
NDFREE(&nd, 0);
|
||||
return (error);
|
||||
}
|
||||
iovlen = uap->iovcnt * sizeof(struct iovec);
|
||||
if (uap->iovcnt > UIO_SMALLIOV) {
|
||||
if (uap->iovcnt > UIO_MAXIOV) {
|
||||
@ -3617,7 +3620,8 @@ extattr_get_file(p, uap)
|
||||
error = copyin(SCARG(uap, attrname), attrname, EXTATTR_MAXNAMELEN);
|
||||
if (error)
|
||||
return (error);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
|
||||
SCARG(uap, path), p);
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return (error);
|
||||
iovlen = uap->iovcnt * sizeof (struct iovec);
|
||||
@ -3681,11 +3685,12 @@ extattr_delete_file(p, uap)
|
||||
error = copyin(SCARG(uap, attrname), attrname, EXTATTR_MAXNAMELEN);
|
||||
if (error)
|
||||
return(error);
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
|
||||
NDINIT(&nd, LOOKUP | LOCKLEAF, FOLLOW, UIO_USERSPACE,
|
||||
SCARG(uap, path), p);
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return(error);
|
||||
if ((error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH)) != 0) {
|
||||
vrele(nd.ni_vp);
|
||||
NDFREE(&nd, 0);
|
||||
return (error);
|
||||
}
|
||||
error = VOP_SETEXTATTR(nd.ni_vp, attrname, NULL, p->p_cred->pc_ucred,
|
||||
|
@ -535,7 +535,7 @@ vop_aclcheck {
|
||||
};
|
||||
|
||||
#
|
||||
#% getextattr vp = = =
|
||||
#% getextattr vp L L L
|
||||
#
|
||||
vop_getextattr {
|
||||
IN struct vnode *vp;
|
||||
|
Loading…
Reference in New Issue
Block a user