Re: [RFC][PATCH 5/14] Introduce union stack

Jan Engelhardt
2007-05-22T16:44:33Z

On May 19 2007 03:18, Paul Dickson wrote:
>
>How about getting rid of the gotos:
>
> while (fs) {
> locked = union_trylock(fs->root);
> if (locked) {
> locked = union_trylock(fs->altroot);
> if (locked) {
> locked = union_trylock(fs->pwd);
> if (locked)
> break;

Suppose we break here...

> else {
> union_unlock(fs->altroot);
> union_unlock(fs->root);
> }
> else
> union_unlock(fs->root);
> }
> }
> read_unlock(&fs->lock);
> UM_DEBUG_LOCK("Failed to get all semaphores in fs_struct!\n");
> cpu_relax();
> read_lock(&fs->lock);
> }
> BUG_ON(!fs);

Then no lock is released. Boom.

Jan
--