]> err.no Git - linux-2.6/commitdiff
[PATCH] smbfs: Make conn_pid a struct pid
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 13 Dec 2006 08:35:10 +0000 (00:35 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Wed, 13 Dec 2006 17:05:53 +0000 (09:05 -0800)
smbfs keeps track of the user space server process in conn_pid.  This converts
that track to use a struct pid instead of pid_t.  This keeps us safe from pid
wrap around issues and prepares the way for the pid namespace.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/smbfs/inode.c
fs/smbfs/proc.c
fs/smbfs/smbiod.c
include/linux/smb_fs_sb.h

index 4af4cd729a5a8589706e536d3860175c69b90d2d..84dfe3f3482e3448851e808554fed11cfcf6f7a2 100644 (file)
@@ -482,12 +482,13 @@ smb_put_super(struct super_block *sb)
        smb_close_socket(server);
 
        if (server->conn_pid)
-               kill_proc(server->conn_pid, SIGTERM, 1);
+               kill_pid(server->conn_pid, SIGTERM, 1);
 
        kfree(server->ops);
        smb_unload_nls(server);
        sb->s_fs_info = NULL;
        smb_unlock_server(server);
+       put_pid(server->conn_pid);
        kfree(server);
 }
 
@@ -530,7 +531,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
        INIT_LIST_HEAD(&server->xmitq);
        INIT_LIST_HEAD(&server->recvq);
        server->conn_error = 0;
-       server->conn_pid = 0;
+       server->conn_pid = NULL;
        server->state = CONN_INVALID; /* no connection yet */
        server->generation = 0;
 
index a5ced9e0c6c482ed0256a6420a8f47f9d88a23cc..feac46050619075aa90a88f71e4a8e4a31b5cda5 100644 (file)
@@ -877,7 +877,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
                goto out_putf;
 
        server->sock_file = filp;
-       server->conn_pid = current->pid;
+       server->conn_pid = get_pid(task_pid(current));
        server->opt = *opt;
        server->generation += 1;
        server->state = CONN_VALID;
@@ -971,8 +971,8 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
        }
 
        VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n",
-               server->opt.protocol, server->opt.max_xmit, server->conn_pid,
-               server->opt.capabilities);
+               server->opt.protocol, server->opt.max_xmit,
+               pid_nr(server->conn_pid), server->opt.capabilities);
 
        /* FIXME: this really should be done by smbmount. */
        if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) {
index e675404412880eb6d602cd7d9de3dbe6aef13c0a..89eaf31f1d46c18a42870c604d4b58ced724bfa5 100644 (file)
@@ -152,7 +152,7 @@ int smbiod_retry(struct smb_sb_info *server)
 {
        struct list_head *head;
        struct smb_request *req;
-       pid_t pid = server->conn_pid;
+       struct pid *pid = get_pid(server->conn_pid);
        int result = 0;
 
        VERBOSE("state: %d\n", server->state);
@@ -222,7 +222,7 @@ int smbiod_retry(struct smb_sb_info *server)
        /*
         * Note: use the "priv" flag, as a user process may need to reconnect.
         */
-       result = kill_proc(pid, SIGUSR1, 1);
+       result = kill_pid(pid, SIGUSR1, 1);
        if (result) {
                /* FIXME: this is most likely fatal, umount? */
                printk(KERN_ERR "smb_retry: signal failed [%d]\n", result);
@@ -233,6 +233,7 @@ int smbiod_retry(struct smb_sb_info *server)
        /* FIXME: The retried requests should perhaps get a "time boost". */
 
 out:
+       put_pid(pid);
        return result;
 }
 
index 5b4ae2cc445c0a740bc8a4ece188eb9770a3dfe6..3aa97aa4277f3905467db75021bda4892033969e 100644 (file)
@@ -55,7 +55,7 @@ struct smb_sb_info {
         * generation is incremented.
         */
        unsigned int generation;
-       pid_t conn_pid;
+       struct pid *conn_pid;
        struct smb_conn_opt opt;
        wait_queue_head_t conn_wq;
        int conn_complete;