lkml.org 
[lkml]   [2006]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[RFC][PATCH 18/20] posix-mqueue: Make mqueues work with pspspaces
    From
    Date

    Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>


    ---

    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 <linux/netlink.h>
    #include <linux/syscalls.h>
    #include <linux/signal.h>
    +#include <linux/pspace.h>
    #include <net/sock.h>
    #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
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-02-06 21:10    [W:4.367 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site