Commit 18ccee26 authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Linus Torvalds

ipc: update locking scheme comments

The initial documentation was a bit incomplete, update accordingly.

[akpm@linux-foundation.org: make it more readable in 80 columns]
Signed-off-by: default avatarDavidlohr Bueso <davidlohr@hp.com>
Acked-by: default avatarManfred Spraul <manfred@colorfullife.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9c567512
...@@ -17,12 +17,27 @@ ...@@ -17,12 +17,27 @@
* Pavel Emelianov <xemul@openvz.org> * Pavel Emelianov <xemul@openvz.org>
* *
* General sysv ipc locking scheme: * General sysv ipc locking scheme:
* when doing ipc id lookups, take the ids->rwsem
* rcu_read_lock() * rcu_read_lock()
* obtain the ipc object (kern_ipc_perm) * obtain the ipc object (kern_ipc_perm) by looking up the id in an idr
* perform security, capabilities, auditing and permission checks, etc. * tree.
* acquire the ipc lock (kern_ipc_perm.lock) throught ipc_lock_object() * - perform initial checks (capabilities, auditing and permission,
* perform data updates (ie: SET, RMID, LOCK/UNLOCK commands) * etc).
* - perform read-only operations, such as STAT, INFO commands.
* acquire the ipc lock (kern_ipc_perm.lock) through
* ipc_lock_object()
* - perform data updates, such as SET, RMID commands and
* mechanism-specific operations (semop/semtimedop,
* msgsnd/msgrcv, shmat/shmdt).
* drop the ipc lock, through ipc_unlock_object().
* rcu_read_unlock()
*
* The ids->rwsem must be taken when:
* - creating, removing and iterating the existing entries in ipc
* identifier sets.
* - iterating through files under /proc/sysvipc/
*
* Note that sems have a special fast path that avoids kern_ipc_perm.lock -
* see sem_lock().
*/ */
#include <linux/mm.h> #include <linux/mm.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment