2007/8/13, Junko IKEDA <[EMAIL PROTECTED]>:
> > 2007/8/10, Junko IKEDA <[EMAIL PROTECTED]>:
> > > Hi,
> > >
> > > sfex_lock.c would work like this;
> > > 1) read lock data
> > > 2) check current lock status
> > > 3) reserve lock
> > > 4) detect the collision of lock
> > > 5) extension of lock
> > > 6) lock acquisition completion
> > >
> > > in "reserve lock" phase, each node writes its status on the disk,
> > > and the later node is going to reserve the lock.
> > > the former one gives up and the race will be end here.
> >
> > Assume we have 2 nodes.
> > 1. Node A & B reach step 3) in the same time.
> > 2. sfex_lock on Node B is scheduled out due to some other reasons.
> > 3. sfex_lock on Node A goes through step 3 to 6, and Node A holds the lock
> now.
> > 4. sfex_lock on Node B is scheduled back, and goes through step 3 to 6
> also.
>
> Node B would not be able to get lock in this case, because Node A has
> already held the lock.
> Node B would check the lock status before reserving the lock,
> and notice Node A has the lock.
> With this condition, Node B is going to give up to lock.

This statement is wrong according to your code.
Especially, your check-and-reserve is not an atomic CAS operation.

> > 5. Now both A & B have the lock.
> >
> > > During collision_timeout waiting, the cord around "detect the collision
> of
> > > lock" has responsibility to prevent the race.
> > > in other cases, "check current lock status" would prevent it.
> > >
> > > as a precondition to ensure the control exclusively,
> > > lock_timeout should be longer enough than collision_timeout.
> > >
> > > Does that answer you?
> > >
> > > Thanks,
> > > Junko
> > >
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED] On Behalf Of Xinwei
> Hu
> > > > Sent: Thursday, August 09, 2007 8:58 PM
> > > > To: High-Availability Linux Development List
> > > > Subject: Re: [Linux-ha-dev] Shared disk file Exclusiveness
> > > > controlprogramforHB2
> > > >
> > > > 2007/8/9, Junko IKEDA <[EMAIL PROTECTED]>:
> > > > > Hi,
> > > > >
> > > > > sorry, my previous answer was off the mark...
> > > > > When 2 nodes reach there at the same time,
> > > > > node A notices that the other node want to lock too, so give up lock
> > > itself.
> > > >
> > > > I only see that you sleep a period of collision_timeout. This will not
> > > prevent
> > > > race condition from happening.
> > > > Am i missing anything else ?
> > > >
> > > > > node B is ready to lock.
> > > > >
> > > > > Thanks,
> > > > > Junko
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: [EMAIL PROTECTED]
> > > > > > [mailto:[EMAIL PROTECTED] On Behalf Of
> Junko
> > > IKEDA
> > > > > > Sent: Thursday, August 09, 2007 4:30 PM
> > > > > > To: 'High-Availability Linux Development List'
> > > > > > Subject: RE: [Linux-ha-dev] Shared disk file Exclusiveness control
> > > > > > programforHB2
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > You know that could be true...
> > > > > > but if it's called from RA, 2 nodes wouldn't reach that part at
> the
> > > same
> > > > > > time, right?
> > > > > > One node will be able to reach there according to the score rule.
> > > > > >
> > > > > > Thanks,
> > > > > > Junko
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: [EMAIL PROTECTED]
> > > > > > > [mailto:[EMAIL PROTECTED] On Behalf Of
> Xinwei
> > > Hu
> > > > > > > Sent: Thursday, August 09, 2007 3:00 PM
> > > > > > > To: High-Availability Linux Development List
> > > > > > > Subject: Re: [Linux-ha-dev] Shared disk file Exclusiveness
> control
> > > > > program
> > > > > > > forHB2
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > >   There's races in the sfex_lock.c.
> > > > > > >
> > > > > > >   When 2 nodes reach sfex_lock.c:265 in the same time.
> > > > > > >
> > > > > > >   node A: reserve lock -> wait for collision_timeout -> hold
> lock
> > > > > > >   node B: sleep           -> sleep
> ->
> > > > > reserve
> > > > > > > lock
> > > > > > >
> > > > > > > 在 星期三 08 八月 2007 12:00,NAKAHIRA Kazutomo 写道:
> > > > > > > > Hello, all.
> > > > > > > >
> > > > > > > > We wrote a Shared Disk File EXclusiveness Control Program,
> called
> > > > > > > > "SF-EX" for short, could prevent a destruction of data on
> > > > > > > > shared disk file system due to Split-Brain.
> > > > > > > >
> > > > > > > > This program consists of CUI commands written in the C and RA,
> > > > > > > > the former is used for managing and monitoring shared disk
> status
> > > > > > > > and the latter is the same as other common RAs.
> > > > > > > >
> > > > > > > > We tested this program on IBM and HP platform, and we
> confirmed
> > > > > > > > all functions worked well.
> > > > > > > >
> > > > > > > > Our test environment is listed below:
> > > > > > > >  Software:
> > > > > > > >   OS :RHEL4 ES Update5(kernel2.6.9-55.ELsmp)
> > > > > > > >   HB2:heartbeat-2.1.2-2
> > > > > > > >
> > > > > > > >  Hardware:
> > > > > > > >   IBM platform:
> > > > > > > >    Server     : System x3650
> > > > > > > >    Shared disk: DS 4700 (FC)
> > > > > > > >
> > > > > > > >   HP platform:
> > > > > > > >    Server     : DL380G5
> > > > > > > >    Shared disk: MSA500G2 (SCSI)
> > > > > > > >
> > > > > > > > How to install and configuration are described in README.
> > > > > > > > If you are interested in this program, please try it and
> > > > > > > > let me know your comments.
> > > > > > > >
> > > > > > > > Your suggestions on how to improve are really appreciated.
> > > > > > > >
> > > > > > > > Best regards.
> > > > > > > _______________________________________________________
> > > > > > > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> > > > > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > > > > > Home Page: http://linux-ha.org/
> > > > > >
> > > > > > _______________________________________________________
> > > > > > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> > > > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > > > > Home Page: http://linux-ha.org/
> > > > >
> > > > > _______________________________________________________
> > > > > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> > > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > > > Home Page: http://linux-ha.org/
> > > > >
> > >
> > > _______________________________________________________
> > > Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > Home Page: http://linux-ha.org/
> > >
>
> _______________________________________________________
> Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to