Re: saslauthd locking issues was Re: saslauthd instability with sockets


Subject: Re: saslauthd locking issues was Re: saslauthd instability with sockets
From: Jeremy Rumpf (jrumpf at heavyload dot net)
Date: Wed May 21 2003 - 13:31:53 EDT


On Wednesday 21 May 2003 08:59 am, Rob Siemborski wrote:
> On Wed, 21 May 2003, Leena Heino wrote:
> > According to Solaris' fcntl man page F_SETLK never sets errno to EINTR,
> > but F_SETLKW does.
> >
> > I think loop should use F_SETLKW instead of F_SETLK to make sure the lock
> > is released.
>
> Yes. I agree. Additionally, we need to check rc != 0, since errno is
> invalid unless the function returns an error (similar problem in
> get_accept_lock).
>
> I'm committing these fixes to CVS.
>
> -Rob
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Rob Siemborski * Andrew Systems Group * Cyert Hall 207 * 412-268-7456
> Research Systems Programmer * /usr/contributed Gatekeeper

Should make the same changes to cache.c as well, it uses the same semantics.

--- cache.c.orig Wed May 21 13:27:21 2003
+++ cache.c Wed May 21 13:28:52 2003
@@ -645,7 +645,7 @@

                rc = fcntl(lock.flock_fd, F_SETLKW, &lock_st);

- } while (errno == EINTR);
+ } while (rc != 0 && errno == EINTR);

        if (rc != 0) {
                rc = errno;
@@ -683,7 +683,7 @@

                rc = fcntl(lock.flock_fd, F_SETLKW, &lock_st);

- } while (errno == EINTR);
+ } while (rc != 0 && errno == EINTR);

        if (rc != 0) {
                rc = errno;
@@ -717,9 +717,9 @@
                if (flags & VERBOSE)
                        logger(L_DEBUG, L_FUNC, "attempting to release lock on
slot: %d", slot);

- rc = fcntl(lock.flock_fd, F_SETLK, &lock_st);
+ rc = fcntl(lock.flock_fd, F_SETLKW, &lock_st);

- } while (errno == EINTR);
+ } while (rc != 0 && errno == EINTR);

        if (rc != 0) {
                rc = errno;

Cheers,
Jeremy







Hosted Email Solutions

Invaluement Anti-Spam DNSBLs



Powered By FreeBSD   Powered By FreeBSD