aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/mqueue.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-12-30 00:20:30 -0500
committerGrant Likely <grant.likely@secretlab.ca>2010-12-30 00:21:47 -0500
commitd392da5207352f09030e95d9ea335a4225667ec0 (patch)
tree7d6cd1932afcad0a5619a5c504a6d93ca318187c /ipc/mqueue.c
parente39d5ef678045d61812c1401f04fe8edb14d6359 (diff)
parent387c31c7e5c9805b0aef8833d1731a5fe7bdea14 (diff)
Merge v2.6.37-rc8 into powerpc/next
Diffstat (limited to 'ipc/mqueue.c')
-rw-r--r--ipc/mqueue.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index c93fd3faac2d..035f4399edbc 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -116,6 +116,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
116 116
117 inode = new_inode(sb); 117 inode = new_inode(sb);
118 if (inode) { 118 if (inode) {
119 inode->i_ino = get_next_ino();
119 inode->i_mode = mode; 120 inode->i_mode = mode;
120 inode->i_uid = current_fsuid(); 121 inode->i_uid = current_fsuid();
121 inode->i_gid = current_fsgid(); 122 inode->i_gid = current_fsgid();
@@ -158,7 +159,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
158 u->mq_bytes + mq_bytes > 159 u->mq_bytes + mq_bytes >
159 task_rlimit(p, RLIMIT_MSGQUEUE)) { 160 task_rlimit(p, RLIMIT_MSGQUEUE)) {
160 spin_unlock(&mq_lock); 161 spin_unlock(&mq_lock);
161 /* mqueue_delete_inode() releases info->messages */ 162 /* mqueue_evict_inode() releases info->messages */
162 goto out_inode; 163 goto out_inode;
163 } 164 }
164 u->mq_bytes += mq_bytes; 165 u->mq_bytes += mq_bytes;
@@ -210,13 +211,13 @@ out:
210 return error; 211 return error;
211} 212}
212 213
213static int mqueue_get_sb(struct file_system_type *fs_type, 214static struct dentry *mqueue_mount(struct file_system_type *fs_type,
214 int flags, const char *dev_name, 215 int flags, const char *dev_name,
215 void *data, struct vfsmount *mnt) 216 void *data)
216{ 217{
217 if (!(flags & MS_KERNMOUNT)) 218 if (!(flags & MS_KERNMOUNT))
218 data = current->nsproxy->ipc_ns; 219 data = current->nsproxy->ipc_ns;
219 return get_sb_ns(fs_type, flags, data, mqueue_fill_super, mnt); 220 return mount_ns(fs_type, flags, data, mqueue_fill_super);
220} 221}
221 222
222static void init_once(void *foo) 223static void init_once(void *foo)
@@ -241,7 +242,7 @@ static void mqueue_destroy_inode(struct inode *inode)
241 kmem_cache_free(mqueue_inode_cachep, MQUEUE_I(inode)); 242 kmem_cache_free(mqueue_inode_cachep, MQUEUE_I(inode));
242} 243}
243 244
244static void mqueue_delete_inode(struct inode *inode) 245static void mqueue_evict_inode(struct inode *inode)
245{ 246{
246 struct mqueue_inode_info *info; 247 struct mqueue_inode_info *info;
247 struct user_struct *user; 248 struct user_struct *user;
@@ -249,10 +250,11 @@ static void mqueue_delete_inode(struct inode *inode)
249 int i; 250 int i;
250 struct ipc_namespace *ipc_ns; 251 struct ipc_namespace *ipc_ns;
251 252
252 if (S_ISDIR(inode->i_mode)) { 253 end_writeback(inode);
253 clear_inode(inode); 254
255 if (S_ISDIR(inode->i_mode))
254 return; 256 return;
255 } 257
256 ipc_ns = get_ns_from_inode(inode); 258 ipc_ns = get_ns_from_inode(inode);
257 info = MQUEUE_I(inode); 259 info = MQUEUE_I(inode);
258 spin_lock(&info->lock); 260 spin_lock(&info->lock);
@@ -261,8 +263,6 @@ static void mqueue_delete_inode(struct inode *inode)
261 kfree(info->messages); 263 kfree(info->messages);
262 spin_unlock(&info->lock); 264 spin_unlock(&info->lock);
263 265
264 clear_inode(inode);
265
266 /* Total amount of bytes accounted for the mqueue */ 266 /* Total amount of bytes accounted for the mqueue */
267 mq_bytes = info->attr.mq_maxmsg * (sizeof(struct msg_msg *) 267 mq_bytes = info->attr.mq_maxmsg * (sizeof(struct msg_msg *)
268 + info->attr.mq_msgsize); 268 + info->attr.mq_msgsize);
@@ -770,7 +770,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
770 770
771 inode = dentry->d_inode; 771 inode = dentry->d_inode;
772 if (inode) 772 if (inode)
773 atomic_inc(&inode->i_count); 773 ihold(inode);
774 err = mnt_want_write(ipc_ns->mq_mnt); 774 err = mnt_want_write(ipc_ns->mq_mnt);
775 if (err) 775 if (err)
776 goto out_err; 776 goto out_err;
@@ -1220,19 +1220,19 @@ static const struct file_operations mqueue_file_operations = {
1220 .flush = mqueue_flush_file, 1220 .flush = mqueue_flush_file,
1221 .poll = mqueue_poll_file, 1221 .poll = mqueue_poll_file,
1222 .read = mqueue_read_file, 1222 .read = mqueue_read_file,
1223 .llseek = default_llseek,
1223}; 1224};
1224 1225
1225static const struct super_operations mqueue_super_ops = { 1226static const struct super_operations mqueue_super_ops = {
1226 .alloc_inode = mqueue_alloc_inode, 1227 .alloc_inode = mqueue_alloc_inode,
1227 .destroy_inode = mqueue_destroy_inode, 1228 .destroy_inode = mqueue_destroy_inode,
1229 .evict_inode = mqueue_evict_inode,
1228 .statfs = simple_statfs, 1230 .statfs = simple_statfs,
1229 .delete_inode = mqueue_delete_inode,
1230 .drop_inode = generic_delete_inode,
1231}; 1231};
1232 1232
1233static struct file_system_type mqueue_fs_type = { 1233static struct file_system_type mqueue_fs_type = {
1234 .name = "mqueue", 1234 .name = "mqueue",
1235 .get_sb = mqueue_get_sb, 1235 .mount = mqueue_mount,
1236 .kill_sb = kill_litter_super, 1236 .kill_sb = kill_litter_super,
1237}; 1237};
1238 1238