aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/kmemcheck/kmemcheck.c8
-rw-r--r--fs/autofs4/dev-ioctl.c3
-rw-r--r--fs/ncpfs/dir.c69
-rw-r--r--fs/ncpfs/file.c24
-rw-r--r--fs/ncpfs/getopt.c12
-rw-r--r--fs/ncpfs/inode.c32
-rw-r--r--fs/ncpfs/ioctl.c17
-rw-r--r--fs/ncpfs/mmap.c2
-rw-r--r--fs/ncpfs/ncp_fs.h30
-rw-r--r--fs/ncpfs/ncplib_kernel.c28
-rw-r--r--fs/ncpfs/sock.c49
-rw-r--r--fs/ncpfs/symlink.c2
-rw-r--r--lib/percpu_counter.c2
-rw-r--r--mm/vmscan.c16
14 files changed, 144 insertions, 150 deletions
diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index d87dd6d042d6..dd89a13f1051 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -78,10 +78,16 @@ early_initcall(kmemcheck_init);
78 */ 78 */
79static int __init param_kmemcheck(char *str) 79static int __init param_kmemcheck(char *str)
80{ 80{
81 int val;
82 int ret;
83
81 if (!str) 84 if (!str)
82 return -EINVAL; 85 return -EINVAL;
83 86
84 sscanf(str, "%d", &kmemcheck_enabled); 87 ret = kstrtoint(str, 0, &val);
88 if (ret)
89 return ret;
90 kmemcheck_enabled = val;
85 return 0; 91 return 0;
86} 92}
87 93
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
index 3182c0e68b42..232e03d4780d 100644
--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -103,6 +103,9 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i
103 if (tmp.size < sizeof(tmp)) 103 if (tmp.size < sizeof(tmp))
104 return ERR_PTR(-EINVAL); 104 return ERR_PTR(-EINVAL);
105 105
106 if (tmp.size > (PATH_MAX + sizeof(tmp)))
107 return ERR_PTR(-ENAMETOOLONG);
108
106 return memdup_user(in, tmp.size); 109 return memdup_user(in, tmp.size);
107} 110}
108 111
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index c320ac52353e..08b8ea8c353e 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -339,7 +339,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
339 if (val) 339 if (val)
340 goto finished; 340 goto finished;
341 341
342 DDPRINTK("ncp_lookup_validate: %pd2 not valid, age=%ld, server lookup\n", 342 ncp_dbg(2, "%pd2 not valid, age=%ld, server lookup\n",
343 dentry, NCP_GET_AGE(dentry)); 343 dentry, NCP_GET_AGE(dentry));
344 344
345 len = sizeof(__name); 345 len = sizeof(__name);
@@ -358,7 +358,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
358 res = ncp_obtain_info(server, dir, __name, &(finfo.i)); 358 res = ncp_obtain_info(server, dir, __name, &(finfo.i));
359 } 359 }
360 finfo.volume = finfo.i.volNumber; 360 finfo.volume = finfo.i.volNumber;
361 DDPRINTK("ncp_lookup_validate: looked for %pd/%s, res=%d\n", 361 ncp_dbg(2, "looked for %pd/%s, res=%d\n",
362 dentry->d_parent, __name, res); 362 dentry->d_parent, __name, res);
363 /* 363 /*
364 * If we didn't find it, or if it has a different dirEntNum to 364 * If we didn't find it, or if it has a different dirEntNum to
@@ -372,14 +372,14 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
372 ncp_new_dentry(dentry); 372 ncp_new_dentry(dentry);
373 val=1; 373 val=1;
374 } else 374 } else
375 DDPRINTK("ncp_lookup_validate: found, but dirEntNum changed\n"); 375 ncp_dbg(2, "found, but dirEntNum changed\n");
376 376
377 ncp_update_inode2(inode, &finfo); 377 ncp_update_inode2(inode, &finfo);
378 mutex_unlock(&inode->i_mutex); 378 mutex_unlock(&inode->i_mutex);
379 } 379 }
380 380
381finished: 381finished:
382 DDPRINTK("ncp_lookup_validate: result=%d\n", val); 382 ncp_dbg(2, "result=%d\n", val);
383 dput(parent); 383 dput(parent);
384 return val; 384 return val;
385} 385}
@@ -453,8 +453,7 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx)
453 ctl.page = NULL; 453 ctl.page = NULL;
454 ctl.cache = NULL; 454 ctl.cache = NULL;
455 455
456 DDPRINTK("ncp_readdir: reading %pD2, pos=%d\n", file, 456 ncp_dbg(2, "reading %pD2, pos=%d\n", file, (int)ctx->pos);
457 (int) ctx->pos);
458 457
459 result = -EIO; 458 result = -EIO;
460 /* Do not generate '.' and '..' when server is dead. */ 459 /* Do not generate '.' and '..' when server is dead. */
@@ -697,8 +696,7 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
697 struct ncp_entry_info entry; 696 struct ncp_entry_info entry;
698 int i; 697 int i;
699 698
700 DPRINTK("ncp_read_volume_list: pos=%ld\n", 699 ncp_dbg(1, "pos=%ld\n", (unsigned long)ctx->pos);
701 (unsigned long) ctx->pos);
702 700
703 for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) { 701 for (i = 0; i < NCP_NUMBER_OF_VOLUMES; i++) {
704 int inval_dentry; 702 int inval_dentry;
@@ -708,12 +706,11 @@ ncp_read_volume_list(struct file *file, struct dir_context *ctx,
708 if (!strlen(info.volume_name)) 706 if (!strlen(info.volume_name))
709 continue; 707 continue;
710 708
711 DPRINTK("ncp_read_volume_list: found vol: %s\n", 709 ncp_dbg(1, "found vol: %s\n", info.volume_name);
712 info.volume_name);
713 710
714 if (ncp_lookup_volume(server, info.volume_name, 711 if (ncp_lookup_volume(server, info.volume_name,
715 &entry.i)) { 712 &entry.i)) {
716 DPRINTK("ncpfs: could not lookup vol %s\n", 713 ncp_dbg(1, "could not lookup vol %s\n",
717 info.volume_name); 714 info.volume_name);
718 continue; 715 continue;
719 } 716 }
@@ -738,14 +735,13 @@ ncp_do_readdir(struct file *file, struct dir_context *ctx,
738 int more; 735 int more;
739 size_t bufsize; 736 size_t bufsize;
740 737
741 DPRINTK("ncp_do_readdir: %pD2, fpos=%ld\n", file, 738 ncp_dbg(1, "%pD2, fpos=%ld\n", file, (unsigned long)ctx->pos);
742 (unsigned long) ctx->pos); 739 ncp_vdbg("init %pD, volnum=%d, dirent=%u\n",
743 PPRINTK("ncp_do_readdir: init %pD, volnum=%d, dirent=%u\n", 740 file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);
744 file, NCP_FINFO(dir)->volNumber, NCP_FINFO(dir)->dirEntNum);
745 741
746 err = ncp_initialize_search(server, dir, &seq); 742 err = ncp_initialize_search(server, dir, &seq);
747 if (err) { 743 if (err) {
748 DPRINTK("ncp_do_readdir: init failed, err=%d\n", err); 744 ncp_dbg(1, "init failed, err=%d\n", err);
749 return; 745 return;
750 } 746 }
751 /* We MUST NOT use server->buffer_size handshaked with server if we are 747 /* We MUST NOT use server->buffer_size handshaked with server if we are
@@ -808,8 +804,7 @@ int ncp_conn_logged_in(struct super_block *sb)
808 goto out; 804 goto out;
809 result = -ENOENT; 805 result = -ENOENT;
810 if (ncp_get_volume_root(server, __name, &volNumber, &dirEntNum, &DosDirNum)) { 806 if (ncp_get_volume_root(server, __name, &volNumber, &dirEntNum, &DosDirNum)) {
811 PPRINTK("ncp_conn_logged_in: %s not found\n", 807 ncp_vdbg("%s not found\n", server->m.mounted_vol);
812 server->m.mounted_vol);
813 goto out; 808 goto out;
814 } 809 }
815 dent = sb->s_root; 810 dent = sb->s_root;
@@ -822,10 +817,10 @@ int ncp_conn_logged_in(struct super_block *sb)
822 NCP_FINFO(ino)->DosDirNum = DosDirNum; 817 NCP_FINFO(ino)->DosDirNum = DosDirNum;
823 result = 0; 818 result = 0;
824 } else { 819 } else {
825 DPRINTK("ncpfs: sb->s_root->d_inode == NULL!\n"); 820 ncp_dbg(1, "sb->s_root->d_inode == NULL!\n");
826 } 821 }
827 } else { 822 } else {
828 DPRINTK("ncpfs: sb->s_root == NULL!\n"); 823 ncp_dbg(1, "sb->s_root == NULL!\n");
829 } 824 }
830 } else 825 } else
831 result = 0; 826 result = 0;
@@ -846,7 +841,7 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
846 if (!ncp_conn_valid(server)) 841 if (!ncp_conn_valid(server))
847 goto finished; 842 goto finished;
848 843
849 PPRINTK("ncp_lookup: server lookup for %pd2\n", dentry); 844 ncp_vdbg("server lookup for %pd2\n", dentry);
850 845
851 len = sizeof(__name); 846 len = sizeof(__name);
852 if (ncp_is_server_root(dir)) { 847 if (ncp_is_server_root(dir)) {
@@ -854,15 +849,15 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, unsig
854 dentry->d_name.len, 1); 849 dentry->d_name.len, 1);
855 if (!res) 850 if (!res)
856 res = ncp_lookup_volume(server, __name, &(finfo.i)); 851 res = ncp_lookup_volume(server, __name, &(finfo.i));
857 if (!res) 852 if (!res)
858 ncp_update_known_namespace(server, finfo.i.volNumber, NULL); 853 ncp_update_known_namespace(server, finfo.i.volNumber, NULL);
859 } else { 854 } else {
860 res = ncp_io2vol(server, __name, &len, dentry->d_name.name, 855 res = ncp_io2vol(server, __name, &len, dentry->d_name.name,
861 dentry->d_name.len, !ncp_preserve_case(dir)); 856 dentry->d_name.len, !ncp_preserve_case(dir));
862 if (!res) 857 if (!res)
863 res = ncp_obtain_info(server, dir, __name, &(finfo.i)); 858 res = ncp_obtain_info(server, dir, __name, &(finfo.i));
864 } 859 }
865 PPRINTK("ncp_lookup: looked for %pd2, res=%d\n", dentry, res); 860 ncp_vdbg("looked for %pd2, res=%d\n", dentry, res);
866 /* 861 /*
867 * If we didn't find an entry, make a negative dentry. 862 * If we didn't find an entry, make a negative dentry.
868 */ 863 */
@@ -886,7 +881,7 @@ add_entry:
886 } 881 }
887 882
888finished: 883finished:
889 PPRINTK("ncp_lookup: result=%d\n", error); 884 ncp_vdbg("result=%d\n", error);
890 return ERR_PTR(error); 885 return ERR_PTR(error);
891} 886}
892 887
@@ -909,7 +904,7 @@ out:
909 return error; 904 return error;
910 905
911out_close: 906out_close:
912 PPRINTK("ncp_instantiate: %pd2 failed, closing file\n", dentry); 907 ncp_vdbg("%pd2 failed, closing file\n", dentry);
913 ncp_close_file(NCP_SERVER(dir), finfo->file_handle); 908 ncp_close_file(NCP_SERVER(dir), finfo->file_handle);
914 goto out; 909 goto out;
915} 910}
@@ -923,7 +918,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
923 int opmode; 918 int opmode;
924 __u8 __name[NCP_MAXPATHLEN + 1]; 919 __u8 __name[NCP_MAXPATHLEN + 1];
925 920
926 PPRINTK("ncp_create_new: creating %pd2, mode=%hx\n", dentry, mode); 921 ncp_vdbg("creating %pd2, mode=%hx\n", dentry, mode);
927 922
928 ncp_age_dentry(server, dentry); 923 ncp_age_dentry(server, dentry);
929 len = sizeof(__name); 924 len = sizeof(__name);
@@ -952,7 +947,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode,
952 error = -ENAMETOOLONG; 947 error = -ENAMETOOLONG;
953 else if (result < 0) 948 else if (result < 0)
954 error = result; 949 error = result;
955 DPRINTK("ncp_create: %pd2 failed\n", dentry); 950 ncp_dbg(1, "%pd2 failed\n", dentry);
956 goto out; 951 goto out;
957 } 952 }
958 opmode = O_WRONLY; 953 opmode = O_WRONLY;
@@ -985,7 +980,7 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
985 int error, len; 980 int error, len;
986 __u8 __name[NCP_MAXPATHLEN + 1]; 981 __u8 __name[NCP_MAXPATHLEN + 1];
987 982
988 DPRINTK("ncp_mkdir: making %pd2\n", dentry); 983 ncp_dbg(1, "making %pd2\n", dentry);
989 984
990 ncp_age_dentry(server, dentry); 985 ncp_age_dentry(server, dentry);
991 len = sizeof(__name); 986 len = sizeof(__name);
@@ -1022,7 +1017,7 @@ static int ncp_rmdir(struct inode *dir, struct dentry *dentry)
1022 int error, result, len; 1017 int error, result, len;
1023 __u8 __name[NCP_MAXPATHLEN + 1]; 1018 __u8 __name[NCP_MAXPATHLEN + 1];
1024 1019
1025 DPRINTK("ncp_rmdir: removing %pd2\n", dentry); 1020 ncp_dbg(1, "removing %pd2\n", dentry);
1026 1021
1027 len = sizeof(__name); 1022 len = sizeof(__name);
1028 error = ncp_io2vol(server, __name, &len, dentry->d_name.name, 1023 error = ncp_io2vol(server, __name, &len, dentry->d_name.name,
@@ -1067,13 +1062,13 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
1067 int error; 1062 int error;
1068 1063
1069 server = NCP_SERVER(dir); 1064 server = NCP_SERVER(dir);
1070 DPRINTK("ncp_unlink: unlinking %pd2\n", dentry); 1065 ncp_dbg(1, "unlinking %pd2\n", dentry);
1071 1066
1072 /* 1067 /*
1073 * Check whether to close the file ... 1068 * Check whether to close the file ...
1074 */ 1069 */
1075 if (inode) { 1070 if (inode) {
1076 PPRINTK("ncp_unlink: closing file\n"); 1071 ncp_vdbg("closing file\n");
1077 ncp_make_closed(inode); 1072 ncp_make_closed(inode);
1078 } 1073 }
1079 1074
@@ -1087,7 +1082,7 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
1087#endif 1082#endif
1088 switch (error) { 1083 switch (error) {
1089 case 0x00: 1084 case 0x00:
1090 DPRINTK("ncp: removed %pd2\n", dentry); 1085 ncp_dbg(1, "removed %pd2\n", dentry);
1091 break; 1086 break;
1092 case 0x85: 1087 case 0x85:
1093 case 0x8A: 1088 case 0x8A:
@@ -1120,7 +1115,7 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
1120 int old_len, new_len; 1115 int old_len, new_len;
1121 __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1]; 1116 __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1];
1122 1117
1123 DPRINTK("ncp_rename: %pd2 to %pd2\n", old_dentry, new_dentry); 1118 ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry);
1124 1119
1125 ncp_age_dentry(server, old_dentry); 1120 ncp_age_dentry(server, old_dentry);
1126 ncp_age_dentry(server, new_dentry); 1121 ncp_age_dentry(server, new_dentry);
@@ -1150,8 +1145,8 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
1150#endif 1145#endif
1151 switch (error) { 1146 switch (error) {
1152 case 0x00: 1147 case 0x00:
1153 DPRINTK("ncp renamed %pd -> %pd.\n", 1148 ncp_dbg(1, "renamed %pd -> %pd\n",
1154 old_dentry, new_dentry); 1149 old_dentry, new_dentry);
1155 break; 1150 break;
1156 case 0x9E: 1151 case 0x9E:
1157 error = -ENAMETOOLONG; 1152 error = -ENAMETOOLONG;
@@ -1173,7 +1168,7 @@ static int ncp_mknod(struct inode * dir, struct dentry *dentry,
1173 if (!new_valid_dev(rdev)) 1168 if (!new_valid_dev(rdev))
1174 return -EINVAL; 1169 return -EINVAL;
1175 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) { 1170 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) {
1176 DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%ho\n", mode); 1171 ncp_dbg(1, "mode = 0%ho\n", mode);
1177 return ncp_create_new(dir, dentry, mode, rdev, 0); 1172 return ncp_create_new(dir, dentry, mode, rdev, 0);
1178 } 1173 }
1179 return -EPERM; /* Strange, but true */ 1174 return -EPERM; /* Strange, but true */
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index 8f5074e1ecb9..77640a8bfb87 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -6,6 +6,8 @@
6 * 6 *
7 */ 7 */
8 8
9#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
10
9#include <asm/uaccess.h> 11#include <asm/uaccess.h>
10 12
11#include <linux/time.h> 13#include <linux/time.h>
@@ -34,11 +36,11 @@ int ncp_make_open(struct inode *inode, int right)
34 36
35 error = -EINVAL; 37 error = -EINVAL;
36 if (!inode) { 38 if (!inode) {
37 printk(KERN_ERR "ncp_make_open: got NULL inode\n"); 39 pr_err("%s: got NULL inode\n", __func__);
38 goto out; 40 goto out;
39 } 41 }
40 42
41 DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n", 43 ncp_dbg(1, "opened=%d, volume # %u, dir entry # %u\n",
42 atomic_read(&NCP_FINFO(inode)->opened), 44 atomic_read(&NCP_FINFO(inode)->opened),
43 NCP_FINFO(inode)->volNumber, 45 NCP_FINFO(inode)->volNumber,
44 NCP_FINFO(inode)->dirEntNum); 46 NCP_FINFO(inode)->dirEntNum);
@@ -71,7 +73,7 @@ int ncp_make_open(struct inode *inode, int right)
71 break; 73 break;
72 } 74 }
73 if (result) { 75 if (result) {
74 PPRINTK("ncp_make_open: failed, result=%d\n", result); 76 ncp_vdbg("failed, result=%d\n", result);
75 goto out_unlock; 77 goto out_unlock;
76 } 78 }
77 /* 79 /*
@@ -83,7 +85,7 @@ int ncp_make_open(struct inode *inode, int right)
83 } 85 }
84 86
85 access = NCP_FINFO(inode)->access; 87 access = NCP_FINFO(inode)->access;
86 PPRINTK("ncp_make_open: file open, access=%x\n", access); 88 ncp_vdbg("file open, access=%x\n", access);
87 if (access == right || access == O_RDWR) { 89 if (access == right || access == O_RDWR) {
88 atomic_inc(&NCP_FINFO(inode)->opened); 90 atomic_inc(&NCP_FINFO(inode)->opened);
89 error = 0; 91 error = 0;
@@ -107,7 +109,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
107 void* freepage; 109 void* freepage;
108 size_t freelen; 110 size_t freelen;
109 111
110 DPRINTK("ncp_file_read: enter %pd2\n", dentry); 112 ncp_dbg(1, "enter %pd2\n", dentry);
111 113
112 pos = *ppos; 114 pos = *ppos;
113 115
@@ -124,7 +126,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
124 126
125 error = ncp_make_open(inode, O_RDONLY); 127 error = ncp_make_open(inode, O_RDONLY);
126 if (error) { 128 if (error) {
127 DPRINTK(KERN_ERR "ncp_file_read: open failed, error=%d\n", error); 129 ncp_dbg(1, "open failed, error=%d\n", error);
128 return error; 130 return error;
129 } 131 }
130 132
@@ -165,7 +167,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
165 167
166 file_accessed(file); 168 file_accessed(file);
167 169
168 DPRINTK("ncp_file_read: exit %pd2\n", dentry); 170 ncp_dbg(1, "exit %pd2\n", dentry);
169outrel: 171outrel:
170 ncp_inode_close(inode); 172 ncp_inode_close(inode);
171 return already_read ? already_read : error; 173 return already_read ? already_read : error;
@@ -182,7 +184,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
182 int errno; 184 int errno;
183 void* bouncebuffer; 185 void* bouncebuffer;
184 186
185 DPRINTK("ncp_file_write: enter %pd2\n", dentry); 187 ncp_dbg(1, "enter %pd2\n", dentry);
186 if ((ssize_t) count < 0) 188 if ((ssize_t) count < 0)
187 return -EINVAL; 189 return -EINVAL;
188 pos = *ppos; 190 pos = *ppos;
@@ -211,7 +213,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
211 return 0; 213 return 0;
212 errno = ncp_make_open(inode, O_WRONLY); 214 errno = ncp_make_open(inode, O_WRONLY);
213 if (errno) { 215 if (errno) {
214 DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno); 216 ncp_dbg(1, "open failed, error=%d\n", errno);
215 return errno; 217 return errno;
216 } 218 }
217 bufsize = NCP_SERVER(inode)->buffer_size; 219 bufsize = NCP_SERVER(inode)->buffer_size;
@@ -261,7 +263,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
261 i_size_write(inode, pos); 263 i_size_write(inode, pos);
262 mutex_unlock(&inode->i_mutex); 264 mutex_unlock(&inode->i_mutex);
263 } 265 }
264 DPRINTK("ncp_file_write: exit %pd2\n", dentry); 266 ncp_dbg(1, "exit %pd2\n", dentry);
265outrel: 267outrel:
266 ncp_inode_close(inode); 268 ncp_inode_close(inode);
267 return already_written ? already_written : errno; 269 return already_written ? already_written : errno;
@@ -269,7 +271,7 @@ outrel:
269 271
270static int ncp_release(struct inode *inode, struct file *file) { 272static int ncp_release(struct inode *inode, struct file *file) {
271 if (ncp_make_closed(inode)) { 273 if (ncp_make_closed(inode)) {
272 DPRINTK("ncp_release: failed to close\n"); 274 ncp_dbg(1, "failed to close\n");
273 } 275 }
274 return 0; 276 return 0;
275} 277}
diff --git a/fs/ncpfs/getopt.c b/fs/ncpfs/getopt.c
index 0af3349de851..03ffde1f44d6 100644
--- a/fs/ncpfs/getopt.c
+++ b/fs/ncpfs/getopt.c
@@ -2,6 +2,8 @@
2 * getopt.c 2 * getopt.c
3 */ 3 */
4 4
5#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6
5#include <linux/kernel.h> 7#include <linux/kernel.h>
6#include <linux/string.h> 8#include <linux/string.h>
7 9
@@ -46,8 +48,8 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts
46 if (opts->has_arg & OPT_NOPARAM) { 48 if (opts->has_arg & OPT_NOPARAM) {
47 return opts->val; 49 return opts->val;
48 } 50 }
49 printk(KERN_INFO "%s: the %s option requires an argument\n", 51 pr_info("%s: the %s option requires an argument\n",
50 caller, token); 52 caller, token);
51 return -EINVAL; 53 return -EINVAL;
52 } 54 }
53 if (opts->has_arg & OPT_INT) { 55 if (opts->has_arg & OPT_INT) {
@@ -57,18 +59,18 @@ int ncp_getopt(const char *caller, char **options, const struct ncp_option *opts
57 if (!*v) { 59 if (!*v) {
58 return opts->val; 60 return opts->val;
59 } 61 }
60 printk(KERN_INFO "%s: invalid numeric value in %s=%s\n", 62 pr_info("%s: invalid numeric value in %s=%s\n",
61 caller, token, val); 63 caller, token, val);
62 return -EDOM; 64 return -EDOM;
63 } 65 }
64 if (opts->has_arg & OPT_STRING) { 66 if (opts->has_arg & OPT_STRING) {
65 return opts->val; 67 return opts->val;
66 } 68 }
67 printk(KERN_INFO "%s: unexpected argument %s to the %s option\n", 69 pr_info("%s: unexpected argument %s to the %s option\n",
68 caller, val, token); 70 caller, val, token);
69 return -EINVAL; 71 return -EINVAL;
70 } 72 }
71 } 73 }
72 printk(KERN_INFO "%s: Unrecognized mount option %s\n", caller, token); 74 pr_info("%s: Unrecognized mount option %s\n", caller, token);
73 return -EOPNOTSUPP; 75 return -EOPNOTSUPP;
74} 76}
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 647d86d2db39..81b4f643ecef 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -9,6 +9,8 @@
9 * 9 *
10 */ 10 */
11 11
12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13
12#include <linux/module.h> 14#include <linux/module.h>
13 15
14#include <asm/uaccess.h> 16#include <asm/uaccess.h>
@@ -133,7 +135,7 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
133 NCP_FINFO(inode)->access = nwinfo->access; 135 NCP_FINFO(inode)->access = nwinfo->access;
134 memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle, 136 memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
135 sizeof(nwinfo->file_handle)); 137 sizeof(nwinfo->file_handle));
136 DPRINTK("ncp_update_inode: updated %s, volnum=%d, dirent=%u\n", 138 ncp_dbg(1, "updated %s, volnum=%d, dirent=%u\n",
137 nwinfo->i.entryName, NCP_FINFO(inode)->volNumber, 139 nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
138 NCP_FINFO(inode)->dirEntNum); 140 NCP_FINFO(inode)->dirEntNum);
139} 141}
@@ -141,8 +143,7 @@ void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
141static void ncp_update_dates(struct inode *inode, struct nw_info_struct *nwi) 143static void ncp_update_dates(struct inode *inode, struct nw_info_struct *nwi)
142{ 144{
143 /* NFS namespace mode overrides others if it's set. */ 145 /* NFS namespace mode overrides others if it's set. */
144 DPRINTK(KERN_DEBUG "ncp_update_dates_and_mode: (%s) nfs.mode=0%o\n", 146 ncp_dbg(1, "(%s) nfs.mode=0%o\n", nwi->entryName, nwi->nfs.mode);
145 nwi->entryName, nwi->nfs.mode);
146 if (nwi->nfs.mode) { 147 if (nwi->nfs.mode) {
147 /* XXX Security? */ 148 /* XXX Security? */
148 inode->i_mode = nwi->nfs.mode; 149 inode->i_mode = nwi->nfs.mode;
@@ -230,7 +231,7 @@ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
230 231
231 ncp_update_attrs(inode, nwinfo); 232 ncp_update_attrs(inode, nwinfo);
232 233
233 DDPRINTK("ncp_read_inode: inode->i_mode = %u\n", inode->i_mode); 234 ncp_dbg(2, "inode->i_mode = %u\n", inode->i_mode);
234 235
235 set_nlink(inode, 1); 236 set_nlink(inode, 1);
236 inode->i_uid = server->m.uid; 237 inode->i_uid = server->m.uid;
@@ -258,7 +259,7 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
258 struct inode *inode; 259 struct inode *inode;
259 260
260 if (info == NULL) { 261 if (info == NULL) {
261 printk(KERN_ERR "ncp_iget: info is NULL\n"); 262 pr_err("%s: info is NULL\n", __func__);
262 return NULL; 263 return NULL;
263 } 264 }
264 265
@@ -290,7 +291,7 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
290 } 291 }
291 insert_inode_hash(inode); 292 insert_inode_hash(inode);
292 } else 293 } else
293 printk(KERN_ERR "ncp_iget: iget failed!\n"); 294 pr_err("%s: iget failed!\n", __func__);
294 return inode; 295 return inode;
295} 296}
296 297
@@ -301,12 +302,12 @@ ncp_evict_inode(struct inode *inode)
301 clear_inode(inode); 302 clear_inode(inode);
302 303
303 if (S_ISDIR(inode->i_mode)) { 304 if (S_ISDIR(inode->i_mode)) {
304 DDPRINTK("ncp_evict_inode: put directory %ld\n", inode->i_ino); 305 ncp_dbg(2, "put directory %ld\n", inode->i_ino);
305 } 306 }
306 307
307 if (ncp_make_closed(inode) != 0) { 308 if (ncp_make_closed(inode) != 0) {
308 /* We can't do anything but complain. */ 309 /* We can't do anything but complain. */
309 printk(KERN_ERR "ncp_evict_inode: could not close\n"); 310 pr_err("%s: could not close\n", __func__);
310 } 311 }
311} 312}
312 313
@@ -621,7 +622,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
621 now because of PATH_MAX changes.. */ 622 now because of PATH_MAX changes.. */
622 if (server->m.time_out < 1) { 623 if (server->m.time_out < 1) {
623 server->m.time_out = 10; 624 server->m.time_out = 10;
624 printk(KERN_INFO "You need to recompile your ncpfs utils..\n"); 625 pr_info("You need to recompile your ncpfs utils..\n");
625 } 626 }
626 server->m.time_out = server->m.time_out * HZ / 100; 627 server->m.time_out = server->m.time_out * HZ / 100;
627 server->m.file_mode = (server->m.file_mode & S_IRWXUGO) | S_IFREG; 628 server->m.file_mode = (server->m.file_mode & S_IRWXUGO) | S_IFREG;
@@ -682,7 +683,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
682 ncp_unlock_server(server); 683 ncp_unlock_server(server);
683 if (error < 0) 684 if (error < 0)
684 goto out_rxbuf; 685 goto out_rxbuf;
685 DPRINTK("ncp_fill_super: NCP_SBP(sb) = %x\n", (int) NCP_SBP(sb)); 686 ncp_dbg(1, "NCP_SBP(sb) = %p\n", NCP_SBP(sb));
686 687
687 error = -EMSGSIZE; /* -EREMOTESIDEINCOMPATIBLE */ 688 error = -EMSGSIZE; /* -EREMOTESIDEINCOMPATIBLE */
688#ifdef CONFIG_NCPFS_PACKET_SIGNING 689#ifdef CONFIG_NCPFS_PACKET_SIGNING
@@ -710,7 +711,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
710 if (ncp_negotiate_buffersize(server, default_bufsize, 711 if (ncp_negotiate_buffersize(server, default_bufsize,
711 &(server->buffer_size)) != 0) 712 &(server->buffer_size)) != 0)
712 goto out_disconnect; 713 goto out_disconnect;
713 DPRINTK("ncpfs: bufsize = %d\n", server->buffer_size); 714 ncp_dbg(1, "bufsize = %d\n", server->buffer_size);
714 715
715 memset(&finfo, 0, sizeof(finfo)); 716 memset(&finfo, 0, sizeof(finfo));
716 finfo.i.attributes = aDIR; 717 finfo.i.attributes = aDIR;
@@ -739,7 +740,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
739 root_inode = ncp_iget(sb, &finfo); 740 root_inode = ncp_iget(sb, &finfo);
740 if (!root_inode) 741 if (!root_inode)
741 goto out_disconnect; 742 goto out_disconnect;
742 DPRINTK("ncp_fill_super: root vol=%d\n", NCP_FINFO(root_inode)->volNumber); 743 ncp_dbg(1, "root vol=%d\n", NCP_FINFO(root_inode)->volNumber);
743 sb->s_root = d_make_root(root_inode); 744 sb->s_root = d_make_root(root_inode);
744 if (!sb->s_root) 745 if (!sb->s_root)
745 goto out_disconnect; 746 goto out_disconnect;
@@ -985,8 +986,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
985 if ((attr->ia_valid & ATTR_SIZE) != 0) { 986 if ((attr->ia_valid & ATTR_SIZE) != 0) {
986 int written; 987 int written;
987 988
988 DPRINTK("ncpfs: trying to change size to %ld\n", 989 ncp_dbg(1, "trying to change size to %llu\n", attr->ia_size);
989 attr->ia_size);
990 990
991 if ((result = ncp_make_open(inode, O_WRONLY)) < 0) { 991 if ((result = ncp_make_open(inode, O_WRONLY)) < 0) {
992 result = -EACCES; 992 result = -EACCES;
@@ -1072,7 +1072,7 @@ MODULE_ALIAS_FS("ncpfs");
1072static int __init init_ncp_fs(void) 1072static int __init init_ncp_fs(void)
1073{ 1073{
1074 int err; 1074 int err;
1075 DPRINTK("ncpfs: init_ncp_fs called\n"); 1075 ncp_dbg(1, "called\n");
1076 1076
1077 err = init_inodecache(); 1077 err = init_inodecache();
1078 if (err) 1078 if (err)
@@ -1089,7 +1089,7 @@ out1:
1089 1089
1090static void __exit exit_ncp_fs(void) 1090static void __exit exit_ncp_fs(void)
1091{ 1091{
1092 DPRINTK("ncpfs: exit_ncp_fs called\n"); 1092 ncp_dbg(1, "called\n");
1093 unregister_filesystem(&ncp_fs_type); 1093 unregister_filesystem(&ncp_fs_type);
1094 destroy_inodecache(); 1094 destroy_inodecache();
1095} 1095}
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 60426ccb3b65..d5659d96ee7f 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -41,7 +41,7 @@ ncp_get_fs_info(struct ncp_server * server, struct inode *inode,
41 return -EFAULT; 41 return -EFAULT;
42 42
43 if (info.version != NCP_GET_FS_INFO_VERSION) { 43 if (info.version != NCP_GET_FS_INFO_VERSION) {
44 DPRINTK("info.version invalid: %d\n", info.version); 44 ncp_dbg(1, "info.version invalid: %d\n", info.version);
45 return -EINVAL; 45 return -EINVAL;
46 } 46 }
47 /* TODO: info.addr = server->m.serv_addr; */ 47 /* TODO: info.addr = server->m.serv_addr; */
@@ -66,7 +66,7 @@ ncp_get_fs_info_v2(struct ncp_server * server, struct inode *inode,
66 return -EFAULT; 66 return -EFAULT;
67 67
68 if (info2.version != NCP_GET_FS_INFO_VERSION_V2) { 68 if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
69 DPRINTK("info.version invalid: %d\n", info2.version); 69 ncp_dbg(1, "info.version invalid: %d\n", info2.version);
70 return -EINVAL; 70 return -EINVAL;
71 } 71 }
72 info2.mounted_uid = from_kuid_munged(current_user_ns(), server->m.mounted_uid); 72 info2.mounted_uid = from_kuid_munged(current_user_ns(), server->m.mounted_uid);
@@ -132,7 +132,7 @@ ncp_get_compat_fs_info_v2(struct ncp_server * server, struct inode *inode,
132 return -EFAULT; 132 return -EFAULT;
133 133
134 if (info2.version != NCP_GET_FS_INFO_VERSION_V2) { 134 if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
135 DPRINTK("info.version invalid: %d\n", info2.version); 135 ncp_dbg(1, "info.version invalid: %d\n", info2.version);
136 return -EINVAL; 136 return -EINVAL;
137 } 137 }
138 info2.mounted_uid = from_kuid_munged(current_user_ns(), server->m.mounted_uid); 138 info2.mounted_uid = from_kuid_munged(current_user_ns(), server->m.mounted_uid);
@@ -308,8 +308,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
308 else 308 else
309 result = server->reply_size; 309 result = server->reply_size;
310 ncp_unlock_server(server); 310 ncp_unlock_server(server);
311 DPRINTK("ncp_ioctl: copy %d bytes\n", 311 ncp_dbg(1, "copy %d bytes\n", result);
312 result);
313 if (result >= 0) 312 if (result >= 0)
314 if (copy_to_user(request.data, bouncebuffer, result)) 313 if (copy_to_user(request.data, bouncebuffer, result))
315 result = -EFAULT; 314 result = -EFAULT;
@@ -385,9 +384,9 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
385 sr.namespace = server->name_space[sr.volNumber]; 384 sr.namespace = server->name_space[sr.volNumber];
386 result = 0; 385 result = 0;
387 } else 386 } else
388 DPRINTK("ncpfs: s_root->d_inode==NULL\n"); 387 ncp_dbg(1, "s_root->d_inode==NULL\n");
389 } else 388 } else
390 DPRINTK("ncpfs: s_root==NULL\n"); 389 ncp_dbg(1, "s_root==NULL\n");
391 } else { 390 } else {
392 sr.volNumber = -1; 391 sr.volNumber = -1;
393 sr.namespace = 0; 392 sr.namespace = 0;
@@ -440,11 +439,11 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
440 NCP_FINFO(s_inode)->DosDirNum = dosde; 439 NCP_FINFO(s_inode)->DosDirNum = dosde;
441 server->root_setuped = 1; 440 server->root_setuped = 1;
442 } else { 441 } else {
443 DPRINTK("ncpfs: s_root->d_inode==NULL\n"); 442 ncp_dbg(1, "s_root->d_inode==NULL\n");
444 result = -EIO; 443 result = -EIO;
445 } 444 }
446 } else { 445 } else {
447 DPRINTK("ncpfs: s_root==NULL\n"); 446 ncp_dbg(1, "s_root==NULL\n");
448 result = -EIO; 447 result = -EIO;
449 } 448 }
450 } 449 }
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index 3c5dd55d284c..b359d12eb359 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -107,7 +107,7 @@ int ncp_mmap(struct file *file, struct vm_area_struct *vma)
107{ 107{
108 struct inode *inode = file_inode(file); 108 struct inode *inode = file_inode(file);
109 109
110 DPRINTK("ncp_mmap: called\n"); 110 ncp_dbg(1, "called\n");
111 111
112 if (!ncp_conn_valid(NCP_SERVER(inode))) 112 if (!ncp_conn_valid(NCP_SERVER(inode)))
113 return -EIO; 113 return -EIO;
diff --git a/fs/ncpfs/ncp_fs.h b/fs/ncpfs/ncp_fs.h
index 31831afe1c3b..b9f69e1b1f43 100644
--- a/fs/ncpfs/ncp_fs.h
+++ b/fs/ncpfs/ncp_fs.h
@@ -2,30 +2,32 @@
2#include "ncp_fs_i.h" 2#include "ncp_fs_i.h"
3#include "ncp_fs_sb.h" 3#include "ncp_fs_sb.h"
4 4
5/* define because it is easy to change PRINTK to {*}PRINTK */
6#define PRINTK(format, args...) printk(KERN_DEBUG format , ## args)
7
8#undef NCPFS_PARANOIA 5#undef NCPFS_PARANOIA
9#ifdef NCPFS_PARANOIA 6#ifdef NCPFS_PARANOIA
10#define PPRINTK(format, args...) PRINTK(format , ## args) 7#define ncp_vdbg(fmt, ...) \
8 pr_debug(fmt, ##__VA_ARGS__)
11#else 9#else
12#define PPRINTK(format, args...) 10#define ncp_vdbg(fmt, ...) \
11do { \
12 if (0) \
13 pr_debug(fmt, ##__VA_ARGS__); \
14} while (0)
13#endif 15#endif
14 16
15#ifndef DEBUG_NCP 17#ifndef DEBUG_NCP
16#define DEBUG_NCP 0 18#define DEBUG_NCP 0
17#endif 19#endif
18#if DEBUG_NCP > 0 20
19#define DPRINTK(format, args...) PRINTK(format , ## args) 21#if DEBUG_NCP > 0 && !defined(DEBUG)
20#else 22#define DEBUG
21#define DPRINTK(format, args...)
22#endif
23#if DEBUG_NCP > 1
24#define DDPRINTK(format, args...) PRINTK(format , ## args)
25#else
26#define DDPRINTK(format, args...)
27#endif 23#endif
28 24
25#define ncp_dbg(level, fmt, ...) \
26do { \
27 if (level <= DEBUG_NCP) \
28 pr_debug(fmt, ##__VA_ARGS__); \
29} while (0)
30
29#define NCP_MAX_RPC_TIMEOUT (6*HZ) 31#define NCP_MAX_RPC_TIMEOUT (6*HZ)
30 32
31 33
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c
index 981a95617fc9..482387532f54 100644
--- a/fs/ncpfs/ncplib_kernel.c
+++ b/fs/ncpfs/ncplib_kernel.c
@@ -9,14 +9,14 @@
9 * 9 *
10 */ 10 */
11 11
12 12#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13 13
14#include "ncp_fs.h" 14#include "ncp_fs.h"
15 15
16static inline void assert_server_locked(struct ncp_server *server) 16static inline void assert_server_locked(struct ncp_server *server)
17{ 17{
18 if (server->lock == 0) { 18 if (server->lock == 0) {
19 DPRINTK("ncpfs: server not locked!\n"); 19 ncp_dbg(1, "server not locked!\n");
20 } 20 }
21} 21}
22 22
@@ -75,7 +75,7 @@ static void ncp_add_pstring(struct ncp_server *server, const char *s)
75 int len = strlen(s); 75 int len = strlen(s);
76 assert_server_locked(server); 76 assert_server_locked(server);
77 if (len > 255) { 77 if (len > 255) {
78 DPRINTK("ncpfs: string too long: %s\n", s); 78 ncp_dbg(1, "string too long: %s\n", s);
79 len = 255; 79 len = 255;
80 } 80 }
81 ncp_add_byte(server, len); 81 ncp_add_byte(server, len);
@@ -225,7 +225,7 @@ int ncp_get_volume_info_with_number(struct ncp_server* server,
225 result = -EIO; 225 result = -EIO;
226 len = ncp_reply_byte(server, 29); 226 len = ncp_reply_byte(server, 29);
227 if (len > NCP_VOLNAME_LEN) { 227 if (len > NCP_VOLNAME_LEN) {
228 DPRINTK("ncpfs: volume name too long: %d\n", len); 228 ncp_dbg(1, "volume name too long: %d\n", len);
229 goto out; 229 goto out;
230 } 230 }
231 memcpy(&(target->volume_name), ncp_reply_data(server, 30), len); 231 memcpy(&(target->volume_name), ncp_reply_data(server, 30), len);
@@ -259,7 +259,7 @@ int ncp_get_directory_info(struct ncp_server* server, __u8 n,
259 result = -EIO; 259 result = -EIO;
260 len = ncp_reply_byte(server, 21); 260 len = ncp_reply_byte(server, 21);
261 if (len > NCP_VOLNAME_LEN) { 261 if (len > NCP_VOLNAME_LEN) {
262 DPRINTK("ncpfs: volume name too long: %d\n", len); 262 ncp_dbg(1, "volume name too long: %d\n", len);
263 goto out; 263 goto out;
264 } 264 }
265 memcpy(&(target->volume_name), ncp_reply_data(server, 22), len); 265 memcpy(&(target->volume_name), ncp_reply_data(server, 22), len);
@@ -295,9 +295,9 @@ ncp_make_closed(struct inode *inode)
295 err = ncp_close_file(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle); 295 err = ncp_close_file(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle);
296 296
297 if (!err) 297 if (!err)
298 PPRINTK("ncp_make_closed: volnum=%d, dirent=%u, error=%d\n", 298 ncp_vdbg("volnum=%d, dirent=%u, error=%d\n",
299 NCP_FINFO(inode)->volNumber, 299 NCP_FINFO(inode)->volNumber,
300 NCP_FINFO(inode)->dirEntNum, err); 300 NCP_FINFO(inode)->dirEntNum, err);
301 } 301 }
302 mutex_unlock(&NCP_FINFO(inode)->open_mutex); 302 mutex_unlock(&NCP_FINFO(inode)->open_mutex);
303 return err; 303 return err;
@@ -394,8 +394,7 @@ int ncp_obtain_nfs_info(struct ncp_server *server,
394 394
395 if ((result = ncp_request(server, 87)) == 0) { 395 if ((result = ncp_request(server, 87)) == 0) {
396 ncp_extract_nfs_info(ncp_reply_data(server, 0), &target->nfs); 396 ncp_extract_nfs_info(ncp_reply_data(server, 0), &target->nfs);
397 DPRINTK(KERN_DEBUG 397 ncp_dbg(1, "(%s) mode=0%o, rdev=0x%x\n",
398 "ncp_obtain_nfs_info: (%s) mode=0%o, rdev=0x%x\n",
399 target->entryName, target->nfs.mode, 398 target->entryName, target->nfs.mode,
400 target->nfs.rdev); 399 target->nfs.rdev);
401 } else { 400 } else {
@@ -425,7 +424,7 @@ int ncp_obtain_info(struct ncp_server *server, struct inode *dir, const char *pa
425 int result; 424 int result;
426 425
427 if (target == NULL) { 426 if (target == NULL) {
428 printk(KERN_ERR "ncp_obtain_info: invalid call\n"); 427 pr_err("%s: invalid call\n", __func__);
429 return -EINVAL; 428 return -EINVAL;
430 } 429 }
431 ncp_init_request(server); 430 ncp_init_request(server);
@@ -498,7 +497,7 @@ ncp_get_known_namespace(struct ncp_server *server, __u8 volume)
498 namespace = ncp_reply_data(server, 2); 497 namespace = ncp_reply_data(server, 2);
499 498
500 while (no_namespaces > 0) { 499 while (no_namespaces > 0) {
501 DPRINTK("get_namespaces: found %d on %d\n", *namespace, volume); 500 ncp_dbg(1, "found %d on %d\n", *namespace, volume);
502 501
503#ifdef CONFIG_NCPFS_NFS_NS 502#ifdef CONFIG_NCPFS_NFS_NS
504 if ((*namespace == NW_NS_NFS) && !(server->m.flags&NCP_MOUNT_NO_NFS)) 503 if ((*namespace == NW_NS_NFS) && !(server->m.flags&NCP_MOUNT_NO_NFS))
@@ -531,8 +530,7 @@ ncp_update_known_namespace(struct ncp_server *server, __u8 volume, int *ret_ns)
531 if (ret_ns) 530 if (ret_ns)
532 *ret_ns = ns; 531 *ret_ns = ns;
533 532
534 DPRINTK("lookup_vol: namespace[%d] = %d\n", 533 ncp_dbg(1, "namespace[%d] = %d\n", volume, server->name_space[volume]);
535 volume, server->name_space[volume]);
536 534
537 if (server->name_space[volume] == ns) 535 if (server->name_space[volume] == ns)
538 return 0; 536 return 0;
@@ -596,7 +594,7 @@ ncp_get_volume_root(struct ncp_server *server,
596{ 594{
597 int result; 595 int result;
598 596
599 DPRINTK("ncp_get_volume_root: looking up vol %s\n", volname); 597 ncp_dbg(1, "looking up vol %s\n", volname);
600 598
601 ncp_init_request(server); 599 ncp_init_request(server);
602 ncp_add_byte(server, 22); /* Subfunction: Generate dir handle */ 600 ncp_add_byte(server, 22); /* Subfunction: Generate dir handle */
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c
index 3a1587222c8a..04a69a4d8e96 100644
--- a/fs/ncpfs/sock.c
+++ b/fs/ncpfs/sock.c
@@ -8,6 +8,7 @@
8 * 8 *
9 */ 9 */
10 10
11#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11 12
12#include <linux/time.h> 13#include <linux/time.h>
13#include <linux/errno.h> 14#include <linux/errno.h>
@@ -231,7 +232,7 @@ static void __ncptcp_try_send(struct ncp_server *server)
231 return; 232 return;
232 233
233 if (result < 0) { 234 if (result < 0) {
234 printk(KERN_ERR "ncpfs: tcp: Send failed: %d\n", result); 235 pr_err("tcp: Send failed: %d\n", result);
235 __ncp_abort_request(server, rq, result); 236 __ncp_abort_request(server, rq, result);
236 return; 237 return;
237 } 238 }
@@ -332,7 +333,7 @@ static int ncp_add_request(struct ncp_server *server, struct ncp_request_reply *
332 mutex_lock(&server->rcv.creq_mutex); 333 mutex_lock(&server->rcv.creq_mutex);
333 if (!ncp_conn_valid(server)) { 334 if (!ncp_conn_valid(server)) {
334 mutex_unlock(&server->rcv.creq_mutex); 335 mutex_unlock(&server->rcv.creq_mutex);
335 printk(KERN_ERR "ncpfs: tcp: Server died\n"); 336 pr_err("tcp: Server died\n");
336 return -EIO; 337 return -EIO;
337 } 338 }
338 ncp_req_get(req); 339 ncp_req_get(req);
@@ -405,15 +406,15 @@ void ncpdgram_rcv_proc(struct work_struct *work)
405 } 406 }
406 result = _recv(sock, buf, sizeof(buf), MSG_DONTWAIT); 407 result = _recv(sock, buf, sizeof(buf), MSG_DONTWAIT);
407 if (result < 0) { 408 if (result < 0) {
408 DPRINTK("recv failed with %d\n", result); 409 ncp_dbg(1, "recv failed with %d\n", result);
409 continue; 410 continue;
410 } 411 }
411 if (result < 10) { 412 if (result < 10) {
412 DPRINTK("too short (%u) watchdog packet\n", result); 413 ncp_dbg(1, "too short (%u) watchdog packet\n", result);
413 continue; 414 continue;
414 } 415 }
415 if (buf[9] != '?') { 416 if (buf[9] != '?') {
416 DPRINTK("bad signature (%02X) in watchdog packet\n", buf[9]); 417 ncp_dbg(1, "bad signature (%02X) in watchdog packet\n", buf[9]);
417 continue; 418 continue;
418 } 419 }
419 buf[9] = 'Y'; 420 buf[9] = 'Y';
@@ -448,7 +449,7 @@ void ncpdgram_rcv_proc(struct work_struct *work)
448 result -= 8; 449 result -= 8;
449 hdrl = sock->sk->sk_family == AF_INET ? 8 : 6; 450 hdrl = sock->sk->sk_family == AF_INET ? 8 : 6;
450 if (sign_verify_reply(server, server->rxbuf + hdrl, result - hdrl, cpu_to_le32(result), server->rxbuf + result)) { 451 if (sign_verify_reply(server, server->rxbuf + hdrl, result - hdrl, cpu_to_le32(result), server->rxbuf + result)) {
451 printk(KERN_INFO "ncpfs: Signature violation\n"); 452 pr_info("Signature violation\n");
452 result = -EIO; 453 result = -EIO;
453 } 454 }
454 } 455 }
@@ -524,7 +525,7 @@ static int do_tcp_rcv(struct ncp_server *server, void *buffer, size_t len)
524 return result; 525 return result;
525 } 526 }
526 if (result > len) { 527 if (result > len) {
527 printk(KERN_ERR "ncpfs: tcp: bug in recvmsg (%u > %Zu)\n", result, len); 528 pr_err("tcp: bug in recvmsg (%u > %Zu)\n", result, len);
528 return -EIO; 529 return -EIO;
529 } 530 }
530 return result; 531 return result;
@@ -552,9 +553,9 @@ static int __ncptcp_rcv_proc(struct ncp_server *server)
552 __ncptcp_abort(server); 553 __ncptcp_abort(server);
553 } 554 }
554 if (result < 0) { 555 if (result < 0) {
555 printk(KERN_ERR "ncpfs: tcp: error in recvmsg: %d\n", result); 556 pr_err("tcp: error in recvmsg: %d\n", result);
556 } else { 557 } else {
557 DPRINTK(KERN_ERR "ncpfs: tcp: EOF\n"); 558 ncp_dbg(1, "tcp: EOF\n");
558 } 559 }
559 return -EIO; 560 return -EIO;
560 } 561 }
@@ -566,20 +567,20 @@ static int __ncptcp_rcv_proc(struct ncp_server *server)
566 switch (server->rcv.state) { 567 switch (server->rcv.state) {
567 case 0: 568 case 0:
568 if (server->rcv.buf.magic != htonl(NCP_TCP_RCVD_MAGIC)) { 569 if (server->rcv.buf.magic != htonl(NCP_TCP_RCVD_MAGIC)) {
569 printk(KERN_ERR "ncpfs: tcp: Unexpected reply type %08X\n", ntohl(server->rcv.buf.magic)); 570 pr_err("tcp: Unexpected reply type %08X\n", ntohl(server->rcv.buf.magic));
570 __ncptcp_abort(server); 571 __ncptcp_abort(server);
571 return -EIO; 572 return -EIO;
572 } 573 }
573 datalen = ntohl(server->rcv.buf.len) & 0x0FFFFFFF; 574 datalen = ntohl(server->rcv.buf.len) & 0x0FFFFFFF;
574 if (datalen < 10) { 575 if (datalen < 10) {
575 printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d\n", datalen); 576 pr_err("tcp: Unexpected reply len %d\n", datalen);
576 __ncptcp_abort(server); 577 __ncptcp_abort(server);
577 return -EIO; 578 return -EIO;
578 } 579 }
579#ifdef CONFIG_NCPFS_PACKET_SIGNING 580#ifdef CONFIG_NCPFS_PACKET_SIGNING
580 if (server->sign_active) { 581 if (server->sign_active) {
581 if (datalen < 18) { 582 if (datalen < 18) {
582 printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d\n", datalen); 583 pr_err("tcp: Unexpected reply len %d\n", datalen);
583 __ncptcp_abort(server); 584 __ncptcp_abort(server);
584 return -EIO; 585 return -EIO;
585 } 586 }
@@ -604,7 +605,7 @@ cont:;
604 server->rcv.len = datalen - 10; 605 server->rcv.len = datalen - 10;
605 break; 606 break;
606 } 607 }
607 DPRINTK("ncpfs: tcp: Unexpected NCP type %02X\n", type); 608 ncp_dbg(1, "tcp: Unexpected NCP type %02X\n", type);
608skipdata2:; 609skipdata2:;
609 server->rcv.state = 2; 610 server->rcv.state = 2;
610skipdata:; 611skipdata:;
@@ -614,11 +615,11 @@ skipdata:;
614 } 615 }
615 req = server->rcv.creq; 616 req = server->rcv.creq;
616 if (!req) { 617 if (!req) {
617 DPRINTK(KERN_ERR "ncpfs: Reply without appropriate request\n"); 618 ncp_dbg(1, "Reply without appropriate request\n");
618 goto skipdata2; 619 goto skipdata2;
619 } 620 }
620 if (datalen > req->datalen + 8) { 621 if (datalen > req->datalen + 8) {
621 printk(KERN_ERR "ncpfs: tcp: Unexpected reply len %d (expected at most %Zd)\n", datalen, req->datalen + 8); 622 pr_err("tcp: Unexpected reply len %d (expected at most %Zd)\n", datalen, req->datalen + 8);
622 server->rcv.state = 3; 623 server->rcv.state = 3;
623 goto skipdata; 624 goto skipdata;
624 } 625 }
@@ -638,12 +639,12 @@ skipdata:;
638 req = server->rcv.creq; 639 req = server->rcv.creq;
639 if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) { 640 if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) {
640 if (((struct ncp_reply_header*)server->rxbuf)->sequence != server->sequence) { 641 if (((struct ncp_reply_header*)server->rxbuf)->sequence != server->sequence) {
641 printk(KERN_ERR "ncpfs: tcp: Bad sequence number\n"); 642 pr_err("tcp: Bad sequence number\n");
642 __ncp_abort_request(server, req, -EIO); 643 __ncp_abort_request(server, req, -EIO);
643 return -EIO; 644 return -EIO;
644 } 645 }
645 if ((((struct ncp_reply_header*)server->rxbuf)->conn_low | (((struct ncp_reply_header*)server->rxbuf)->conn_high << 8)) != server->connection) { 646 if ((((struct ncp_reply_header*)server->rxbuf)->conn_low | (((struct ncp_reply_header*)server->rxbuf)->conn_high << 8)) != server->connection) {
646 printk(KERN_ERR "ncpfs: tcp: Connection number mismatch\n"); 647 pr_err("tcp: Connection number mismatch\n");
647 __ncp_abort_request(server, req, -EIO); 648 __ncp_abort_request(server, req, -EIO);
648 return -EIO; 649 return -EIO;
649 } 650 }
@@ -651,7 +652,7 @@ skipdata:;
651#ifdef CONFIG_NCPFS_PACKET_SIGNING 652#ifdef CONFIG_NCPFS_PACKET_SIGNING
652 if (server->sign_active && req->tx_type != NCP_DEALLOC_SLOT_REQUEST) { 653 if (server->sign_active && req->tx_type != NCP_DEALLOC_SLOT_REQUEST) {
653 if (sign_verify_reply(server, server->rxbuf + 6, req->datalen - 6, cpu_to_be32(req->datalen + 16), &server->rcv.buf.type)) { 654 if (sign_verify_reply(server, server->rxbuf + 6, req->datalen - 6, cpu_to_be32(req->datalen + 16), &server->rcv.buf.type)) {
654 printk(KERN_ERR "ncpfs: tcp: Signature violation\n"); 655 pr_err("tcp: Signature violation\n");
655 __ncp_abort_request(server, req, -EIO); 656 __ncp_abort_request(server, req, -EIO);
656 return -EIO; 657 return -EIO;
657 } 658 }
@@ -742,7 +743,7 @@ static int ncp_do_request(struct ncp_server *server, int size,
742 int result; 743 int result;
743 744
744 if (server->lock == 0) { 745 if (server->lock == 0) {
745 printk(KERN_ERR "ncpfs: Server not locked!\n"); 746 pr_err("Server not locked!\n");
746 return -EIO; 747 return -EIO;
747 } 748 }
748 if (!ncp_conn_valid(server)) { 749 if (!ncp_conn_valid(server)) {
@@ -781,7 +782,7 @@ static int ncp_do_request(struct ncp_server *server, int size,
781 spin_unlock_irqrestore(&current->sighand->siglock, flags); 782 spin_unlock_irqrestore(&current->sighand->siglock, flags);
782 } 783 }
783 784
784 DDPRINTK("do_ncp_rpc_call returned %d\n", result); 785 ncp_dbg(2, "do_ncp_rpc_call returned %d\n", result);
785 786
786 return result; 787 return result;
787} 788}
@@ -811,7 +812,7 @@ int ncp_request2(struct ncp_server *server, int function,
811 812
812 result = ncp_do_request(server, server->current_size, reply, size); 813 result = ncp_do_request(server, server->current_size, reply, size);
813 if (result < 0) { 814 if (result < 0) {
814 DPRINTK("ncp_request_error: %d\n", result); 815 ncp_dbg(1, "ncp_request_error: %d\n", result);
815 goto out; 816 goto out;
816 } 817 }
817 server->completion = reply->completion_code; 818 server->completion = reply->completion_code;
@@ -822,7 +823,7 @@ int ncp_request2(struct ncp_server *server, int function,
822 result = reply->completion_code; 823 result = reply->completion_code;
823 824
824 if (result != 0) 825 if (result != 0)
825 PPRINTK("ncp_request: completion code=%x\n", result); 826 ncp_vdbg("completion code=%x\n", result);
826out: 827out:
827 return result; 828 return result;
828} 829}
@@ -865,14 +866,14 @@ void ncp_lock_server(struct ncp_server *server)
865{ 866{
866 mutex_lock(&server->mutex); 867 mutex_lock(&server->mutex);
867 if (server->lock) 868 if (server->lock)
868 printk(KERN_WARNING "ncp_lock_server: was locked!\n"); 869 pr_warn("%s: was locked!\n", __func__);
869 server->lock = 1; 870 server->lock = 1;
870} 871}
871 872
872void ncp_unlock_server(struct ncp_server *server) 873void ncp_unlock_server(struct ncp_server *server)
873{ 874{
874 if (!server->lock) { 875 if (!server->lock) {
875 printk(KERN_WARNING "ncp_unlock_server: was not locked!\n"); 876 pr_warn("%s: was not locked!\n", __func__);
876 return; 877 return;
877 } 878 }
878 server->lock = 0; 879 server->lock = 0;
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c
index 52439ddc8de0..1a63bfdb4a65 100644
--- a/fs/ncpfs/symlink.c
+++ b/fs/ncpfs/symlink.c
@@ -112,7 +112,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
112 __le32 attr; 112 __le32 attr;
113 unsigned int hdr; 113 unsigned int hdr;
114 114
115 DPRINTK("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname); 115 ncp_dbg(1, "dir=%p, dentry=%p, symname=%s\n", dir, dentry, symname);
116 116
117 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) 117 if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber))
118 kludge = 0; 118 kludge = 0;
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index 8280a5dd1727..7dd33577b905 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -169,7 +169,7 @@ static int percpu_counter_hotcpu_callback(struct notifier_block *nb,
169 struct percpu_counter *fbc; 169 struct percpu_counter *fbc;
170 170
171 compute_batch_value(); 171 compute_batch_value();
172 if (action != CPU_DEAD) 172 if (action != CPU_DEAD && action != CPU_DEAD_FROZEN)
173 return NOTIFY_OK; 173 return NOTIFY_OK;
174 174
175 cpu = (unsigned long)hcpu; 175 cpu = (unsigned long)hcpu;
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 06879ead7380..9b6497eda806 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1862,7 +1862,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
1862 struct zone *zone = lruvec_zone(lruvec); 1862 struct zone *zone = lruvec_zone(lruvec);
1863 unsigned long anon_prio, file_prio; 1863 unsigned long anon_prio, file_prio;
1864 enum scan_balance scan_balance; 1864 enum scan_balance scan_balance;
1865 unsigned long anon, file, free; 1865 unsigned long anon, file;
1866 bool force_scan = false; 1866 bool force_scan = false;
1867 unsigned long ap, fp; 1867 unsigned long ap, fp;
1868 enum lru_list lru; 1868 enum lru_list lru;
@@ -1916,20 +1916,6 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
1916 get_lru_size(lruvec, LRU_INACTIVE_FILE); 1916 get_lru_size(lruvec, LRU_INACTIVE_FILE);
1917 1917
1918 /* 1918 /*
1919 * If it's foreseeable that reclaiming the file cache won't be
1920 * enough to get the zone back into a desirable shape, we have
1921 * to swap. Better start now and leave the - probably heavily
1922 * thrashing - remaining file pages alone.
1923 */
1924 if (global_reclaim(sc)) {
1925 free = zone_page_state(zone, NR_FREE_PAGES);
1926 if (unlikely(file + free <= high_wmark_pages(zone))) {
1927 scan_balance = SCAN_ANON;
1928 goto out;
1929 }
1930 }
1931
1932 /*
1933 * There is enough inactive page cache, do not reclaim 1919 * There is enough inactive page cache, do not reclaim
1934 * anything from the anonymous working set right now. 1920 * anything from the anonymous working set right now.
1935 */ 1921 */