tech-kern archive

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

Re: A small cgd(4) diff



On Fri Jul 10 2009 at 10:51:34 -0400, Arnaud Lacombe wrote:
> Hi Jukka,
> 
> On Fri, Jul 10, 2009 at 6:24 AM, Jukka Ruohonen<jruohonen%iki.fi@localhost> 
> wrote:
> >> > --- src/sys/dev/cgd.c   5 Jun 2009 19:21:02 -0000       1.58
> >> > +++ src/sys/dev/cgd.c   10 Jul 2009 09:27:10 -0000
> >> > @@ -165,9 +165,8 @@ cgdsoftc_init(struct cgd_softc *cs, int
> >> >  {
> >> >        char    sbuf[DK_XNAME_SIZE];
> >> >
> >> > -       memset(cs, 0x0, sizeof(*cs));
> >>
> >> This memset seems reasonable to me, why have you removed it ?
> >
> > I thought that zeroing the whole buffer with M_ZERO would yield the same
> > result.
> >
> Then pedantically, it belongs to another changeset than "convert to
> mutex(9) from lock(9)" :-)

Pedantically, the memset change alters the semantics of cgdsoftc_init().
Since there is absolutely nothing to be gained from this change apart from
introducing bugs, I would simply opt to leave such useless churn undone.

Btw, Jukka, thanks for nuking the simple_lock from cgd.  In general,
simplelocks should be converted to other methods ASAP.  Any (non MP-safe)
code which holds a simple lock while calling a potentially blocking
function can deadlock in the worst possible way.
(the cgd usage wasn't dangerous, but the less simplelocks there are,
the easier to grep for potential problems)


Home | Main Index | Thread Index | Old Index