From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932362AbWBFUIX (ORCPT ); Mon, 6 Feb 2006 15:08:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932363AbWBFUIX (ORCPT ); Mon, 6 Feb 2006 15:08:23 -0500 Received: from ebiederm.dsl.xmission.com ([166.70.28.69]:48768 "EHLO ebiederm.dsl.xmission.com") by vger.kernel.org with ESMTP id S932362AbWBFUIW (ORCPT ); Mon, 6 Feb 2006 15:08:22 -0500 To: Cc: , Herbert Poetzl , "Serge E. Hallyn" , Alan Cox , Dave Hansen , Arjan van de Ven , Suleiman Souhlal , Hubertus Franke , Cedric Le Goater , Kyle Moffett , Kirill Korotaev , Greg , Linus Torvalds , Andrew Morton , Greg KH , Rik van Riel , Alexey Kuznetsov , Andrey Savochkin , Kirill Korotaev , Andi Kleen , Benjamin Herrenschmidt , Jeff Garzik , Trond Myklebust , Jes Sorensen Subject: [RFC][PATCH 18/20] posix-mqueue: Make mqueues work with pspspaces References: From: ebiederm@xmission.com (Eric W. Biederman) Date: Mon, 06 Feb 2006 13:05:34 -0700 In-Reply-To: (Eric W. Biederman's message of "Mon, 06 Feb 2006 13:03:57 -0700") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Eric W. Biederman --- ipc/mqueue.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) 04e0f90a315df40b07d316c884a28c58eed4de33 diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 59302fc..5c71ae0 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "util.h" @@ -69,6 +70,7 @@ struct mqueue_inode_info { struct mq_attr attr; struct sigevent notify; + struct pspace *notify_pspace; pid_t notify_owner; struct user_struct *user; /* user who created, for accounting */ struct sock *notify_sock; @@ -131,6 +133,7 @@ static struct inode *mqueue_get_inode(st INIT_LIST_HEAD(&info->e_wait_q[0].list); INIT_LIST_HEAD(&info->e_wait_q[1].list); info->messages = NULL; + info->notify_pspace = NULL; info->notify_owner = 0; info->qsize = 0; info->user = NULL; /* set when all is ok */ @@ -250,6 +253,9 @@ static void mqueue_delete_inode(struct i kfree(info->messages); spin_unlock(&info->lock); + put_pspace(info->notify_pspace); + info->notify_pspace = NULL; + clear_inode(inode); mq_bytes = (info->attr.mq_maxmsg * sizeof(struct msg_msg *) + @@ -360,7 +366,8 @@ static int mqueue_flush_file(struct file struct mqueue_inode_info *info = MQUEUE_I(filp->f_dentry->d_inode); spin_lock(&info->lock); - if (current->tgid == info->notify_owner) + if ((current->tgid == info->notify_owner) && + (current->pspace == info->notify_pspace)) remove_notification(info); spin_unlock(&info->lock); @@ -516,7 +523,8 @@ static void __do_notify(struct mqueue_in sig_i.si_uid = current->uid; kill_proc_info(info->notify.sigev_signo, - &sig_i, info->notify_owner); + &sig_i, + info->notify_pspace, info->notify_owner); break; case SIGEV_THREAD: set_cookie(info->notify_cookie, NOTIFY_WOKENUP); @@ -525,7 +533,9 @@ static void __do_notify(struct mqueue_in break; } /* after notification unregisters process */ + put_pspace(info->notify_pspace); info->notify_owner = 0; + info->notify_pspace = NULL; } wake_up(&info->wait_q); } @@ -568,6 +578,8 @@ static void remove_notification(struct m set_cookie(info->notify_cookie, NOTIFY_REMOVED); netlink_sendskb(info->notify_sock, info->notify_cookie, 0); } + put_pspace(info->notify_pspace); + info->notify_pspace = NULL; info->notify_owner = 0; } @@ -1042,7 +1054,8 @@ retry: ret = 0; spin_lock(&info->lock); if (u_notification == NULL) { - if (info->notify_owner == current->tgid) { + if ((info->notify_owner == current->tgid) && + (info->notify_pspace == current->pspace)) { remove_notification(info); inode->i_atime = inode->i_ctime = CURRENT_TIME; } @@ -1066,7 +1079,9 @@ retry: info->notify.sigev_notify = SIGEV_SIGNAL; break; } + info->notify_pspace = current->pspace; info->notify_owner = current->tgid; + get_pspace(info->notify_pspace); inode->i_atime = inode->i_ctime = CURRENT_TIME; } spin_unlock(&info->lock); -- 1.1.5.g3480