Messages in this thread |  | | From | (Alan Cox) | Subject | Re: Could this become a race condition? | Date | Wed, 16 Oct 1996 23:02:12 +0100 (BST) |
| |
> extern inline void lock_super(struct super_block * sb) > { > if (sb->s_lock) > __wait_on_super(sb); > sb->s_lock = 1; > } > > What happen if two execution threads (particurlarly on a SMP machine) > check the value of the variable sb->s_lock _at the same time_, and see > that the value is zero? Both the 2 threads will set this variable to 1, > and consider that they have the lock on the super_block ?
Kernel threads of code are only pre-empted by interrupts so its safe except from an interrupt. The SMP kernel only allows one processor in kernel space at a time so it doesnt arise either.
In future when we take the giant leap and set the kernel up for finer grained SMP locking your comment will become true.
Alan
|  |