Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 May 2017 21:29:28 +0000 (UTC)
From:      "Kenneth D. Merry" <ken@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317854 - head/sbin/camcontrol
Message-ID:  <201705052129.v45LTSek067889@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ken
Date: Fri May  5 21:29:28 2017
New Revision: 317854
URL: https://svnweb.freebsd.org/changeset/base/317854

Log:
  When editing a mode page on a tape drive, do not clear the device
  specific parameter.
  
  Tape drives include write protect (WP), Buffered Mode and Speed
  settings in the device-specific parameter.  Clearing this
  parameter on a mode select can have the effect of turning off
  write protect or buffered mode, or changing the speed setting of
  the tape drive.
  
  Disks report DPO/FUA support via the device specific parameter
  for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
  clear this for disks (and other non-tape devices) to avoid
  potential errors from the target device.
  
  sbin/camcontrol/modeedit.c:
  	Clear the device-specific parameter in the mode page
  	header if we're not operating on a tape drive.
  
  MFC after:	3 days
  Sponsored by:	Spectra Logic

Modified:
  head/sbin/camcontrol/modeedit.c

Modified: head/sbin/camcontrol/modeedit.c
==============================================================================
--- head/sbin/camcontrol/modeedit.c	Fri May  5 20:45:55 2017	(r317853)
+++ head/sbin/camcontrol/modeedit.c	Fri May  5 21:29:28 2017	(r317854)
@@ -629,8 +629,21 @@ editlist_save(struct cam_device *device,
 
 	/* Recalculate headers & offsets. */
 	mh->data_length = 0;		/* Reserved for MODE SELECT command. */
-	mh->dev_spec = 0;		/* Clear device-specific parameters. */
 	mh->blk_desc_len = 0;		/* No block descriptors. */
+	/*
+	 * Tape drives include write protect (WP), Buffered Mode and Speed
+	 * settings in the device-specific parameter.  Clearing this
+	 * parameter on a mode select can have the effect of turning off
+	 * write protect or buffered mode, or changing the speed setting of
+	 * the tape drive.
+	 *
+	 * Disks report DPO/FUA support via the device specific parameter
+	 * for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
+	 * clear this for disks (and other non-tape devices) to avoid
+	 * potential errors from the target device.
+	 */
+	if (device->pd_type != T_SEQUENTIAL)
+		mh->dev_spec = 0;
 	mph = MODE_PAGE_HEADER(mh);
 	mph->page_code &= ~SMPH_PS;	/* Reserved for MODE SELECT command. */
 



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