[sheepdog] [PATCH 2/4] sheep, dog: introduce a new state for expressing coherence of inode objects in clients

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Thu Aug 7 08:06:11 CEST 2014


At Thu, 7 Aug 2014 14:02:11 +0800,
Liu Yuan wrote:
> 
> On Thu, Aug 07, 2014 at 02:35:57PM +0900, Hitoshi Mitake wrote:
> > On Thu, Aug 7, 2014 at 12:10 PM, Ruoyu <liangry at ucweb.com> wrote:
> > > Hi Hitoshi,
> > >
> > >
> > > +static bool add_new_participant(struct vdi_state_entry *entry,
> > > +                               const struct node_id *owner)
> > > +{
> > > +       int idx;
> > > +
> > > +       if (entry->lock_state == LOCK_STATE_UNLOCKED) {
> > > +               assert(!entry->nr_participants);
> > > +
> > > +               sd_debug("%s is first owner of %"PRIx32,
> > > node_id_to_str(owner),
> > > +                       entry->vid);
> > > +
> > > +               entry->nr_participants = 1;
> > > +               memcpy(&entry->participants[0], owner, sizeof(*owner));
> > > +               entry->participants_state[0] = SHARED_LOCK_STATE_MODIFIED;
> > > +               entry->lock_state = LOCK_STATE_SHARED;
> > > +
> > > +               return true;
> > > +       }
> > > +
> > > +       assert(entry->lock_state == LOCK_STATE_UNLOCKED);
> > >
> > > It seems the assertion will be failure. Am I misunderstanding?
> > 
> > Thanks a lot for your pointing. As you say, it is my mistake. I've
> > forgot to test it with --enable-debug. I've posted a patch for fixing
> > it.
> > 
> 
> I'd suggest enable assert() as default, not associated with --enable-debug. This
> will allow us to catch fatal bugs as early as possible because most of the time,
> poeple include devvers won't --enable-debug.

OK, I'll post a patch for enabling assert() in default and adding
--disable-assert for disabling assert() explicitly later.

Thanks,
Hitoshi



More information about the sheepdog mailing list