diff options
author | Davidlohr Bueso <davidlohr@hp.com> | 2013-10-16 16:46:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-10-17 00:35:52 -0400 |
commit | 18ccee263c7e250a57f01c9434658f11f4118a64 (patch) | |
tree | 1655243afdaed94d9e2bdb50af14e45e1cc92834 /ipc/util.c | |
parent | 9c56751271e7a917783fb57ec49fe8382e0dc867 (diff) |
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: Davidlohr Bueso <davidlohr@hp.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/util.c')
-rw-r--r-- | ipc/util.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/ipc/util.c b/ipc/util.c index fdb8ae740775..7684f41bce76 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -17,12 +17,27 @@ | |||
17 | * Pavel Emelianov <xemul@openvz.org> | 17 | * Pavel Emelianov <xemul@openvz.org> |
18 | * | 18 | * |
19 | * General sysv ipc locking scheme: | 19 | * General sysv ipc locking scheme: |
20 | * when doing ipc id lookups, take the ids->rwsem | 20 | * rcu_read_lock() |
21 | * rcu_read_lock() | 21 | * obtain the ipc object (kern_ipc_perm) by looking up the id in an idr |
22 | * obtain the ipc object (kern_ipc_perm) | 22 | * tree. |
23 | * perform security, capabilities, auditing and permission checks, etc. | 23 | * - perform initial checks (capabilities, auditing and permission, |
24 | * acquire the ipc lock (kern_ipc_perm.lock) throught ipc_lock_object() | 24 | * etc). |
25 | * perform data updates (ie: SET, RMID, LOCK/UNLOCK commands) | 25 | * - perform read-only operations, such as STAT, INFO commands. |
26 | * acquire the ipc lock (kern_ipc_perm.lock) through | ||
27 | * ipc_lock_object() | ||
28 | * - perform data updates, such as SET, RMID commands and | ||
29 | * mechanism-specific operations (semop/semtimedop, | ||
30 | * msgsnd/msgrcv, shmat/shmdt). | ||
31 | * drop the ipc lock, through ipc_unlock_object(). | ||
32 | * rcu_read_unlock() | ||
33 | * | ||
34 | * The ids->rwsem must be taken when: | ||
35 | * - creating, removing and iterating the existing entries in ipc | ||
36 | * identifier sets. | ||
37 | * - iterating through files under /proc/sysvipc/ | ||
38 | * | ||
39 | * Note that sems have a special fast path that avoids kern_ipc_perm.lock - | ||
40 | * see sem_lock(). | ||
26 | */ | 41 | */ |
27 | 42 | ||
28 | #include <linux/mm.h> | 43 | #include <linux/mm.h> |