Brian Buhrow | 7 Jun 2012 01:54

Enabling wedge autodiscovery on vnd disks

	hello.  In researching a recent bug under NetBSD-5, I discovered the
desire to make wedges work with vnd disks.  While the ability for these
devices to deal with wedge ioctls was added by riz some time ago, the
ability to have wedges autodiscovered when the vnd is configured was not.
The below patch does this.  If a gpt disk partition is defined on the vnd
file when the vnd is configured, then it will be attached to the dk driver.
For example, 
if I do:
vnconfig -c vnd0 testfs
Then I see the following from the kernel:
vnd0: GPT GUID: ea0f421c-b028-11e1-8bf0-00c04f140374
dk0 at vnd0: ea0f42bc-b028-11e1-8bf0-00c04f140374
dk0: 202685 blocks at 34, type: ffs

If I then unconfigure the vnd, I see:
dk0 at vnd0 (ea0f42bc-b028-11e1-8bf0-00c04f140374) deleted

	If there is no gpt partition on a vnd file, then behavior of the vnd
is as it was before this change.  When the dk driver is active, only the
raw partition of the vnd is accessible.

Is there any reason I shouldn't commit this change?  Would folks  be
interested in pullups to the NetBSD-6 and NetBSD-5 branches?
-thanks
-Brian

Index: vnd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/vnd.c,v
retrieving revision 1.220
(Continue reading)

Michael van Elst | 7 Jun 2012 07:47
Picon

Re: Enabling wedge autodiscovery on vnd disks

buhrow <at> lothlorien.nfbcal.org (Brian Buhrow) writes:

Hello Brian,

>	hello.  In researching a recent bug under NetBSD-5, I discovered the
>desire to make wedges work with vnd disks.  While the ability for these
>devices to deal with wedge ioctls was added by riz some time ago, the
>ability to have wedges autodiscovered when the vnd is configured was not.
>The below patch does this.  If a gpt disk partition is defined on the vnd
>file when the vnd is configured, then it will be attached to the dk driver.

wedges and disklabels are orthogonal. The vnd driver should do
what the other disk drivers do:

dkwedge_discover on attach
fail open other than raw partition with EBUSY when wedges exist
getdisklabel on open
dkwedge_delall on detach

For vnd the 'attach' operation is VNDIOCSET and the 'detach'
operation is VNDIOCCLR.

-- 
--

-- 
                                Michael van Elst
Internet: mlelstv <at> serpens.de
                                "A potential Snark may lurk in every tree."

Brian Buhrow | 7 Jun 2012 08:06

Re: Enabling wedge autodiscovery on vnd disks

	Hello.  Sorry I wasn't clear.  The patch I sent to the mailing list
does all the things you outline causing the vnd disk driver to now behave
comparably to other disk drivers.  I take it you're in favor of committing
the patch.
-thanks
-Brian

On Jun 7,  5:47am, Michael van Elst wrote:
} Subject: Re: Enabling wedge autodiscovery on vnd disks
} buhrow <at> lothlorien.nfbcal.org (Brian Buhrow) writes:
} 
} Hello Brian,
} 
} >	hello.  In researching a recent bug under NetBSD-5, I discovered the
} >desire to make wedges work with vnd disks.  While the ability for these
} >devices to deal with wedge ioctls was added by riz some time ago, the
} >ability to have wedges autodiscovered when the vnd is configured was not.
} >The below patch does this.  If a gpt disk partition is defined on the vnd
} >file when the vnd is configured, then it will be attached to the dk driver.
} 
} wedges and disklabels are orthogonal. The vnd driver should do
} what the other disk drivers do:
} 
} dkwedge_discover on attach
} fail open other than raw partition with EBUSY when wedges exist
} getdisklabel on open
} dkwedge_delall on detach
} 
} For vnd the 'attach' operation is VNDIOCSET and the 'detach'
} operation is VNDIOCCLR.
(Continue reading)

Michael van Elst | 7 Jun 2012 08:13
Picon

Re: Enabling wedge autodiscovery on vnd disks

buhrow <at> lothlorien.nfbcal.org (Brian Buhrow) writes:

>	Hello.  Sorry I wasn't clear.  The patch I sent to the mailing list
>does all the things you outline causing the vnd disk driver to now behave
>comparably to other disk drivers.  I take it you're in favor of committing
>the patch.

I'm in favour for this functionality, but I don't think your patch
is right.

Greetings,
-- 
--

-- 
                                Michael van Elst
Internet: mlelstv <at> serpens.de
                                "A potential Snark may lurk in every tree."

Brian Buhrow | 7 Jun 2012 08:32

Re: Enabling wedge autodiscovery on vnd disks

	Hello.  Ok. Would you mind elaborating on what you believe is wrong
about the patch?  I'm happy to fix it if you have feedback.
-thanks
-Brian

On Jun 7,  6:13am, Michael van Elst wrote:
} Subject: Re: Enabling wedge autodiscovery on vnd disks
} buhrow <at> lothlorien.nfbcal.org (Brian Buhrow) writes:
} 
} >	Hello.  Sorry I wasn't clear.  The patch I sent to the mailing list
} >does all the things you outline causing the vnd disk driver to now behave
} >comparably to other disk drivers.  I take it you're in favor of committing
} >the patch.
} 
} I'm in favour for this functionality, but I don't think your patch
} is right.
} 
} Greetings,
} -- 
} -- 
}                                 Michael van Elst
} Internet: mlelstv <at> serpens.de
}                                 "A potential Snark may lurk in every tree."
>-- End of excerpt from Michael van Elst

Michael van Elst | 7 Jun 2012 11:38
Picon

Re: Enabling wedge autodiscovery on vnd disks

buhrow <at> lothlorien.nfbcal.org (Brian Buhrow) writes:

>	Hello.  Ok. Would you mind elaborating on what you believe is wrong
>about the patch?  I'm happy to fix it if you have feedback.

The wedge handling has to go into the correct paths (attach/detach/open...).
I see that this isn't easy with vnd, because it does some weird handling
of the disklabel. Let me try to align this more with other disk drivers.

Greetings,
Michael

>-thanks
>-Brian

>On Jun 7,  6:13am, Michael van Elst wrote:
>} Subject: Re: Enabling wedge autodiscovery on vnd disks
>} buhrow <at> lothlorien.nfbcal.org (Brian Buhrow) writes:
>} 
>} >	Hello.  Sorry I wasn't clear.  The patch I sent to the mailing list
>} >does all the things you outline causing the vnd disk driver to now behave
>} >comparably to other disk drivers.  I take it you're in favor of committing
>} >the patch.
>} 
>} I'm in favour for this functionality, but I don't think your patch
>} is right.
>} 
>} Greetings,
>} -- 
>} -- 
(Continue reading)

Michael van Elst | 7 Jun 2012 13:19
Picon

Re: Enabling wedge autodiscovery on vnd disks

mlelstv <at> serpens.de (Michael van Elst) writes:

>The wedge handling has to go into the correct paths (attach/detach/open...).
>I see that this isn't easy with vnd, because it does some weird handling
>of the disklabel. Let me try to align this more with other disk drivers.

Please have a look at ftp.netbsd.org:/pub/NetBSD/misc/mlelstv/vnd.patch

Greetings,
-- 
--

-- 
                                Michael van Elst
Internet: mlelstv <at> serpens.de
                                "A potential Snark may lurk in every tree."

Brian Buhrow | 7 Jun 2012 19:35

Re: Enabling wedge autodiscovery on vnd disks

	Hello.  I've downloaded, looked, applied and tested your patch.  It
seems to work fine and have the same functionality mine does without having
to do the locking dance.  Do you consider this commit worthy?
-thanks
-Brian

On Jun 7, 11:19am, Michael van Elst wrote:
} Subject: Re: Enabling wedge autodiscovery on vnd disks
} mlelstv <at> serpens.de (Michael van Elst) writes:
} 
} >The wedge handling has to go into the correct paths (attach/detach/open...).
} >I see that this isn't easy with vnd, because it does some weird handling
} >of the disklabel. Let me try to align this more with other disk drivers.
} 
} Please have a look at ftp.netbsd.org:/pub/NetBSD/misc/mlelstv/vnd.patch
} 
} Greetings,
} -- 
} -- 
}                                 Michael van Elst
} Internet: mlelstv <at> serpens.de
}                                 "A potential Snark may lurk in every tree."
>-- End of excerpt from Michael van Elst

Michael van Elst | 7 Jun 2012 21:32
Picon

Re: Enabling wedge autodiscovery on vnd disks

buhrow <at> lothlorien.nfbcal.org (Brian Buhrow) writes:

>	Hello.  I've downloaded, looked, applied and tested your patch.  It
>seems to work fine and have the same functionality mine does without having
>to do the locking dance.  Do you consider this commit worthy?

If noone complains I will commit this.

-- 
--

-- 
                                Michael van Elst
Internet: mlelstv <at> serpens.de
                                "A potential Snark may lurk in every tree."


Gmane