changeset 4339:24b45a78e29e

6561733 ZFS znode z_sync_cnt field is miscounted
author perrin
date Tue, 29 May 2007 09:36:44 -0700
parents 7e63f9575e99
children 3c0d0e161a41
files usr/src/uts/common/fs/zfs/zfs_vnops.c
diffstat 1 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/zfs_vnops.c	Tue May 29 09:35:41 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c	Tue May 29 09:36:44 2007 -0700
@@ -176,7 +176,7 @@
 	znode_t	*zp = VTOZ(vp);
 
 	/* Decrement the synchronous opens in the znode */
-	if (flag & (FSYNC | FDSYNC))
+	if ((flag & (FSYNC | FDSYNC)) && (count == 1))
 		atomic_dec_32(&zp->z_sync_cnt);
 
 	/*
@@ -241,19 +241,19 @@
 	zfsvfs_t *zfsvfs;
 
 	switch (com) {
-	    case _FIOFFS:
+	case _FIOFFS:
 		return (zfs_sync(vp->v_vfsp, 0, cred));
 
 		/*
 		 * The following two ioctls are used by bfu.  Faking out,
 		 * necessary to avoid bfu errors.
 		 */
-	    case _FIOGDIO:
-	    case _FIOSDIO:
+	case _FIOGDIO:
+	case _FIOSDIO:
 		return (0);
 
-	    case _FIO_SEEK_DATA:
-	    case _FIO_SEEK_HOLE:
+	case _FIO_SEEK_DATA:
+	case _FIO_SEEK_HOLE:
 		if (ddi_copyin((void *)data, &off, sizeof (off), flag))
 			return (EFAULT);
 
@@ -737,7 +737,7 @@
 		    secpolicy_vnode_setid_retain(cr,
 		    (zp->z_phys->zp_mode & S_ISUID) != 0 &&
 		    zp->z_phys->zp_uid == 0) != 0) {
-			    zp->z_phys->zp_mode &= ~(S_ISUID | S_ISGID);
+			zp->z_phys->zp_mode &= ~(S_ISUID | S_ISGID);
 		}
 		mutex_exit(&zp->z_acl_lock);
 
@@ -2946,11 +2946,10 @@
 	for (io_off = off; io_off < off + len; io_off += io_len) {
 		if ((flags & B_INVAL) || ((flags & B_ASYNC) == 0)) {
 			pp = page_lookup(vp, io_off,
-				(flags & (B_INVAL | B_FREE)) ?
-					SE_EXCL : SE_SHARED);
+			    (flags & (B_INVAL | B_FREE)) ? SE_EXCL : SE_SHARED);
 		} else {
 			pp = page_lookup_nowait(vp, io_off,
-				(flags & B_FREE) ? SE_EXCL : SE_SHARED);
+			    (flags & B_FREE) ? SE_EXCL : SE_SHARED);
 		}
 
 		if (pp != NULL && pvn_getdirty(pp, flags)) {
@@ -3136,7 +3135,7 @@
 		ASSERT3U(off, >=, koff);
 		ASSERT3U(off, <, koff + klen);
 		pp = pvn_read_kluster(vp, off, seg, addr, &io_off,
-			    &io_len, koff, klen, 0);
+		    &io_len, koff, klen, 0);
 	}
 	if (pp == NULL) {
 		/*