diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2006-12-13 03:35:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-13 12:05:53 -0500 |
commit | a71113da44063b587b5a4c2fc94c948a14f2bb43 (patch) | |
tree | c2b804232dcda3e403d43977e7329c21e787e242 /fs | |
parent | 3cec556a84be02bcd8755422eec61f1b9bee4e2f (diff) |
[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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/smbfs/inode.c | 5 | ||||
-rw-r--r-- | fs/smbfs/proc.c | 6 | ||||
-rw-r--r-- | fs/smbfs/smbiod.c | 5 |
3 files changed, 9 insertions, 7 deletions
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 4af4cd729a5a..84dfe3f3482e 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -482,12 +482,13 @@ smb_put_super(struct super_block *sb) | |||
482 | smb_close_socket(server); | 482 | smb_close_socket(server); |
483 | 483 | ||
484 | if (server->conn_pid) | 484 | if (server->conn_pid) |
485 | kill_proc(server->conn_pid, SIGTERM, 1); | 485 | kill_pid(server->conn_pid, SIGTERM, 1); |
486 | 486 | ||
487 | kfree(server->ops); | 487 | kfree(server->ops); |
488 | smb_unload_nls(server); | 488 | smb_unload_nls(server); |
489 | sb->s_fs_info = NULL; | 489 | sb->s_fs_info = NULL; |
490 | smb_unlock_server(server); | 490 | smb_unlock_server(server); |
491 | put_pid(server->conn_pid); | ||
491 | kfree(server); | 492 | kfree(server); |
492 | } | 493 | } |
493 | 494 | ||
@@ -530,7 +531,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
530 | INIT_LIST_HEAD(&server->xmitq); | 531 | INIT_LIST_HEAD(&server->xmitq); |
531 | INIT_LIST_HEAD(&server->recvq); | 532 | INIT_LIST_HEAD(&server->recvq); |
532 | server->conn_error = 0; | 533 | server->conn_error = 0; |
533 | server->conn_pid = 0; | 534 | server->conn_pid = NULL; |
534 | server->state = CONN_INVALID; /* no connection yet */ | 535 | server->state = CONN_INVALID; /* no connection yet */ |
535 | server->generation = 0; | 536 | server->generation = 0; |
536 | 537 | ||
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c index a5ced9e0c6c4..feac46050619 100644 --- a/fs/smbfs/proc.c +++ b/fs/smbfs/proc.c | |||
@@ -877,7 +877,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt) | |||
877 | goto out_putf; | 877 | goto out_putf; |
878 | 878 | ||
879 | server->sock_file = filp; | 879 | server->sock_file = filp; |
880 | server->conn_pid = current->pid; | 880 | server->conn_pid = get_pid(task_pid(current)); |
881 | server->opt = *opt; | 881 | server->opt = *opt; |
882 | server->generation += 1; | 882 | server->generation += 1; |
883 | server->state = CONN_VALID; | 883 | server->state = CONN_VALID; |
@@ -971,8 +971,8 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt) | |||
971 | } | 971 | } |
972 | 972 | ||
973 | VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n", | 973 | VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n", |
974 | server->opt.protocol, server->opt.max_xmit, server->conn_pid, | 974 | server->opt.protocol, server->opt.max_xmit, |
975 | server->opt.capabilities); | 975 | pid_nr(server->conn_pid), server->opt.capabilities); |
976 | 976 | ||
977 | /* FIXME: this really should be done by smbmount. */ | 977 | /* FIXME: this really should be done by smbmount. */ |
978 | if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) { | 978 | if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) { |
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index e67540441288..89eaf31f1d46 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c | |||
@@ -152,7 +152,7 @@ int smbiod_retry(struct smb_sb_info *server) | |||
152 | { | 152 | { |
153 | struct list_head *head; | 153 | struct list_head *head; |
154 | struct smb_request *req; | 154 | struct smb_request *req; |
155 | pid_t pid = server->conn_pid; | 155 | struct pid *pid = get_pid(server->conn_pid); |
156 | int result = 0; | 156 | int result = 0; |
157 | 157 | ||
158 | VERBOSE("state: %d\n", server->state); | 158 | VERBOSE("state: %d\n", server->state); |
@@ -222,7 +222,7 @@ int smbiod_retry(struct smb_sb_info *server) | |||
222 | /* | 222 | /* |
223 | * Note: use the "priv" flag, as a user process may need to reconnect. | 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 | if (result) { | 226 | if (result) { |
227 | /* FIXME: this is most likely fatal, umount? */ | 227 | /* FIXME: this is most likely fatal, umount? */ |
228 | printk(KERN_ERR "smb_retry: signal failed [%d]\n", result); | 228 | printk(KERN_ERR "smb_retry: signal failed [%d]\n", result); |
@@ -233,6 +233,7 @@ int smbiod_retry(struct smb_sb_info *server) | |||
233 | /* FIXME: The retried requests should perhaps get a "time boost". */ | 233 | /* FIXME: The retried requests should perhaps get a "time boost". */ |
234 | 234 | ||
235 | out: | 235 | out: |
236 | put_pid(pid); | ||
236 | return result; | 237 | return result; |
237 | } | 238 | } |
238 | 239 | ||