aboutsummaryrefslogtreecommitdiff
path: root/sys/cam
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2015-10-08 07:34:30 +0000
committerAlexander Motin <mav@FreeBSD.org>2015-10-08 07:34:30 +0000
commit3d5cb709bdbbdc0370ebb1d0932da00b019e92f4 (patch)
treeda1f5944f401f311c9fa10b119638c22adcd8e45 /sys/cam
parentfbcf1662deedc05501655a20b8e762868b742653 (diff)
downloadsrc-3d5cb709bdbbdc0370ebb1d0932da00b019e92f4.tar.gz
src-3d5cb709bdbbdc0370ebb1d0932da00b019e92f4.zip
Add missing vnode lock in case of file modify request.
Submitted by: Richard Kojedzinszky MFC after: 1 week
Notes
Notes: svn path=/head/; revision=289017
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/ctl/ctl_backend_block.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c
index 40a0c796927c..2930fbd66285 100644
--- a/sys/cam/ctl/ctl_backend_block.c
+++ b/sys/cam/ctl/ctl_backend_block.c
@@ -2623,9 +2623,11 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
error = ctl_be_block_open(be_lun, req);
else if (vn_isdisk(be_lun->vn, &error))
error = ctl_be_block_open_dev(be_lun, req);
- else if (be_lun->vn->v_type == VREG)
+ else if (be_lun->vn->v_type == VREG) {
+ vn_lock(be_lun->vn, LK_SHARED | LK_RETRY);
error = ctl_be_block_open_file(be_lun, req);
- else
+ VOP_UNLOCK(be_lun->vn, 0);
+ } else
error = EINVAL;
if ((cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) &&
be_lun->vn != NULL) {