Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Oct 2015 07:34:30 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289017 - head/sys/cam/ctl
Message-ID:  <201510080734.t987YU6v054812@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Oct  8 07:34:30 2015
New Revision: 289017
URL: https://svnweb.freebsd.org/changeset/base/289017

Log:
  Add missing vnode lock in case of file modify request.
  
  Submitted by:	Richard Kojedzinszky
  MFC after:	1 week

Modified:
  head/sys/cam/ctl/ctl_backend_block.c

Modified: head/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_block.c	Thu Oct  8 07:31:05 2015	(r289016)
+++ head/sys/cam/ctl/ctl_backend_block.c	Thu Oct  8 07:34:30 2015	(r289017)
@@ -2623,9 +2623,11 @@ ctl_be_block_modify(struct ctl_be_block_
 			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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510080734.t987YU6v054812>