[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opensolaris-networking-discuss
Subject:    Re: [networking-discuss] [smf-discuss] Code review request -
From:       Darren Reed <Darren.Reed () Sun ! COM>
Date:       2008-12-23 4:08:53
Message-ID: 49506455.5010507 () Sun ! COM
[Download RAW message or body]

David Powell wrote:
> ...
>     ipf_get_lock is racy.  A simpler and more robust lock file can be
>     created by creating a lockfile.$newpid that contains $newpid and
>     attempting to ln $IPF_LOCK to your lockfile.

That still doesn't solve a race condition that involves lockfile.$newpid,
although it does make it less likely to occur.

Normally mkdir is used to get an "atmoic lock" on a path in the
filesystem.

Thus the usual method for getting "exclusive" use of a lock using
file systems "tricks" should do something like:

while ! mkdir $IPF_LOCK; do
    sleep 1
done
echo $newpid> $IPF_LOCK/pid

Darren

_______________________________________________
networking-discuss mailing list
networking-discuss@opensolaris.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic