tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ataraid(4) and VOP_OPENing the same block device




On Aug,Tuesday 26 2008, at 2:53 PM, Juan Romero Pardines wrote:

2008/8/26 Quentin Garnier <cube%cubidou.net@localhost>:

I don't think there is any need of opening the devices multiple times. The ataraid(4) driver should open all the necessary devices for all its
arrays, and then use them.  In your example, ataraid0 "owns" wd3 and
wd4, so why would it need to have them opened multiple times?

Perhaps I didn't explain this correctly before. In my example I got ataraid0 and (like you said) it owns the disks wd3 and wd4, but my problem is related
to the fact that ld0 owns the same VBLK vnode on the same devices than
ld1 wants to have access to... therefore once ld0 has taken (and locked) the vnode via VOP_OPEN, subsequents openings to the vnode are failing with EBUSY.

At least that's my understanding. I don't know if you are allowed to
bdevvp() on the same VBLK vnode either, but this call seems to succeed...
I'd assume it's allowed.

I think that it is not possible to VOP_OPEN block device more than once,
but you can open raw devices  as many times as you want.

In my device-mapper driver I created
struct pdev {
        struct vnode pdev_vnode;
        . . .
};

Which is in SLIST shared between all dm devices in system. When dm device is created I VOP_OPEN selected disk device and add it's vnode to pdev SLIST. When another dm device with same disk is created I search SLIST list for vnode return it. You can look at this code at haad-dm branch in sys/dev/dm/ dm_pdev.c.

You probably need to do the same in ld0, or you can use device-mapper to do it
for you and only write own target.

Regards

Adam.



Home | Main Index | Thread Index | Old Index