[KJ]use mutex instead of a binary semaphore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	As the new mutex primitive is now in place, I read,it is advised 
not to use binary semaphore for mutual exclusion.

while looking at different place where a binary semaphore is initialized,
I came accross bd_mount_sem.

I read a thread on LKML few months back related to the bd_mount_sem 
and realized that there are cases where a binary semaphore  can not be replaced by a mutex.
The reason being mutex has a sense of ownership, i.e. 
a mutex can only be unlocked from the context
 from which it was locked.

e.g bd_mount_sem in the block device structure is 
used to make sure no new mounts happen on bdev
 in between freeze_bdev and thaw_bdev().

so locking is done in freeze_bdev &
 unlocking in thaw_bdev these can be from different context i guess..

is my understandig correct..
CMIIW..
would appreciate some pointers on how to identify such cases.. 


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux