diff options
| -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> |
