Re: [Patch] rwsem: fix rwsem_is_locked() bug

From: Amerigo Wang
Date: Mon Oct 05 2009 - 02:30:21 EST


David Howells wrote:

Your patch would probably be better as:

- woken = 0;
+ woken = ++sem->activity;
while (waiter->flags & RWSEM_WAITING_FOR_READ) {
struct list_head *next = waiter->list.next;

list_del(&waiter->list);
tsk = waiter->task;
smp_mb();
waiter->task = NULL;
wake_up_process(tsk);
put_task_struct(tsk);
woken++;
if (list_empty(&sem->wait_list))
break;
waiter = list_entry(next, struct rwsem_waiter, list);
}

- sem->activity += woken;
+ sem->activity = woken;

FYI, this seems wrong, probably even worse than what it is now.
I tried this change, it breaks portmap.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/