Re: 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 12:07:19 -0600


Alan,

Already tried this -- it seems to work (this is what the buffer cache is
using). The other versions of "lock" however are probably broken. Up() and
Down() also work great. I think the FAT file system probably needs to do
what you suggest so it wont be broken.

Jeff

----- Original Message -----
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Jeff Merkey <jmerkey@timpanogas.com>
Cc: <linux-kernel@vger.rutgers.edu>
Sent: Thursday, August 26, 1999 12:01 PM
Subject: Re: Locks used in the FAT file system are non-atomic and in fact,
don't work on SMP systems

> > 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
>
> Really
>
> CPU 0 CPU 1
> while(lock) - its 0 while(lock) - its 0
> lock=1 lock=1
>
> am I missing something. I think you want to be using atomic test and set
> operations. (test_and_set_bit)
>
> Alan
>
>

-
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/