Hello. I posted this question 3 months ago, but I post again, for I'm worried that this will cause a potential deadlock bug. Can a process do semaphore operations while the process is holding a spinlock? As far as I know, a process must not call semaphore operations nor functions that may sleep (such as kmalloc(GFP_KERNEL)) when the process is holding a spinlock. But I can find the following sequence. Step 1: lock_kernel() is called from sys_mount(). ( at http://lxr.linux.no/source/fs/namespace.c?v=2.4.28#L855 ) Step 2: do_mount() is called after step 1. ( at http://lxr.linux.no/source/fs/namespace.c?v=2.4.28#L700 ) Step 3: do_add_mount() is called after step 2. ( at http://lxr.linux.no/source/fs/namespace.c?v=2.4.28#L613 ) Step 4: down_write() is called after step 3. ( at http://lxr.linux.no/source/fs/namespace.c?v=2.4.28#L631 ) Why it is allowed to do semaphore operations (or kmalloc(GFP_KERNEL)) while the kernel lock is held. This will sleep and cause deadlock, won't this? Best Regards. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/