svn commit: r273254 - in stable/10/sys: kern sys

Konstantin Belousov kib at FreeBSD.org
Sat Oct 18 15:28:03 UTC 2014


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 */


More information about the svn-src-stable mailing list