[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 an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux