Locks used in the FAT file system are non-atomic and in fact, don't work on SMP systems

Jeff Merkey (jmerkey@timpanogas.com)
Thu, 26 Aug 1999 10:44:09 -0600


This is a multi-part message in MIME format.

------=_NextPart_000_02A9_01BEEFAF.ED48F790
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

=20
We had attempted to use the FAT version of locks with wait queues, but =
have discovered they are non-atomic and in fact, under very heavy load =
allow shared data corrupton on SMP systems. They also have some subtle =
race conditions even on non-SMP systems i reentrant code. We are using =
atomic semaphores now instead. Just thought we would warn folks that =
what's out there appears to be busted.

The offending code is:

Lock()
{
while (lock) sleep_on(&wait);
lock =3D 1;
}

Unlock()
{
lock =3D 0;
wake_up(&wait);
}

Two processes can enter Lock() while lock is equal to 0, and both set =
it. We have seen this occur, and it seems broken. =20

Jeff

------=_NextPart_000_02A9_01BEEFAF.ED48F790
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

   
We had attempted to use the FAT version = of locks=20 with wait queues, but have discovered they are non-atomic and in fact, = under=20 very heavy load allow shared data corrupton on SMP systems.  They = also have=20 some subtle race conditions even on non-SMP systems i reentrant = code.  We=20 are using atomic semaphores now instead.  Just thought we would = warn folks=20 that what's out there appears to be busted.
 
The offending code is:
 
Lock()
{
   while (lock)=20 sleep_on(&wait);
   lock =3D 1;
}
 
Unlock()
{
   lock =3D 0;
   = wake_up(&wait);
}
 
Two processes can enter Lock() while = lock is equal=20 to 0, and both set it.  We have seen this occur, and it seems = broken. =20
 
Jeff
 
 
------=_NextPart_000_02A9_01BEEFAF.ED48F790-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/