Share-lock a vnode where possible.
This commit is contained in:
parent
5bec66402b
commit
57504dcfaf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169199
@ -123,7 +123,7 @@ kobj_get_filesize_vnode(struct _buf *file, uint64_t *size)
|
||||
struct vattr va;
|
||||
int error;
|
||||
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY, td);
|
||||
error = VOP_GETATTR(vp, &va, td->td_ucred, td);
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
if (error == 0)
|
||||
@ -176,7 +176,7 @@ kobj_read_file_vnode(struct _buf *file, char *buf, unsigned size, unsigned off)
|
||||
auio.uio_resid = size;
|
||||
auio.uio_td = td;
|
||||
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY, td);
|
||||
error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
return (error != 0 ? -1 : size - auio.uio_resid);
|
||||
|
@ -187,7 +187,7 @@ domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath,
|
||||
/*
|
||||
* Allocate and initialize the filesystem.
|
||||
*/
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY, td);
|
||||
mp = vfs_mount_alloc(vp, vfsp, fspath, td);
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
|
||||
|
@ -934,7 +934,7 @@ zfsctl_traverse_begin(vnode_t **vpp, kthread_t *td)
|
||||
return (ENOENT);
|
||||
err = traverse(vpp);
|
||||
if (err == 0)
|
||||
vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
vn_lock(*vpp, LK_SHARED | LK_RETRY, td);
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ kobj_get_filesize_vnode(struct _buf *file, uint64_t *size)
|
||||
struct vattr va;
|
||||
int error;
|
||||
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY, td);
|
||||
error = VOP_GETATTR(vp, &va, td->td_ucred, td);
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
if (error == 0)
|
||||
@ -176,7 +176,7 @@ kobj_read_file_vnode(struct _buf *file, char *buf, unsigned size, unsigned off)
|
||||
auio.uio_resid = size;
|
||||
auio.uio_td = td;
|
||||
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY, td);
|
||||
error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
return (error != 0 ? -1 : size - auio.uio_resid);
|
||||
|
@ -187,7 +187,7 @@ domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath,
|
||||
/*
|
||||
* Allocate and initialize the filesystem.
|
||||
*/
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY, td);
|
||||
mp = vfs_mount_alloc(vp, vfsp, fspath, td);
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
|
||||
|
@ -934,7 +934,7 @@ zfsctl_traverse_begin(vnode_t **vpp, kthread_t *td)
|
||||
return (ENOENT);
|
||||
err = traverse(vpp);
|
||||
if (err == 0)
|
||||
vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
vn_lock(*vpp, LK_SHARED | LK_RETRY, td);
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user