extattr_list_vp: Narrow locked section somewhat
Suggested by: mjg Reviewed by: kib, mjg Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D19083
This commit is contained in:
parent
c3eb848ce3
commit
e682df5397
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343762
@ -633,8 +633,6 @@ extattr_list_vp(struct vnode *vp, int attrnamespace, void *data,
|
||||
if (nbytes > IOSIZE_MAX)
|
||||
return (EINVAL);
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
|
||||
auiop = NULL;
|
||||
sizep = NULL;
|
||||
cnt = 0;
|
||||
@ -653,24 +651,25 @@ extattr_list_vp(struct vnode *vp, int attrnamespace, void *data,
|
||||
} else
|
||||
sizep = &size;
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
|
||||
#ifdef MAC
|
||||
error = mac_vnode_check_listextattr(td->td_ucred, vp, attrnamespace);
|
||||
if (error)
|
||||
goto done;
|
||||
if (error) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
|
||||
error = VOP_LISTEXTATTR(vp, attrnamespace, auiop, sizep,
|
||||
td->td_ucred, td);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
|
||||
if (auiop != NULL) {
|
||||
cnt -= auio.uio_resid;
|
||||
td->td_retval[0] = cnt;
|
||||
} else
|
||||
td->td_retval[0] = size;
|
||||
#ifdef MAC
|
||||
done:
|
||||
#endif
|
||||
VOP_UNLOCK(vp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user