changeset 13960:800b7743c4f3

3515 sd gives RMW warnings for reads Reviewed by: Albert Lee <trisk@nexenta.com> Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com> Reviewed by: Gordon Ross <gordon.ross@nexenta.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Richard Lowe <richlowe@richlowe.net>
author Hans Rosenfeld <hans.rosenfeld@nexenta.com>
date Tue, 19 Feb 2013 09:16:46 -0500
parents e03e14ddfb4c
children d4092a41420b
files usr/src/uts/common/io/scsi/targets/sd.c
diffstat 1 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/scsi/targets/sd.c	Tue Feb 19 14:15:41 2013 -0800
+++ b/usr/src/uts/common/io/scsi/targets/sd.c	Tue Feb 19 09:16:46 2013 -0500
@@ -23,9 +23,9 @@
  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2011 Bayard G. Bell.  All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 /*
  * Copyright 2011 cyril.galibern@opensvc.com
@@ -12647,16 +12647,17 @@
 		if (is_aligned) {
 			xp->xb_blkno = SD_SYS2TGTBLOCK(un, xp->xb_blkno);
 		} else {
-			switch (un->un_f_rmw_type) {
-			case SD_RMW_TYPE_RETURN_ERROR:
-				if (un->un_f_enable_rmw)
-					break;
-				else {
-					bp->b_flags |= B_ERROR;
-					goto error_exit;
-				}
-
-			case SD_RMW_TYPE_DEFAULT:
+			/*
+			 * There is no RMW if we're just reading, so don't
+			 * warn or error out because of it.
+			 */
+			if (bp->b_flags & B_READ) {
+				/*EMPTY*/
+			} else if (!un->un_f_enable_rmw &&
+			    un->un_f_rmw_type == SD_RMW_TYPE_RETURN_ERROR) {
+				bp->b_flags |= B_ERROR;
+				goto error_exit;
+			} else if (un->un_f_rmw_type == SD_RMW_TYPE_DEFAULT) {
 				mutex_enter(SD_MUTEX(un));
 				if (!un->un_f_enable_rmw &&
 				    un->un_rmw_msg_timeid == NULL) {
@@ -12674,11 +12675,6 @@
 					un->un_rmw_incre_count ++;
 				}
 				mutex_exit(SD_MUTEX(un));
-				break;
-
-			case SD_RMW_TYPE_NO_WARNING:
-			default:
-				break;
 			}
 
 			nblocks = SD_TGT2SYSBLOCK(un, nblocks);