Bug 138540 - sysutils/smartmontools
Summary: sysutils/smartmontools
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Alexander Logvinov
Depends on:
Reported: 2009-09-04 23:20 UTC by huntting
Modified: 2009-09-11 14:50 UTC (History)
0 users

See Also:

file.diff (1.53 KB, patch)
2009-09-04 23:20 UTC, huntting
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description huntting 2009-09-04 23:20:00 UTC
smartctl likes to read SMART data into 512 byte buffers which it allocates on the stack.  While this _should_ work just fine, I have found that sometimes, when using SATA over SAS (-d sat) with an MPT Fusion HBA, smartctl's buffer gets broken into 2 Scatter Gather Elements (probably because the 512 byte buffer stradles a page boundary).  Sometimes, only the first of these gets filled before the mpt driver records a timeout and subsequently resets the SAS bus.

I have not fully diagnosed the problem or had time to write a sample code'let that can reproduce it.  But in the mean time, this patch moves the data buffer from the stack to the heap where it will be aligned to avoid a page boundary.

Hopefully I will have time to diagnose the real problem and either fix it (if it's in the driver) or send in a bug report to LSI (if it's in the MPT controller).


Fix: Attached is a patch to the port that adds a patch that makes shure the data buffers used to read smart attributes and logs do not straddle page boundaries.

Patch attached with submission follows:
How-To-Repeat: pray.  Then on a 64bit system, with an 8gig LSI MPT SAS controler
           Mpi Version
or           FWVersion
connected to a SATA drive, turn on all available debugging in CAM and the MPT driver.

run smartctl -d sat -r ioctl -a /dev/da<foo>

sometimes, if you're 'lucky', you'll see a bus reset, and smartcl will fail to get some of it's SMART data.
Comment 1 Edwin Groothuis freebsd_committer 2009-09-04 23:20:12 UTC
Responsible Changed
From-To: freebsd-ports-bugs->marck

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Dmitry Morozovsky freebsd_committer 2009-09-05 08:29:35 UTC
Responsible Changed
From-To: marck->freebsd-ports-bugs

Looks ok, please commit (PORTREVISION bump required too).
Comment 3 Alexander Logvinov freebsd_committer 2009-09-10 09:15:02 UTC
Responsible Changed
From-To: freebsd-ports-bugs->avl

I'll take it.
Comment 4 dfilter service freebsd_committer 2009-09-11 14:42:14 UTC
avl         2009-09-11 13:41:59 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/smartmontools Makefile 
  Added files:
    sysutils/smartmontools/files patch-scsiata.cpp 
  - Add a patch that makes shure the data buffers used to read smart
    attributes and logs do not straddle page boundaries
  PR:             ports/138540
  Submitted by:   Brad Huntting <huntting AT glarp.com>
  Approved by:    tabthorpe, glarkin (mentors, implicit), marck (maintainer)
  Revision  Changes    Path
  1.43      +2 -2      ports/sysutils/smartmontools/Makefile
  1.1       +22 -0     ports/sysutils/smartmontools/files/patch-scsiata.cpp (new)
cvs-all@freebsd.org mailing list
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 Alexander Logvinov freebsd_committer 2009-09-11 14:42:37 UTC
State Changed
From-To: open->closed

Committed. Thanks!