diff options
author | mav <mav@FreeBSD.org> | 2015-10-15 08:49:52 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-10-15 08:49:52 +0000 |
commit | 2cefe1a092b6157bf7a651c3fe9e5b8f2465a6d2 (patch) | |
tree | a64da663ca0beee54431fd6b6a317d049c14a03a | |
parent | 0efbd96e26075129d17edf3ef78d44b62740361b (diff) | |
download | FreeBSD-src-2cefe1a092b6157bf7a651c3fe9e5b8f2465a6d2.zip FreeBSD-src-2cefe1a092b6157bf7a651c3fe9e5b8f2465a6d2.tar.gz |
MFC r289017: Add missing vnode lock in case of file modify request.
Submitted by: Richard Kojedzinszky
-rw-r--r-- | sys/cam/ctl/ctl_backend_block.c | 6 |
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 7e0dc74..eed451f 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -2637,9 +2637,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) { |