From owner-freebsd-scsi@FreeBSD.ORG Fri Jan 30 05:55:18 2015 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 386CC95C for ; Fri, 30 Jan 2015 05:55:18 +0000 (UTC) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com [IPv6:2607:f8b0:400e:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 09851619 for ; Fri, 30 Jan 2015 05:55:18 +0000 (UTC) Received: by mail-pa0-f52.google.com with SMTP id kx10so48165826pab.11 for ; Thu, 29 Jan 2015 21:55:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=7YSG4WD0GL1d3u4FihTk+bdql8QKqJ9DdqUZ00SM11Y=; b=sZydAJpjwzyA8bL+wkTKGJVK9Hmz2PFLEw5GeZpAwVoR/Yd4TZsLxZVd4QuOz1c16u hOcszMHzeMRlOcj8HV5IhV8bzwroMjzF+1iYE4QHw4hmBLG0zgOcDRnEbRNWWJrfoRFe PhnJ/Vi2eT9fMLRjT9EnjRmfmXlUu2V1QYbqykaX9lKpDwxwONarpiIQKdKYkGaV9aXl Ew7SYmBL10fCyc9d8+/496tH+t0rOEYt29NYRsybsGeWpGfPLvZ/efLwrXQOvfw/7HEa wMzsKRQAl8Ped7nCHOoHr98bwyfM62f1J5W0jvXYGZBZthZinJlfUCbN+V6lNIT/UsOd EWwg== MIME-Version: 1.0 X-Received: by 10.70.38.239 with SMTP id j15mr6330055pdk.115.1422597317648; Thu, 29 Jan 2015 21:55:17 -0800 (PST) Received: by 10.70.49.34 with HTTP; Thu, 29 Jan 2015 21:55:17 -0800 (PST) Date: Fri, 30 Jan 2015 13:55:17 +0800 Message-ID: Subject: bugfix: SA driver will unwind when close device even with SA_MODE_NOREWIND From: Peter Xu To: freebsd-scsi@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jan 2015 05:55:18 -0000 Hi, In BSD system, when tape devices are discovered, CAM will create specific /dev/saX.[0-3] automatically. Here when we does not the tape to auto rewind when closing the device, we should access /dev/saX.1 (which means we are using SA_MODE_NOREWIND mode). Found one bug that tape will auto rewind even accessing /dev/saX.1. diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 83b8345..55ee293 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -186,8 +186,8 @@ typedef enum { "\007NO_MODESEL" \ "\010NO_CPAGE" -#define SAMODE(z) (dev2unit(z) & 0x3) -#define SADENSITY(z) ((dev2unit(z) >> 2) & 0x3) +#define SAMODE(z) ((dev2unit(z) >> 2) & 0x3) +#define SADENSITY(z) (dev2unit(z) & 0x3) #define SA_IS_CTRL(z) (dev2unit(z) & (1 << 4)) #define SA_NOT_CTLDEV 0 Thanks. Peter