diff options
author | Olof Johansson <olof@lixom.net> | 2012-02-07 18:04:15 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-02-07 18:05:20 -0500 |
commit | a5f17d1f4c2831b9b9bf8b1a537cdbac995d6e13 (patch) | |
tree | cce7eab28de00a88d75b8eda704f5838e10947b1 /ipc | |
parent | dcf81c1af839b77b44404453ecae6e5ac5a75f05 (diff) | |
parent | 62aa2b537c6f5957afd98e29f96897419ed5ebab (diff) |
Merge tag 'v3.3-rc2' into depends/rmk/for-armsoc
There were conflicts between fixes going in after 3.3-rc1 and
Russell's stable arm-soc base branch. Resolving it in the dependency
branch so that each topic branch shares the same resolution.
Conflicts:
arch/arm/mach-at91/at91cap9.c
arch/arm/mach-at91/at91sam9g45.c
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/mqueue.c | 3 | ||||
-rw-r--r-- | ipc/shm.c | 37 |
2 files changed, 23 insertions, 17 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 9b7c8ab7d75..86ee272de21 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -128,7 +128,6 @@ static struct inode *mqueue_get_inode(struct super_block *sb, | |||
128 | 128 | ||
129 | if (S_ISREG(mode)) { | 129 | if (S_ISREG(mode)) { |
130 | struct mqueue_inode_info *info; | 130 | struct mqueue_inode_info *info; |
131 | struct task_struct *p = current; | ||
132 | unsigned long mq_bytes, mq_msg_tblsz; | 131 | unsigned long mq_bytes, mq_msg_tblsz; |
133 | 132 | ||
134 | inode->i_fop = &mqueue_file_operations; | 133 | inode->i_fop = &mqueue_file_operations; |
@@ -159,7 +158,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb, | |||
159 | 158 | ||
160 | spin_lock(&mq_lock); | 159 | spin_lock(&mq_lock); |
161 | if (u->mq_bytes + mq_bytes < u->mq_bytes || | 160 | if (u->mq_bytes + mq_bytes < u->mq_bytes || |
162 | u->mq_bytes + mq_bytes > task_rlimit(p, RLIMIT_MSGQUEUE)) { | 161 | u->mq_bytes + mq_bytes > rlimit(RLIMIT_MSGQUEUE)) { |
163 | spin_unlock(&mq_lock); | 162 | spin_unlock(&mq_lock); |
164 | /* mqueue_evict_inode() releases info->messages */ | 163 | /* mqueue_evict_inode() releases info->messages */ |
165 | ret = -EMFILE; | 164 | ret = -EMFILE; |
@@ -870,9 +870,7 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf) | |||
870 | case SHM_LOCK: | 870 | case SHM_LOCK: |
871 | case SHM_UNLOCK: | 871 | case SHM_UNLOCK: |
872 | { | 872 | { |
873 | struct file *uninitialized_var(shm_file); | 873 | struct file *shm_file; |
874 | |||
875 | lru_add_drain_all(); /* drain pagevecs to lru lists */ | ||
876 | 874 | ||
877 | shp = shm_lock_check(ns, shmid); | 875 | shp = shm_lock_check(ns, shmid); |
878 | if (IS_ERR(shp)) { | 876 | if (IS_ERR(shp)) { |
@@ -895,22 +893,31 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf) | |||
895 | err = security_shm_shmctl(shp, cmd); | 893 | err = security_shm_shmctl(shp, cmd); |
896 | if (err) | 894 | if (err) |
897 | goto out_unlock; | 895 | goto out_unlock; |
898 | 896 | ||
899 | if(cmd==SHM_LOCK) { | 897 | shm_file = shp->shm_file; |
898 | if (is_file_hugepages(shm_file)) | ||
899 | goto out_unlock; | ||
900 | |||
901 | if (cmd == SHM_LOCK) { | ||
900 | struct user_struct *user = current_user(); | 902 | struct user_struct *user = current_user(); |
901 | if (!is_file_hugepages(shp->shm_file)) { | 903 | err = shmem_lock(shm_file, 1, user); |
902 | err = shmem_lock(shp->shm_file, 1, user); | 904 | if (!err && !(shp->shm_perm.mode & SHM_LOCKED)) { |
903 | if (!err && !(shp->shm_perm.mode & SHM_LOCKED)){ | 905 | shp->shm_perm.mode |= SHM_LOCKED; |
904 | shp->shm_perm.mode |= SHM_LOCKED; | 906 | shp->mlock_user = user; |
905 | shp->mlock_user = user; | ||
906 | } | ||
907 | } | 907 | } |
908 | } else if (!is_file_hugepages(shp->shm_file)) { | 908 | goto out_unlock; |
909 | shmem_lock(shp->shm_file, 0, shp->mlock_user); | ||
910 | shp->shm_perm.mode &= ~SHM_LOCKED; | ||
911 | shp->mlock_user = NULL; | ||
912 | } | 909 | } |
910 | |||
911 | /* SHM_UNLOCK */ | ||
912 | if (!(shp->shm_perm.mode & SHM_LOCKED)) | ||
913 | goto out_unlock; | ||
914 | shmem_lock(shm_file, 0, shp->mlock_user); | ||
915 | shp->shm_perm.mode &= ~SHM_LOCKED; | ||
916 | shp->mlock_user = NULL; | ||
917 | get_file(shm_file); | ||
913 | shm_unlock(shp); | 918 | shm_unlock(shp); |
919 | shmem_unlock_mapping(shm_file->f_mapping); | ||
920 | fput(shm_file); | ||
914 | goto out; | 921 | goto out; |
915 | } | 922 | } |
916 | case IPC_RMID: | 923 | case IPC_RMID: |