diff options
Diffstat (limited to 'fs/smbfs')
-rw-r--r-- | fs/smbfs/Makefile | 1 | ||||
-rw-r--r-- | fs/smbfs/inode.c | 32 | ||||
-rw-r--r-- | fs/smbfs/request.c | 13 |
3 files changed, 12 insertions, 34 deletions
diff --git a/fs/smbfs/Makefile b/fs/smbfs/Makefile index 93246b7dd6fb..6673ee82cb4c 100644 --- a/fs/smbfs/Makefile +++ b/fs/smbfs/Makefile | |||
@@ -13,7 +13,6 @@ smbfs-objs := proc.o dir.o cache.o sock.o inode.o file.o ioctl.o getopt.o \ | |||
13 | EXTRA_CFLAGS += -DSMBFS_PARANOIA | 13 | EXTRA_CFLAGS += -DSMBFS_PARANOIA |
14 | #EXTRA_CFLAGS += -DSMBFS_DEBUG | 14 | #EXTRA_CFLAGS += -DSMBFS_DEBUG |
15 | #EXTRA_CFLAGS += -DSMBFS_DEBUG_VERBOSE | 15 | #EXTRA_CFLAGS += -DSMBFS_DEBUG_VERBOSE |
16 | #EXTRA_CFLAGS += -DDEBUG_SMB_MALLOC | ||
17 | #EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP | 16 | #EXTRA_CFLAGS += -DDEBUG_SMB_TIMESTAMP |
18 | #EXTRA_CFLAGS += -Werror | 17 | #EXTRA_CFLAGS += -Werror |
19 | 18 | ||
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 6ec88bf59b2d..02e3e82d465c 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -487,11 +487,11 @@ smb_put_super(struct super_block *sb) | |||
487 | if (server->conn_pid) | 487 | if (server->conn_pid) |
488 | kill_proc(server->conn_pid, SIGTERM, 1); | 488 | kill_proc(server->conn_pid, SIGTERM, 1); |
489 | 489 | ||
490 | smb_kfree(server->ops); | 490 | kfree(server->ops); |
491 | smb_unload_nls(server); | 491 | smb_unload_nls(server); |
492 | sb->s_fs_info = NULL; | 492 | sb->s_fs_info = NULL; |
493 | smb_unlock_server(server); | 493 | smb_unlock_server(server); |
494 | smb_kfree(server); | 494 | kfree(server); |
495 | } | 495 | } |
496 | 496 | ||
497 | static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | 497 | static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) |
@@ -519,11 +519,10 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
519 | sb->s_op = &smb_sops; | 519 | sb->s_op = &smb_sops; |
520 | sb->s_time_gran = 100; | 520 | sb->s_time_gran = 100; |
521 | 521 | ||
522 | server = smb_kmalloc(sizeof(struct smb_sb_info), GFP_KERNEL); | 522 | server = kzalloc(sizeof(struct smb_sb_info), GFP_KERNEL); |
523 | if (!server) | 523 | if (!server) |
524 | goto out_no_server; | 524 | goto out_no_server; |
525 | sb->s_fs_info = server; | 525 | sb->s_fs_info = server; |
526 | memset(server, 0, sizeof(struct smb_sb_info)); | ||
527 | 526 | ||
528 | server->super_block = sb; | 527 | server->super_block = sb; |
529 | server->mnt = NULL; | 528 | server->mnt = NULL; |
@@ -542,8 +541,8 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
542 | /* FIXME: move these to the smb_sb_info struct */ | 541 | /* FIXME: move these to the smb_sb_info struct */ |
543 | VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) + | 542 | VERBOSE("alloc chunk = %d\n", sizeof(struct smb_ops) + |
544 | sizeof(struct smb_mount_data_kernel)); | 543 | sizeof(struct smb_mount_data_kernel)); |
545 | mem = smb_kmalloc(sizeof(struct smb_ops) + | 544 | mem = kmalloc(sizeof(struct smb_ops) + |
546 | sizeof(struct smb_mount_data_kernel), GFP_KERNEL); | 545 | sizeof(struct smb_mount_data_kernel), GFP_KERNEL); |
547 | if (!mem) | 546 | if (!mem) |
548 | goto out_no_mem; | 547 | goto out_no_mem; |
549 | 548 | ||
@@ -621,12 +620,12 @@ out_no_root: | |||
621 | out_no_smbiod: | 620 | out_no_smbiod: |
622 | smb_unload_nls(server); | 621 | smb_unload_nls(server); |
623 | out_bad_option: | 622 | out_bad_option: |
624 | smb_kfree(mem); | 623 | kfree(mem); |
625 | out_no_mem: | 624 | out_no_mem: |
626 | if (!server->mnt) | 625 | if (!server->mnt) |
627 | printk(KERN_ERR "smb_fill_super: allocation failure\n"); | 626 | printk(KERN_ERR "smb_fill_super: allocation failure\n"); |
628 | sb->s_fs_info = NULL; | 627 | sb->s_fs_info = NULL; |
629 | smb_kfree(server); | 628 | kfree(server); |
630 | goto out_fail; | 629 | goto out_fail; |
631 | out_wrong_data: | 630 | out_wrong_data: |
632 | printk(KERN_ERR "smbfs: mount_data version %d is not supported\n", ver); | 631 | printk(KERN_ERR "smbfs: mount_data version %d is not supported\n", ver); |
@@ -782,12 +781,6 @@ out: | |||
782 | return error; | 781 | return error; |
783 | } | 782 | } |
784 | 783 | ||
785 | #ifdef DEBUG_SMB_MALLOC | ||
786 | int smb_malloced; | ||
787 | int smb_current_kmalloced; | ||
788 | int smb_current_vmalloced; | ||
789 | #endif | ||
790 | |||
791 | static struct super_block *smb_get_sb(struct file_system_type *fs_type, | 784 | static struct super_block *smb_get_sb(struct file_system_type *fs_type, |
792 | int flags, const char *dev_name, void *data) | 785 | int flags, const char *dev_name, void *data) |
793 | { | 786 | { |
@@ -807,12 +800,6 @@ static int __init init_smb_fs(void) | |||
807 | int err; | 800 | int err; |
808 | DEBUG1("registering ...\n"); | 801 | DEBUG1("registering ...\n"); |
809 | 802 | ||
810 | #ifdef DEBUG_SMB_MALLOC | ||
811 | smb_malloced = 0; | ||
812 | smb_current_kmalloced = 0; | ||
813 | smb_current_vmalloced = 0; | ||
814 | #endif | ||
815 | |||
816 | err = init_inodecache(); | 803 | err = init_inodecache(); |
817 | if (err) | 804 | if (err) |
818 | goto out_inode; | 805 | goto out_inode; |
@@ -837,11 +824,6 @@ static void __exit exit_smb_fs(void) | |||
837 | unregister_filesystem(&smb_fs_type); | 824 | unregister_filesystem(&smb_fs_type); |
838 | smb_destroy_request_cache(); | 825 | smb_destroy_request_cache(); |
839 | destroy_inodecache(); | 826 | destroy_inodecache(); |
840 | #ifdef DEBUG_SMB_MALLOC | ||
841 | printk(KERN_DEBUG "smb_malloced: %d\n", smb_malloced); | ||
842 | printk(KERN_DEBUG "smb_current_kmalloced: %d\n",smb_current_kmalloced); | ||
843 | printk(KERN_DEBUG "smb_current_vmalloced: %d\n",smb_current_vmalloced); | ||
844 | #endif | ||
845 | } | 827 | } |
846 | 828 | ||
847 | module_init(init_smb_fs) | 829 | module_init(init_smb_fs) |
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c index a0f296d9928a..c71c375863cc 100644 --- a/fs/smbfs/request.c +++ b/fs/smbfs/request.c | |||
@@ -68,7 +68,7 @@ static struct smb_request *smb_do_alloc_request(struct smb_sb_info *server, | |||
68 | goto out; | 68 | goto out; |
69 | 69 | ||
70 | if (bufsize > 0) { | 70 | if (bufsize > 0) { |
71 | buf = smb_kmalloc(bufsize, GFP_NOFS); | 71 | buf = kmalloc(bufsize, GFP_NOFS); |
72 | if (!buf) { | 72 | if (!buf) { |
73 | kmem_cache_free(req_cachep, req); | 73 | kmem_cache_free(req_cachep, req); |
74 | return NULL; | 74 | return NULL; |
@@ -124,9 +124,8 @@ static void smb_free_request(struct smb_request *req) | |||
124 | { | 124 | { |
125 | atomic_dec(&req->rq_server->nr_requests); | 125 | atomic_dec(&req->rq_server->nr_requests); |
126 | if (req->rq_buffer && !(req->rq_flags & SMB_REQ_STATIC)) | 126 | if (req->rq_buffer && !(req->rq_flags & SMB_REQ_STATIC)) |
127 | smb_kfree(req->rq_buffer); | 127 | kfree(req->rq_buffer); |
128 | if (req->rq_trans2buffer) | 128 | kfree(req->rq_trans2buffer); |
129 | smb_kfree(req->rq_trans2buffer); | ||
130 | kmem_cache_free(req_cachep, req); | 129 | kmem_cache_free(req_cachep, req); |
131 | } | 130 | } |
132 | 131 | ||
@@ -183,8 +182,7 @@ static int smb_setup_request(struct smb_request *req) | |||
183 | req->rq_err = 0; | 182 | req->rq_err = 0; |
184 | req->rq_errno = 0; | 183 | req->rq_errno = 0; |
185 | req->rq_fragment = 0; | 184 | req->rq_fragment = 0; |
186 | if (req->rq_trans2buffer) | 185 | kfree(req->rq_trans2buffer); |
187 | smb_kfree(req->rq_trans2buffer); | ||
188 | 186 | ||
189 | return 0; | 187 | return 0; |
190 | } | 188 | } |
@@ -647,10 +645,9 @@ static int smb_recv_trans2(struct smb_sb_info *server, struct smb_request *req) | |||
647 | goto out_too_long; | 645 | goto out_too_long; |
648 | 646 | ||
649 | req->rq_trans2bufsize = buf_len; | 647 | req->rq_trans2bufsize = buf_len; |
650 | req->rq_trans2buffer = smb_kmalloc(buf_len, GFP_NOFS); | 648 | req->rq_trans2buffer = kzalloc(buf_len, GFP_NOFS); |
651 | if (!req->rq_trans2buffer) | 649 | if (!req->rq_trans2buffer) |
652 | goto out_no_mem; | 650 | goto out_no_mem; |
653 | memset(req->rq_trans2buffer, 0, buf_len); | ||
654 | 651 | ||
655 | req->rq_parm = req->rq_trans2buffer; | 652 | req->rq_parm = req->rq_trans2buffer; |
656 | req->rq_data = req->rq_trans2buffer + parm_tot; | 653 | req->rq_data = req->rq_trans2buffer + parm_tot; |