Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Oct 2014 15:28:02 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r273254 - in stable/10/sys: kern sys
Message-ID:  <201410181528.s9IFS23q099428@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Oct 18 15:28:01 2014
New Revision: 273254
URL: https://svnweb.freebsd.org/changeset/base/273254

Log:
  MFC r272534:
  Add IO_RANGELOCKED flag for vn_rdwr(9), which specifies that vnode is
  not locked, but range is.

Modified:
  stable/10/sys/kern/vfs_vnops.c
  stable/10/sys/sys/vnode.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_vnops.c
==============================================================================
--- stable/10/sys/kern/vfs_vnops.c	Sat Oct 18 15:18:31 2014	(r273253)
+++ stable/10/sys/kern/vfs_vnops.c	Sat Oct 18 15:28:01 2014	(r273254)
@@ -502,13 +502,16 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp
 	error = 0;
 
 	if ((ioflg & IO_NODELOCKED) == 0) {
-		if (rw == UIO_READ) {
-			rl_cookie = vn_rangelock_rlock(vp, offset,
-			    offset + len);
-		} else {
-			rl_cookie = vn_rangelock_wlock(vp, offset,
-			    offset + len);
-		}
+		if ((ioflg & IO_RANGELOCKED) == 0) {
+			if (rw == UIO_READ) {
+				rl_cookie = vn_rangelock_rlock(vp, offset,
+				    offset + len);
+			} else {
+				rl_cookie = vn_rangelock_wlock(vp, offset,
+				    offset + len);
+			}
+		} else
+			rl_cookie = NULL;
 		mp = NULL;
 		if (rw == UIO_WRITE) { 
 			if (vp->v_type != VCHR &&

Modified: stable/10/sys/sys/vnode.h
==============================================================================
--- stable/10/sys/sys/vnode.h	Sat Oct 18 15:18:31 2014	(r273253)
+++ stable/10/sys/sys/vnode.h	Sat Oct 18 15:28:01 2014	(r273254)
@@ -305,6 +305,7 @@ struct vattr {
 #define	IO_NORMAL	0x0800		/* operate on regular data */
 #define	IO_NOMACCHECK	0x1000		/* MAC checks unnecessary */
 #define	IO_BUFLOCKED	0x2000		/* ffs flag; indir buf is locked */
+#define	IO_RANGELOCKED	0x4000		/* range locked */
 
 #define IO_SEQMAX	0x7F		/* seq heuristic max value */
 #define IO_SEQSHIFT	16		/* seq heuristic in upper 16 bits */



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