Hi list, I came across a situation when I needed to hold a read-only lock (in fact, a semaphore) but I haven't found a way to upgrade it to act as a write lock. I mean, something like this: struct rwsemaphore sem; void foo(struct bar *data) { down(&sem); if (!data->bar) { down_rw(&sem); data->bar = kmalloc(); } up(&sem); } Is it possible to achieve via rwsemaphores? If not, is there a way to emulate the same effect by using atomic_* and semaphore operations, other than releasing ``sem'' and reaquiring it by down_write()? Thanks in advance, adam -- 1024D/37B8D989 954B 998A E5F5 BA2A 3622 82DD 54C2 843D 37B8 D989 finger://borso@vekoll.vein.hu | Some days, my soul's confined http://www.keyserver.net | And out of mind Sleep forever -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/