[Patch] camcontrol - determine the defect list length

Scott Long scottl at samsco.org
Tue Oct 26 05:22:14 UTC 2010


On Oct 25, 2010, at 9:55 AM, Mark Johnston wrote:

> Hi,
> 
> Below is a patch for camcontrol from the tree at my work. It was introduced several years ago to resolve some issues that we were seeing in Adaptec's RAID controller firmware. The change is to the readdefects() function - when sending the request to read the defect list, instead of using a 65000-entry buffer, we wrote a new function to query the drive and determine the size of the defect list before allocating any memory. Apparently, if we send a maximum length longer than the number of bytes in the defect list, the cam call returns an overflow error due to what is probably a firmware bug.
> 
> It's probable that this issue has been fixed in Adaptec's firmware for a while now, and that this change is no longer necessary to us. However, it's conceivable that other devices could have the same problem, and as far as I can see, this patch shouldn't introduce any regressions - it essentially consists of sending an additional CAM request before getting the defect list.
> 
> I'd like to know whether this patch is worth trying to get committed into FreeBSD. If anyone has some comments or suggestions on the patch, I'd highly appreciate it.
> 

Should the whole operation of reading the defect list abort if readdefectlen() fails, or should it just fall back to a modest length and try the operation anyways?  Also, if readdefectlen() succeeds, how do the defect_list and ccb get freed?

Scott




More information about the freebsd-scsi mailing list