while playing around with ZFS and USB memory sticks or USB harddisks,
rmvolmgr tends to get in the way, which results in a

  can't open "/dev/rdsk/cNt0d0p0", device busy

Do you remember exactly what command/operation resulted in this error? It is something that tries to open device exclusively.

So far, I've just said svcadm disable -t rmvolmgr, did my thing, then
said svcadm enable rmvolmgr.

This can't possibly be true, because rmvolmgr does not open devices. You'd need to also disable the 'hal' service. Run fuser on your device and you'll see it's one of the hal addons that keeps it open:

# ptree | grep hal
114531 /usr/lib/hal/hald --daemon=yes
  114532 hald-runner
    114537 /usr/lib/hal/hald-addon-storage
    114540 /usr/lib/hal/hald-addon-storage
    114558 /usr/lib/hal/hald-addon-storage
# fuser /dev/rdsk/c2t0d0
/dev/rdsk/c2t0d0:   114558o
# truss -p 114558
ioctl(4, 0x040D, 0x08047708)    (sleeping...)
^C# grep 'DKIOC|13' /usr/include/sys/dkio.h
#define DKIOCSTATE      (DKIOC|13)      /* Inquire insert/eject state */

HAL needs to know when a disk is hot-removed (even while opened by other processes/filesystems) and DKIOCSTATE is the Solaris way of achieving that.

Is there a more elegant approach that tells rmvolmgr to leave certain
devices alone on a per disk basis?

For instance, I'm now running several USB disks with ZFS pools on them, and
even after restarting rmvolmgr or rebooting, ZFS, the disks and rmvolmgr
get along with each other just fine.

I'm confused here. In the beginning you said that something got in the way, but now you're saying they get along just fine. Could you clarify.

What and how does ZFS tell rmvolmgr that a particular set of disks belongs
to ZFS and should not be treated as removable?

One possible workaround would be to match against USB disk's serial number and tell hal to ignore it using fdi(4) file. For instance, find your USB disk in lshal(1M) output, it will look like this:

udi = '/org/freedesktop/Hal/devices/pci_0_0/pci1028_12c_1d_7/storage_5_0'
  usb_device.serial = 'DEF1061F7B62'  (string)
  usb_device.product_id = 26672  (0x6830)  (int)
  usb_device.vendor_id = 1204  (0x4b4)  (int)
  usb_device.vendor = 'Cypress Semiconductor'  (string)
  usb_device.product = 'USB2.0 Storage Device'  (string)
  info.bus = 'usb_device'  (string)
  info.solaris.driver = 'scsa2usb'  (string)
  solaris.devfs_path = '/[EMAIL PROTECTED],0/pci1028,[EMAIL PROTECTED],7/[EMAIL 
PROTECTED]'  (string)

You want to match an object with this usb_device.serial property and set info.ignore property to true. The fdi(4) would look like this:

# cat > /etc/hal/fdi/preprobe/30user/10-ignore-usb.fdi
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
  <device>
    <match key="usb_device.serial" string="DEF1061F7B62">
      <merge key="info.ignore" type="bool">true</merge>
    </match>
  </device>
</deviceinfo>

Once the fdi is in place, 'svcadm restart hal' to enable it.

Eventually we'll need better interaction between HAL and ZFS.

-Artem.

_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to