From ede49bd0860bd92a1245e4c79934e5cc1be7ac07 Mon Sep 17 00:00:00 2001
From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Thu, 28 Jan 2010 20:05:33 +0000
Subject: [PATCH] Merge r3051, r3052 into 5.39.1.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/branches/RELEASE_5_39_BRANCH@3053 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/CHANGELOG    | 6 +++++-
 smartmontools/NEWS         | 2 ++
 smartmontools/os_linux.cpp | 4 +++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG
index b9e641bca..bab751f2f 100644
--- a/smartmontools/CHANGELOG
+++ b/smartmontools/CHANGELOG
@@ -43,8 +43,12 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Linux: Fix spin-up of SATA drive if '-n standby' is used
+       (ticket #37).  For some reason, this happens if the SCSI/SAT
+       device is opened with O_RDWR instead of O_RDONLY.
+
   [CF] Windows: Fix parsing of 'tw_cli' output for 3ware 9.5.x release
-       (ticket #43.)
+       (ticket #43).
 
   [CF] Linux: Allow smartd 'DEVICESCAN -d sat' (ticket #13).
        Detects (S)ATA devices behind a standard SAT layer
diff --git a/smartmontools/NEWS b/smartmontools/NEWS
index 3a95148fd..ad720f2b5 100644
--- a/smartmontools/NEWS
+++ b/smartmontools/NEWS
@@ -12,6 +12,8 @@ Summary: smartmontools release 5.39.1
 - Fix regression in smartctl option '-q, --quietmode'.
 - Fix regression in smartd directive '-l selftest'.
 - Linux: Allow smartd 'DEVICESCAN -d sat'.
+- Linux: Fix spin-up of SATA drive if '-n standby' is used.
+- Windows: Fix parsing of 3ware 'tw_cli' output.
 
 Date 2009-12-09
 Summary: smartmontools release 5.39 (UNSTABLE/EXPERIMENTAL)
diff --git a/smartmontools/os_linux.cpp b/smartmontools/os_linux.cpp
index 623ca3aa9..4c6bcba66 100644
--- a/smartmontools/os_linux.cpp
+++ b/smartmontools/os_linux.cpp
@@ -845,7 +845,9 @@ private:
 linux_scsi_device::linux_scsi_device(smart_interface * intf,
   const char * dev_name, const char * req_type, bool scanning /*= false*/)
 : smart_device(intf, dev_name, "scsi", req_type),
-  linux_smart_device(O_RDWR | O_NONBLOCK, O_RDONLY | O_NONBLOCK),
+  // If opened with O_RDWR, a SATA disk in standby mode
+  // may spin-up after device close().
+  linux_smart_device(O_RDONLY | O_NONBLOCK),
   m_scanning(scanning)
 {
 }
-- 
GitLab