• Home
  • Raw
  • Download

Lines Matching +full:foo +full:- +full:queue

70  * Accesses to a message queue are synchronized by acquiring info->lock.
73 * - The actual wakeup of a sleeping task is performed using the wake_q
74 * framework. info->lock is already released when wake_up_q is called.
75 * - The exit codepaths after sleeping check ext_wait_queue->state without
77 * acquiring info->lock.
94 * ->state = STATE_READY (reordered)
102 * the smp_store_release() that does ->state = STATE_READY.
116 * receiver->msg = message; (reordered)
120 * 3) There is intentionally no barrier when setting current->state
121 * to TASK_INTERRUPTIBLE: spin_unlock(&info->lock) provides the
123 * info->lock, i.e. spin_lock(&info->lock) provided a pairing
127 struct ext_wait_queue { /* queue of sleeping tasks */
155 unsigned long qsize; /* size of queue in memory (sum of all msgs) */
179 return get_ipc_ns(inode->i_sb->s_fs_info); in __get_ns_from_inode()
199 p = &info->msg_tree.rb_node; in msg_insert()
204 if (likely(leaf->priority == msg->m_type)) in msg_insert()
206 else if (msg->m_type < leaf->priority) { in msg_insert()
207 p = &(*p)->rb_left; in msg_insert()
210 p = &(*p)->rb_right; in msg_insert()
212 if (info->node_cache) { in msg_insert()
213 leaf = info->node_cache; in msg_insert()
214 info->node_cache = NULL; in msg_insert()
218 return -ENOMEM; in msg_insert()
219 INIT_LIST_HEAD(&leaf->msg_list); in msg_insert()
221 leaf->priority = msg->m_type; in msg_insert()
224 info->msg_tree_rightmost = &leaf->rb_node; in msg_insert()
226 rb_link_node(&leaf->rb_node, parent, p); in msg_insert()
227 rb_insert_color(&leaf->rb_node, &info->msg_tree); in msg_insert()
229 info->attr.mq_curmsgs++; in msg_insert()
230 info->qsize += msg->m_ts; in msg_insert()
231 list_add_tail(&msg->m_list, &leaf->msg_list); in msg_insert()
238 struct rb_node *node = &leaf->rb_node; in msg_tree_erase()
240 if (info->msg_tree_rightmost == node) in msg_tree_erase()
241 info->msg_tree_rightmost = rb_prev(node); in msg_tree_erase()
243 rb_erase(node, &info->msg_tree); in msg_tree_erase()
244 if (info->node_cache) in msg_tree_erase()
247 info->node_cache = leaf; in msg_tree_erase()
262 parent = info->msg_tree_rightmost; in msg_get()
264 if (info->attr.mq_curmsgs) { in msg_get()
265 pr_warn_once("Inconsistency in POSIX message queue, " in msg_get()
268 info->attr.mq_curmsgs = 0; in msg_get()
273 if (unlikely(list_empty(&leaf->msg_list))) { in msg_get()
274 pr_warn_once("Inconsistency in POSIX message queue, " in msg_get()
280 msg = list_first_entry(&leaf->msg_list, in msg_get()
282 list_del(&msg->m_list); in msg_get()
283 if (list_empty(&leaf->msg_list)) { in msg_get()
287 info->attr.mq_curmsgs--; in msg_get()
288 info->qsize -= msg->m_ts; in msg_get()
298 int ret = -ENOMEM; in mqueue_get_inode()
304 inode->i_ino = get_next_ino(); in mqueue_get_inode()
305 inode->i_mode = mode; in mqueue_get_inode()
306 inode->i_uid = current_fsuid(); in mqueue_get_inode()
307 inode->i_gid = current_fsgid(); in mqueue_get_inode()
308 inode->i_mtime = inode->i_ctime = inode->i_atime = current_time(inode); in mqueue_get_inode()
314 inode->i_fop = &mqueue_file_operations; in mqueue_get_inode()
315 inode->i_size = FILENT_SIZE; in mqueue_get_inode()
318 spin_lock_init(&info->lock); in mqueue_get_inode()
319 init_waitqueue_head(&info->wait_q); in mqueue_get_inode()
320 INIT_LIST_HEAD(&info->e_wait_q[0].list); in mqueue_get_inode()
321 INIT_LIST_HEAD(&info->e_wait_q[1].list); in mqueue_get_inode()
322 info->notify_owner = NULL; in mqueue_get_inode()
323 info->notify_user_ns = NULL; in mqueue_get_inode()
324 info->qsize = 0; in mqueue_get_inode()
325 info->user = NULL; /* set when all is ok */ in mqueue_get_inode()
326 info->msg_tree = RB_ROOT; in mqueue_get_inode()
327 info->msg_tree_rightmost = NULL; in mqueue_get_inode()
328 info->node_cache = NULL; in mqueue_get_inode()
329 memset(&info->attr, 0, sizeof(info->attr)); in mqueue_get_inode()
330 info->attr.mq_maxmsg = min(ipc_ns->mq_msg_max, in mqueue_get_inode()
331 ipc_ns->mq_msg_default); in mqueue_get_inode()
332 info->attr.mq_msgsize = min(ipc_ns->mq_msgsize_max, in mqueue_get_inode()
333 ipc_ns->mq_msgsize_default); in mqueue_get_inode()
335 info->attr.mq_maxmsg = attr->mq_maxmsg; in mqueue_get_inode()
336 info->attr.mq_msgsize = attr->mq_msgsize; in mqueue_get_inode()
341 * possible message into the queue size. That's no longer in mqueue_get_inode()
342 * accurate as the queue is now an rbtree and will grow and in mqueue_get_inode()
352 ret = -EINVAL; in mqueue_get_inode()
353 if (info->attr.mq_maxmsg <= 0 || info->attr.mq_msgsize <= 0) in mqueue_get_inode()
356 if (info->attr.mq_maxmsg > HARD_MSGMAX || in mqueue_get_inode()
357 info->attr.mq_msgsize > HARD_MSGSIZEMAX) in mqueue_get_inode()
360 if (info->attr.mq_maxmsg > ipc_ns->mq_msg_max || in mqueue_get_inode()
361 info->attr.mq_msgsize > ipc_ns->mq_msgsize_max) in mqueue_get_inode()
364 ret = -EOVERFLOW; in mqueue_get_inode()
366 if (info->attr.mq_msgsize > ULONG_MAX/info->attr.mq_maxmsg) in mqueue_get_inode()
368 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + in mqueue_get_inode()
369 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * in mqueue_get_inode()
371 mq_bytes = info->attr.mq_maxmsg * info->attr.mq_msgsize; in mqueue_get_inode()
376 if (u->mq_bytes + mq_bytes < u->mq_bytes || in mqueue_get_inode()
377 u->mq_bytes + mq_bytes > rlimit(RLIMIT_MSGQUEUE)) { in mqueue_get_inode()
379 /* mqueue_evict_inode() releases info->messages */ in mqueue_get_inode()
380 ret = -EMFILE; in mqueue_get_inode()
383 u->mq_bytes += mq_bytes; in mqueue_get_inode()
387 info->user = get_uid(u); in mqueue_get_inode()
391 inode->i_size = 2 * DIRENT_SIZE; in mqueue_get_inode()
392 inode->i_op = &mqueue_dir_inode_operations; in mqueue_get_inode()
393 inode->i_fop = &simple_dir_operations; in mqueue_get_inode()
406 struct ipc_namespace *ns = sb->s_fs_info; in mqueue_fill_super()
408 sb->s_iflags |= SB_I_NOEXEC | SB_I_NODEV; in mqueue_fill_super()
409 sb->s_blocksize = PAGE_SIZE; in mqueue_fill_super()
410 sb->s_blocksize_bits = PAGE_SHIFT; in mqueue_fill_super()
411 sb->s_magic = MQUEUE_MAGIC; in mqueue_fill_super()
412 sb->s_op = &mqueue_super_ops; in mqueue_fill_super()
418 sb->s_root = d_make_root(inode); in mqueue_fill_super()
419 if (!sb->s_root) in mqueue_fill_super()
420 return -ENOMEM; in mqueue_fill_super()
426 struct mqueue_fs_context *ctx = fc->fs_private; in mqueue_get_tree()
432 if (ctx->newns) { in mqueue_get_tree()
433 fc->s_fs_info = ctx->ipc_ns; in mqueue_get_tree()
436 return get_tree_keyed(fc, mqueue_fill_super, ctx->ipc_ns); in mqueue_get_tree()
441 struct mqueue_fs_context *ctx = fc->fs_private; in mqueue_fs_context_free()
443 put_ipc_ns(ctx->ipc_ns); in mqueue_fs_context_free()
453 return -ENOMEM; in mqueue_init_fs_context()
455 ctx->ipc_ns = get_ipc_ns(current->nsproxy->ipc_ns); in mqueue_init_fs_context()
456 put_user_ns(fc->user_ns); in mqueue_init_fs_context()
457 fc->user_ns = get_user_ns(ctx->ipc_ns->user_ns); in mqueue_init_fs_context()
458 fc->fs_private = ctx; in mqueue_init_fs_context()
459 fc->ops = &mqueue_fs_context_ops; in mqueue_init_fs_context()
477 ctx = fc->fs_private; in mq_create_mount()
478 ctx->newns = true; in mq_create_mount()
479 put_ipc_ns(ctx->ipc_ns); in mq_create_mount()
480 ctx->ipc_ns = get_ipc_ns(ns); in mq_create_mount()
481 put_user_ns(fc->user_ns); in mq_create_mount()
482 fc->user_ns = get_user_ns(ctx->ipc_ns->user_ns); in mq_create_mount()
489 static void init_once(void *foo) in init_once() argument
491 struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo; in init_once()
493 inode_init_once(&p->vfs_inode); in init_once()
503 return &ei->vfs_inode; in mqueue_alloc_inode()
521 if (S_ISDIR(inode->i_mode)) in mqueue_evict_inode()
526 spin_lock(&info->lock); in mqueue_evict_inode()
528 list_add_tail(&msg->m_list, &tmp_msg); in mqueue_evict_inode()
529 kfree(info->node_cache); in mqueue_evict_inode()
530 spin_unlock(&info->lock); in mqueue_evict_inode()
533 list_del(&msg->m_list); in mqueue_evict_inode()
537 user = info->user; in mqueue_evict_inode()
542 mq_treesize = info->attr.mq_maxmsg * sizeof(struct msg_msg) + in mqueue_evict_inode()
543 min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) * in mqueue_evict_inode()
546 mq_bytes = mq_treesize + (info->attr.mq_maxmsg * in mqueue_evict_inode()
547 info->attr.mq_msgsize); in mqueue_evict_inode()
550 user->mq_bytes -= mq_bytes; in mqueue_evict_inode()
553 * (ipc_ns = sb->s_fs_info) is either a valid ipc_ns in mqueue_evict_inode()
558 ipc_ns->mq_queues_count--; in mqueue_evict_inode()
568 struct inode *dir = dentry->d_parent->d_inode; in mqueue_create_attr()
577 error = -EACCES; in mqueue_create_attr()
581 if (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && in mqueue_create_attr()
583 error = -ENOSPC; in mqueue_create_attr()
586 ipc_ns->mq_queues_count++; in mqueue_create_attr()
589 inode = mqueue_get_inode(dir->i_sb, ipc_ns, mode, attr); in mqueue_create_attr()
593 ipc_ns->mq_queues_count--; in mqueue_create_attr()
598 dir->i_size += DIRENT_SIZE; in mqueue_create_attr()
599 dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir); in mqueue_create_attr()
621 dir->i_ctime = dir->i_mtime = dir->i_atime = current_time(dir); in mqueue_unlink()
622 dir->i_size -= DIRENT_SIZE; in mqueue_unlink()
629 * This is routine for system read from queue file.
631 * to read only queue size & notification info (the only values
642 spin_lock(&info->lock); in mqueue_read_file()
644 "QSIZE:%-10lu NOTIFY:%-5d SIGNO:%-5d NOTIFY_PID:%-6d\n", in mqueue_read_file()
645 info->qsize, in mqueue_read_file()
646 info->notify_owner ? info->notify.sigev_notify : 0, in mqueue_read_file()
647 (info->notify_owner && in mqueue_read_file()
648 info->notify.sigev_notify == SIGEV_SIGNAL) ? in mqueue_read_file()
649 info->notify.sigev_signo : 0, in mqueue_read_file()
650 pid_vnr(info->notify_owner)); in mqueue_read_file()
651 spin_unlock(&info->lock); in mqueue_read_file()
652 buffer[sizeof(buffer)-1] = '\0'; in mqueue_read_file()
659 file_inode(filp)->i_atime = file_inode(filp)->i_ctime = current_time(file_inode(filp)); in mqueue_read_file()
667 spin_lock(&info->lock); in mqueue_flush_file()
668 if (task_tgid(current) == info->notify_owner) in mqueue_flush_file()
671 spin_unlock(&info->lock); in mqueue_flush_file()
680 poll_wait(filp, &info->wait_q, poll_tab); in mqueue_poll_file()
682 spin_lock(&info->lock); in mqueue_poll_file()
683 if (info->attr.mq_curmsgs) in mqueue_poll_file()
686 if (info->attr.mq_curmsgs < info->attr.mq_maxmsg) in mqueue_poll_file()
688 spin_unlock(&info->lock); in mqueue_poll_file()
693 /* Adds current to info->e_wait_q[sr] before element with smaller prio */
699 list_for_each_entry(walk, &info->e_wait_q[sr].list, list) { in wq_add()
700 if (walk->task->prio <= current->prio) { in wq_add()
701 list_add_tail(&ewp->list, &walk->list); in wq_add()
705 list_add_tail(&ewp->list, &info->e_wait_q[sr].list); in wq_add()
709 * Puts current task to sleep. Caller must hold queue lock. After return
715 __releases(&info->lock) in wq_sleep()
723 /* memory barrier not required, we hold info->lock */ in wq_sleep()
726 spin_unlock(&info->lock); in wq_sleep()
730 if (READ_ONCE(ewp->state) == STATE_READY) { in wq_sleep()
736 spin_lock(&info->lock); in wq_sleep()
738 /* we hold info->lock, so no memory barrier required */ in wq_sleep()
739 if (READ_ONCE(ewp->state) == STATE_READY) { in wq_sleep()
744 retval = -ERESTARTSYS; in wq_sleep()
748 retval = -ETIMEDOUT; in wq_sleep()
752 list_del(&ewp->list); in wq_sleep()
754 spin_unlock(&info->lock); in wq_sleep()
767 ptr = info->e_wait_q[sr].list.prev; in wq_get_first_waiter()
768 if (ptr == &info->e_wait_q[sr].list) in wq_get_first_waiter()
776 ((char *)skb->data)[NOTIFY_COOKIE_LEN-1] = code; in set_cookie()
786 * waiting synchronously for message AND state of queue changed from in __do_notify()
789 if (info->notify_owner && in __do_notify()
790 info->attr.mq_curmsgs == 1) { in __do_notify()
791 switch (info->notify.sigev_notify) { in __do_notify()
799 if (!info->notify.sigev_signo) in __do_notify()
803 sig_i.si_signo = info->notify.sigev_signo; in __do_notify()
806 sig_i.si_value = info->notify.sigev_value; in __do_notify()
808 /* map current pid/uid into info->owner's namespaces */ in __do_notify()
810 ns_of_pid(info->notify_owner)); in __do_notify()
811 sig_i.si_uid = from_kuid_munged(info->notify_user_ns, in __do_notify()
820 task = pid_task(info->notify_owner, PIDTYPE_TGID); in __do_notify()
821 if (task && task->self_exec_id == in __do_notify()
822 info->notify_self_exec_id) { in __do_notify()
823 do_send_sig_info(info->notify.sigev_signo, in __do_notify()
830 set_cookie(info->notify_cookie, NOTIFY_WOKENUP); in __do_notify()
831 netlink_sendskb(info->notify_sock, info->notify_cookie); in __do_notify()
835 put_pid(info->notify_owner); in __do_notify()
836 put_user_ns(info->notify_user_ns); in __do_notify()
837 info->notify_owner = NULL; in __do_notify()
838 info->notify_user_ns = NULL; in __do_notify()
840 wake_up(&info->wait_q); in __do_notify()
847 return -EFAULT; in prepare_timeout()
849 return -EINVAL; in prepare_timeout()
855 if (info->notify_owner != NULL && in remove_notification()
856 info->notify.sigev_notify == SIGEV_THREAD) { in remove_notification()
857 set_cookie(info->notify_cookie, NOTIFY_REMOVED); in remove_notification()
858 netlink_sendskb(info->notify_sock, info->notify_cookie); in remove_notification()
860 put_pid(info->notify_owner); in remove_notification()
861 put_user_ns(info->notify_user_ns); in remove_notification()
862 info->notify_owner = NULL; in remove_notification()
863 info->notify_user_ns = NULL; in remove_notification()
876 return -ENOENT; in prepare_open()
879 audit_inode_parent_hidden(name, dentry->d_parent); in prepare_open()
886 return -EEXIST; in prepare_open()
888 return -EINVAL; in prepare_open()
896 struct vfsmount *mnt = current->nsproxy->ipc_ns->mq_mnt; in do_mq_open()
897 struct dentry *root = mnt->mnt_root; in do_mq_open()
914 path.dentry = lookup_one_len(name->name, root, strlen(name->name)); in do_mq_open()
947 return -EFAULT; in SYSCALL_DEFINE4()
958 struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; in SYSCALL_DEFINE1()
959 struct vfsmount *mnt = ipc_ns->mq_mnt; in SYSCALL_DEFINE1()
965 audit_inode_parent_hidden(name, mnt->mnt_root); in SYSCALL_DEFINE1()
969 inode_lock_nested(d_inode(mnt->mnt_root), I_MUTEX_PARENT); in SYSCALL_DEFINE1()
970 dentry = lookup_one_len(name->name, mnt->mnt_root, in SYSCALL_DEFINE1()
971 strlen(name->name)); in SYSCALL_DEFINE1()
979 err = -ENOENT; in SYSCALL_DEFINE1()
982 err = vfs_unlink(d_inode(dentry->d_parent), dentry, NULL); in SYSCALL_DEFINE1()
987 inode_unlock(d_inode(mnt->mnt_root)); in SYSCALL_DEFINE1()
1004 * queue spinlock:
1006 * - Set pointer to message.
1007 * - Queue the receiver task for later wakeup (without the info->lock).
1008 * - Update its state to STATE_READY. Now the receiver can continue.
1009 * - Wake up the process after the lock is dropped. Should the process wake up
1022 list_del(&this->list); in __pipelined_op()
1023 task = get_task_struct(this->task); in __pipelined_op()
1026 smp_store_release(&this->state, STATE_READY); in __pipelined_op()
1030 /* pipelined_send() - send a message directly to the task waiting in
1031 * sys_mq_timedreceive() (without inserting message into a queue).
1038 receiver->msg = message; in pipelined_send()
1042 /* pipelined_receive() - if there is task waiting in sys_mq_timedsend()
1043 * gets its message and put to the queue (we have one free place for sure). */
1051 wake_up_interruptible(&info->wait_q); in pipelined_receive()
1054 if (msg_insert(sender->msg, info)) in pipelined_receive()
1076 return -EINVAL; in do_mq_timedsend()
1087 ret = -EBADF; in do_mq_timedsend()
1092 if (unlikely(f.file->f_op != &mqueue_file_operations)) { in do_mq_timedsend()
1093 ret = -EBADF; in do_mq_timedsend()
1099 if (unlikely(!(f.file->f_mode & FMODE_WRITE))) { in do_mq_timedsend()
1100 ret = -EBADF; in do_mq_timedsend()
1104 if (unlikely(msg_len > info->attr.mq_msgsize)) { in do_mq_timedsend()
1105 ret = -EMSGSIZE; in do_mq_timedsend()
1116 msg_ptr->m_ts = msg_len; in do_mq_timedsend()
1117 msg_ptr->m_type = msg_prio; in do_mq_timedsend()
1124 if (!info->node_cache) in do_mq_timedsend()
1127 spin_lock(&info->lock); in do_mq_timedsend()
1129 if (!info->node_cache && new_leaf) { in do_mq_timedsend()
1131 INIT_LIST_HEAD(&new_leaf->msg_list); in do_mq_timedsend()
1132 info->node_cache = new_leaf; in do_mq_timedsend()
1138 if (info->attr.mq_curmsgs == info->attr.mq_maxmsg) { in do_mq_timedsend()
1139 if (f.file->f_flags & O_NONBLOCK) { in do_mq_timedsend()
1140 ret = -EAGAIN; in do_mq_timedsend()
1145 /* memory barrier not required, we hold info->lock */ in do_mq_timedsend()
1149 * wq_sleep must be called with info->lock held, and in do_mq_timedsend()
1159 /* adds message to the queue */ in do_mq_timedsend()
1165 inode->i_atime = inode->i_mtime = inode->i_ctime = in do_mq_timedsend()
1169 spin_unlock(&info->lock); in do_mq_timedsend()
1202 ret = -EBADF; in do_mq_timedreceive()
1207 if (unlikely(f.file->f_op != &mqueue_file_operations)) { in do_mq_timedreceive()
1208 ret = -EBADF; in do_mq_timedreceive()
1214 if (unlikely(!(f.file->f_mode & FMODE_READ))) { in do_mq_timedreceive()
1215 ret = -EBADF; in do_mq_timedreceive()
1220 if (unlikely(msg_len < info->attr.mq_msgsize)) { in do_mq_timedreceive()
1221 ret = -EMSGSIZE; in do_mq_timedreceive()
1230 if (!info->node_cache) in do_mq_timedreceive()
1233 spin_lock(&info->lock); in do_mq_timedreceive()
1235 if (!info->node_cache && new_leaf) { in do_mq_timedreceive()
1237 INIT_LIST_HEAD(&new_leaf->msg_list); in do_mq_timedreceive()
1238 info->node_cache = new_leaf; in do_mq_timedreceive()
1243 if (info->attr.mq_curmsgs == 0) { in do_mq_timedreceive()
1244 if (f.file->f_flags & O_NONBLOCK) { in do_mq_timedreceive()
1245 spin_unlock(&info->lock); in do_mq_timedreceive()
1246 ret = -EAGAIN; in do_mq_timedreceive()
1250 /* memory barrier not required, we hold info->lock */ in do_mq_timedreceive()
1260 inode->i_atime = inode->i_mtime = inode->i_ctime = in do_mq_timedreceive()
1263 /* There is now free space in queue. */ in do_mq_timedreceive()
1265 spin_unlock(&info->lock); in do_mq_timedreceive()
1270 ret = msg_ptr->m_ts; in do_mq_timedreceive()
1272 if ((u_msg_prio && put_user(msg_ptr->m_type, u_msg_prio)) || in do_mq_timedreceive()
1273 store_msg(u_msg_ptr, msg_ptr, msg_ptr->m_ts)) { in do_mq_timedreceive()
1274 ret = -EFAULT; in do_mq_timedreceive()
1331 if (unlikely(notification->sigev_notify != SIGEV_NONE && in do_mq_notify()
1332 notification->sigev_notify != SIGEV_SIGNAL && in do_mq_notify()
1333 notification->sigev_notify != SIGEV_THREAD)) in do_mq_notify()
1334 return -EINVAL; in do_mq_notify()
1335 if (notification->sigev_notify == SIGEV_SIGNAL && in do_mq_notify()
1336 !valid_signal(notification->sigev_signo)) { in do_mq_notify()
1337 return -EINVAL; in do_mq_notify()
1339 if (notification->sigev_notify == SIGEV_THREAD) { in do_mq_notify()
1345 return -ENOMEM; in do_mq_notify()
1347 if (copy_from_user(nc->data, in do_mq_notify()
1348 notification->sigev_value.sival_ptr, in do_mq_notify()
1350 ret = -EFAULT; in do_mq_notify()
1358 f = fdget(notification->sigev_signo); in do_mq_notify()
1360 ret = -EBADF; in do_mq_notify()
1383 ret = -EBADF; in do_mq_notify()
1388 if (unlikely(f.file->f_op != &mqueue_file_operations)) { in do_mq_notify()
1389 ret = -EBADF; in do_mq_notify()
1395 spin_lock(&info->lock); in do_mq_notify()
1397 if (info->notify_owner == task_tgid(current)) { in do_mq_notify()
1399 inode->i_atime = inode->i_ctime = current_time(inode); in do_mq_notify()
1401 } else if (info->notify_owner != NULL) { in do_mq_notify()
1402 ret = -EBUSY; in do_mq_notify()
1404 switch (notification->sigev_notify) { in do_mq_notify()
1406 info->notify.sigev_notify = SIGEV_NONE; in do_mq_notify()
1409 info->notify_sock = sock; in do_mq_notify()
1410 info->notify_cookie = nc; in do_mq_notify()
1413 info->notify.sigev_notify = SIGEV_THREAD; in do_mq_notify()
1416 info->notify.sigev_signo = notification->sigev_signo; in do_mq_notify()
1417 info->notify.sigev_value = notification->sigev_value; in do_mq_notify()
1418 info->notify.sigev_notify = SIGEV_SIGNAL; in do_mq_notify()
1419 info->notify_self_exec_id = current->self_exec_id; in do_mq_notify()
1423 info->notify_owner = get_pid(task_tgid(current)); in do_mq_notify()
1424 info->notify_user_ns = get_user_ns(current_user_ns()); in do_mq_notify()
1425 inode->i_atime = inode->i_ctime = current_time(inode); in do_mq_notify()
1427 spin_unlock(&info->lock); in do_mq_notify()
1446 return -EFAULT; in SYSCALL_DEFINE2()
1458 if (new && (new->mq_flags & (~O_NONBLOCK))) in do_mq_getsetattr()
1459 return -EINVAL; in do_mq_getsetattr()
1463 return -EBADF; in do_mq_getsetattr()
1465 if (unlikely(f.file->f_op != &mqueue_file_operations)) { in do_mq_getsetattr()
1467 return -EBADF; in do_mq_getsetattr()
1473 spin_lock(&info->lock); in do_mq_getsetattr()
1476 *old = info->attr; in do_mq_getsetattr()
1477 old->mq_flags = f.file->f_flags & O_NONBLOCK; in do_mq_getsetattr()
1481 spin_lock(&f.file->f_lock); in do_mq_getsetattr()
1482 if (new->mq_flags & O_NONBLOCK) in do_mq_getsetattr()
1483 f.file->f_flags |= O_NONBLOCK; in do_mq_getsetattr()
1485 f.file->f_flags &= ~O_NONBLOCK; in do_mq_getsetattr()
1486 spin_unlock(&f.file->f_lock); in do_mq_getsetattr()
1488 inode->i_atime = inode->i_ctime = current_time(inode); in do_mq_getsetattr()
1491 spin_unlock(&info->lock); in do_mq_getsetattr()
1507 return -EFAULT; in SYSCALL_DEFINE3()
1517 return -EFAULT; in SYSCALL_DEFINE3()
1524 compat_long_t mq_flags; /* message queue flags */
1537 return -EFAULT; in get_compat_mq_attr()
1540 attr->mq_flags = v.mq_flags; in get_compat_mq_attr()
1541 attr->mq_maxmsg = v.mq_maxmsg; in get_compat_mq_attr()
1542 attr->mq_msgsize = v.mq_msgsize; in get_compat_mq_attr()
1543 attr->mq_curmsgs = v.mq_curmsgs; in get_compat_mq_attr()
1553 v.mq_flags = attr->mq_flags; in put_compat_mq_attr()
1554 v.mq_maxmsg = attr->mq_maxmsg; in put_compat_mq_attr()
1555 v.mq_msgsize = attr->mq_msgsize; in put_compat_mq_attr()
1556 v.mq_curmsgs = attr->mq_curmsgs; in put_compat_mq_attr()
1558 return -EFAULT; in put_compat_mq_attr()
1570 return -EFAULT; in COMPAT_SYSCALL_DEFINE4()
1581 return -EFAULT; in COMPAT_SYSCALL_DEFINE2()
1600 return -EFAULT; in COMPAT_SYSCALL_DEFINE3()
1610 return -EFAULT; in COMPAT_SYSCALL_DEFINE3()
1620 return -EFAULT; in compat_prepare_timeout()
1622 return -EINVAL; in compat_prepare_timeout()
1693 ns->mq_queues_count = 0; in mq_init_ns()
1694 ns->mq_queues_max = DFLT_QUEUESMAX; in mq_init_ns()
1695 ns->mq_msg_max = DFLT_MSGMAX; in mq_init_ns()
1696 ns->mq_msgsize_max = DFLT_MSGSIZEMAX; in mq_init_ns()
1697 ns->mq_msg_default = DFLT_MSG; in mq_init_ns()
1698 ns->mq_msgsize_default = DFLT_MSGSIZE; in mq_init_ns()
1703 ns->mq_mnt = m; in mq_init_ns()
1709 ns->mq_mnt->mnt_sb->s_fs_info = NULL; in mq_clear_sbinfo()
1714 kern_unmount(ns->mq_mnt); in mq_put_mnt()
1725 return -ENOMEM; in init_mqueue_fs()
1727 /* ignore failures - they are not fatal */ in init_mqueue_fs()