Bug 138540

Summary: sysutils/smartmontools
Product: Ports & Packages Reporter: huntting
Component: Individual Port(s)Assignee: Alexander Logvinov <avl>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

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).

thanx,
brad

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 1.5.20.0
             FWVersion 1.28.0.0
or           FWVersion 1.28.2.0
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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 
  Log:
  - 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
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 Alexander Logvinov freebsd_committer freebsd_triage 2009-09-11 14:42:37 UTC
State Changed
From-To: open->closed

Committed. Thanks!