Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] smbfs: Make conn_pid a struct pid

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>

authored by

Eric W. Biederman and committed by
Linus Torvalds
a71113da 3cec556a

+10 -8
+3 -2
fs/smbfs/inode.c
··· 482 482 smb_close_socket(server); 483 483 484 484 if (server->conn_pid) 485 - kill_proc(server->conn_pid, SIGTERM, 1); 485 + kill_pid(server->conn_pid, SIGTERM, 1); 486 486 487 487 kfree(server->ops); 488 488 smb_unload_nls(server); 489 489 sb->s_fs_info = NULL; 490 490 smb_unlock_server(server); 491 + put_pid(server->conn_pid); 491 492 kfree(server); 492 493 } 493 494 ··· 531 530 INIT_LIST_HEAD(&server->xmitq); 532 531 INIT_LIST_HEAD(&server->recvq); 533 532 server->conn_error = 0; 534 - server->conn_pid = 0; 533 + server->conn_pid = NULL; 535 534 server->state = CONN_INVALID; /* no connection yet */ 536 535 server->generation = 0; 537 536
+3 -3
fs/smbfs/proc.c
··· 877 877 goto out_putf; 878 878 879 879 server->sock_file = filp; 880 - server->conn_pid = current->pid; 880 + server->conn_pid = get_pid(task_pid(current)); 881 881 server->opt = *opt; 882 882 server->generation += 1; 883 883 server->state = CONN_VALID; ··· 971 971 } 972 972 973 973 VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n", 974 - server->opt.protocol, server->opt.max_xmit, server->conn_pid, 975 - server->opt.capabilities); 974 + server->opt.protocol, server->opt.max_xmit, 975 + pid_nr(server->conn_pid), server->opt.capabilities); 976 976 977 977 /* FIXME: this really should be done by smbmount. */ 978 978 if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) {
+3 -2
fs/smbfs/smbiod.c
··· 152 152 { 153 153 struct list_head *head; 154 154 struct smb_request *req; 155 - pid_t pid = server->conn_pid; 155 + struct pid *pid = get_pid(server->conn_pid); 156 156 int result = 0; 157 157 158 158 VERBOSE("state: %d\n", server->state); ··· 222 222 /* 223 223 * Note: use the "priv" flag, as a user process may need to reconnect. 224 224 */ 225 - result = kill_proc(pid, SIGUSR1, 1); 225 + result = kill_pid(pid, SIGUSR1, 1); 226 226 if (result) { 227 227 /* FIXME: this is most likely fatal, umount? */ 228 228 printk(KERN_ERR "smb_retry: signal failed [%d]\n", result); ··· 233 233 /* FIXME: The retried requests should perhaps get a "time boost". */ 234 234 235 235 out: 236 + put_pid(pid); 236 237 return result; 237 238 } 238 239
+1 -1
include/linux/smb_fs_sb.h
··· 55 55 * generation is incremented. 56 56 */ 57 57 unsigned int generation; 58 - pid_t conn_pid; 58 + struct pid *conn_pid; 59 59 struct smb_conn_opt opt; 60 60 wait_queue_head_t conn_wq; 61 61 int conn_complete;