some changes to xpt to help make unloading sim modules safer

Kenneth D. Merry ken at kdm.org
Tue Aug 9 19:39:53 UTC 2011


On Sun, Aug 07, 2011 at 14:27:14 -0700, Matthew Jacob wrote:
> 
> See http://people.freebsd.org/~mjacob/xpt_patches.txt
> 
> The first one come from a coworker (Chuck Tuffli) who found a hole 
> xpt_create_path_unlocked.

This looks fine.

> I added a few after that to guard against overrunning some counters so 
> that they would wrap.

Just out of curiosity, have you seen instances where the counters have
gone negative?

> It helped me find out what was going on much easier by adding the 
> function described here: 
> http://people.freebsd.org/~mjacob/xpt_path_counts.txt
> 
> Finally, http://people.freebsd.org/~mjacob/isp_patches.txt makes isp 
> safe for unload as a module.
> 
> There's some ambiguity over whether it's safe to unload when a periph is 
> open. Using xpt_path_counts to check with the bus reference count is > 3 
> for each scsibus attached to each isp sim is a way to avoid that.
> 
> Comments?

I would think you'd want to wait until the periph is closed, but perhaps
there is a way to get away with it if there aren't any commands outstanding
in the SIM.

You could send async notifications that all of the devices on the bus have
gone away, and then once everything disappears, you could finish the
unload.

Ken
-- 
Kenneth Merry
ken at kdm.org


More information about the freebsd-scsi mailing list