[sheepdog] [PATCH 1/2] md: purge directory only when md_add_disk() succeed

Liu Yuan namei.unix at gmail.com
Fri May 10 07:58:57 CEST 2013


在 2013-5-10 PM1:49,"MORITA Kazutaka" <morita.kazutaka at lab.ntt.co.jp>写道:
>
> At Fri, 10 May 2013 13:44:03 +0800,
> Liu Yuan wrote:
> >
> > > At Fri, 10 May 2013 13:33:00 +0800,
> > > Liu Yuan wrote:
> > > >
> > > > @@ -608,13 +609,12 @@ static int do_plug_unplug(char *disks, bool
plug)
> > > >       old_nr = md_nr_disks;
> > > >       path = strtok(disks, ",");
> > > >       do {
> > > > -             if (purge_directory(path) < 0)
> > > > -                     goto out;
> > > > -
> > > > -             if (plug)
> > > > -                     md_add_disk(path);
> > > > -             else
> > > > +             if (plug) {
> > > > +                     if (md_add_disk(path) &&
purge_directory(path) <
> > 0)
> > > > +                                     goto out;
> > >
> > > Wrong indentation.
> > >
> > > What happens if md_add_disk() succeeds but purge_directory() fails?
> > > Should we call md_del_disk() against the added disk?
> > >
> >
> > no, we dont plug any disks in that case
>
> But md_add_disk() increments md_nr_disks in the case.  I think we need
> at least some clean-up operations to decrement md_nr_disks.

ah, yeah, we need to call del_disk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20130510/c6a26062/attachment-0004.html>


More information about the sheepdog mailing list