diff options
author | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-05-22 23:48:37 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-05-22 23:48:37 -0400 |
commit | c1e554aeea12d2dab5183e011c27dee6142dc927 (patch) | |
tree | a44908fa5c2f1f24b6f7e7313b60e49cd3235cdd /fs | |
parent | c203e45f069af47ca7623e4dcd8c00bfba2722e4 (diff) | |
parent | 78b58e549a3098a8c1408d0214bd25e5d5e7a3a3 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'fs')
63 files changed, 999 insertions, 766 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index b25707fee2cc..0fa95b198e6e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -256,7 +256,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec, | |||
256 | return -EFAULT; | 256 | return -EFAULT; |
257 | len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); | 257 | len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); |
258 | if (!len || len > MAX_ARG_STRLEN) | 258 | if (!len || len > MAX_ARG_STRLEN) |
259 | return 0; | 259 | return -EINVAL; |
260 | p += len; | 260 | p += len; |
261 | } | 261 | } |
262 | if (__put_user(0, argv)) | 262 | if (__put_user(0, argv)) |
@@ -268,7 +268,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec, | |||
268 | return -EFAULT; | 268 | return -EFAULT; |
269 | len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); | 269 | len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); |
270 | if (!len || len > MAX_ARG_STRLEN) | 270 | if (!len || len > MAX_ARG_STRLEN) |
271 | return 0; | 271 | return -EINVAL; |
272 | p += len; | 272 | p += len; |
273 | } | 273 | } |
274 | if (__put_user(0, envp)) | 274 | if (__put_user(0, envp)) |
@@ -1900,7 +1900,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un | |||
1900 | /* alloc memory for large data structures: too large to be on stack */ | 1900 | /* alloc memory for large data structures: too large to be on stack */ |
1901 | elf = kmalloc(sizeof(*elf), GFP_KERNEL); | 1901 | elf = kmalloc(sizeof(*elf), GFP_KERNEL); |
1902 | if (!elf) | 1902 | if (!elf) |
1903 | goto cleanup; | 1903 | goto out; |
1904 | 1904 | ||
1905 | segs = current->mm->map_count; | 1905 | segs = current->mm->map_count; |
1906 | #ifdef ELF_CORE_EXTRA_PHDRS | 1906 | #ifdef ELF_CORE_EXTRA_PHDRS |
@@ -2034,8 +2034,9 @@ end_coredump: | |||
2034 | set_fs(fs); | 2034 | set_fs(fs); |
2035 | 2035 | ||
2036 | cleanup: | 2036 | cleanup: |
2037 | kfree(elf); | ||
2038 | free_note_info(&info); | 2037 | free_note_info(&info); |
2038 | kfree(elf); | ||
2039 | out: | ||
2039 | return has_dumped; | 2040 | return has_dumped; |
2040 | } | 2041 | } |
2041 | 2042 | ||
diff --git a/fs/cifs/AUTHORS b/fs/cifs/AUTHORS index 8848e4dfa026..9c136d7803d9 100644 --- a/fs/cifs/AUTHORS +++ b/fs/cifs/AUTHORS | |||
@@ -36,6 +36,7 @@ Miklos Szeredi | |||
36 | Kazeon team for various fixes especially for 2.4 version. | 36 | Kazeon team for various fixes especially for 2.4 version. |
37 | Asser Ferno (Change Notify support) | 37 | Asser Ferno (Change Notify support) |
38 | Shaggy (Dave Kleikamp) for inumerable small fs suggestions and some good cleanup | 38 | Shaggy (Dave Kleikamp) for inumerable small fs suggestions and some good cleanup |
39 | Igor Mammedov (DFS support) | ||
39 | 40 | ||
40 | Test case and Bug Report contributors | 41 | Test case and Bug Report contributors |
41 | ------------------------------------- | 42 | ------------------------------------- |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 8355e918fddf..28e3d5c5fcac 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,5 +1,7 @@ | |||
1 | Version 1.53 | 1 | Version 1.53 |
2 | ------------ | 2 | ------------ |
3 | DFS support added (Microsoft Distributed File System client support needed | ||
4 | for referrals which enable a hierarchical name space among servers). | ||
3 | 5 | ||
4 | Version 1.52 | 6 | Version 1.52 |
5 | ------------ | 7 | ------------ |
@@ -12,7 +14,8 @@ Add ability to modify cifs acls for handling chmod (when mounted with | |||
12 | cifsacl flag). Fix prefixpath path separator so we can handle mounts | 14 | cifsacl flag). Fix prefixpath path separator so we can handle mounts |
13 | with prefixpaths longer than one directory (one path component) when | 15 | with prefixpaths longer than one directory (one path component) when |
14 | mounted to Windows servers. Fix slow file open when cifsacl | 16 | mounted to Windows servers. Fix slow file open when cifsacl |
15 | enabled. | 17 | enabled. Fix memory leak in FindNext when the SMB call returns -EBADF. |
18 | |||
16 | 19 | ||
17 | Version 1.51 | 20 | Version 1.51 |
18 | ------------ | 21 | ------------ |
diff --git a/fs/cifs/README b/fs/cifs/README index 621aa1a85971..2bd6fe556f88 100644 --- a/fs/cifs/README +++ b/fs/cifs/README | |||
@@ -483,6 +483,11 @@ A partial list of the supported mount options follows: | |||
483 | sign Must use packet signing (helps avoid unwanted data modification | 483 | sign Must use packet signing (helps avoid unwanted data modification |
484 | by intermediate systems in the route). Note that signing | 484 | by intermediate systems in the route). Note that signing |
485 | does not work with lanman or plaintext authentication. | 485 | does not work with lanman or plaintext authentication. |
486 | seal Must seal (encrypt) all data on this mounted share before | ||
487 | sending on the network. Requires support for Unix Extensions. | ||
488 | Note that this differs from the sign mount option in that it | ||
489 | causes encryption of data sent over this mounted share but other | ||
490 | shares mounted to the same server are unaffected. | ||
486 | sec Security mode. Allowed values are: | 491 | sec Security mode. Allowed values are: |
487 | none attempt to connection as a null user (no name) | 492 | none attempt to connection as a null user (no name) |
488 | krb5 Use Kerberos version 5 authentication | 493 | krb5 Use Kerberos version 5 authentication |
diff --git a/fs/cifs/TODO b/fs/cifs/TODO index 92c9feac440f..5aff46c61e52 100644 --- a/fs/cifs/TODO +++ b/fs/cifs/TODO | |||
@@ -1,4 +1,4 @@ | |||
1 | Version 1.52 January 3, 2008 | 1 | Version 1.53 May 20, 2008 |
2 | 2 | ||
3 | A Partial List of Missing Features | 3 | A Partial List of Missing Features |
4 | ================================== | 4 | ================================== |
@@ -20,20 +20,21 @@ d) Cleanup now unneeded SessSetup code in | |||
20 | fs/cifs/connect.c and add back in NTLMSSP code if any servers | 20 | fs/cifs/connect.c and add back in NTLMSSP code if any servers |
21 | need it | 21 | need it |
22 | 22 | ||
23 | e) ms-dfs and ms-dfs host name resolution cleanup | 23 | e) fix NTLMv2 signing when two mounts with different users to same |
24 | |||
25 | f) fix NTLMv2 signing when two mounts with different users to same | ||
26 | server. | 24 | server. |
27 | 25 | ||
28 | g) Directory entry caching relies on a 1 second timer, rather than | 26 | f) Directory entry caching relies on a 1 second timer, rather than |
29 | using FindNotify or equivalent. - (started) | 27 | using FindNotify or equivalent. - (started) |
30 | 28 | ||
31 | h) quota support (needs minor kernel change since quota calls | 29 | g) quota support (needs minor kernel change since quota calls |
32 | to make it to network filesystems or deviceless filesystems) | 30 | to make it to network filesystems or deviceless filesystems) |
33 | 31 | ||
34 | i) investigate sync behavior (including syncpage) and check | 32 | h) investigate sync behavior (including syncpage) and check |
35 | for proper behavior of intr/nointr | 33 | for proper behavior of intr/nointr |
36 | 34 | ||
35 | i) improve support for very old servers (OS/2 and Win9x for example) | ||
36 | Including support for changing the time remotely (utimes command). | ||
37 | |||
37 | j) hook lower into the sockets api (as NFS/SunRPC does) to avoid the | 38 | j) hook lower into the sockets api (as NFS/SunRPC does) to avoid the |
38 | extra copy in/out of the socket buffers in some cases. | 39 | extra copy in/out of the socket buffers in some cases. |
39 | 40 | ||
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index f6fdecf6598c..d82374c9e329 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
@@ -219,53 +219,6 @@ static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent, | |||
219 | 219 | ||
220 | } | 220 | } |
221 | 221 | ||
222 | static char *build_full_dfs_path_from_dentry(struct dentry *dentry) | ||
223 | { | ||
224 | char *full_path = NULL; | ||
225 | char *search_path; | ||
226 | char *tmp_path; | ||
227 | size_t l_max_len; | ||
228 | struct cifs_sb_info *cifs_sb; | ||
229 | |||
230 | if (dentry->d_inode == NULL) | ||
231 | return NULL; | ||
232 | |||
233 | cifs_sb = CIFS_SB(dentry->d_inode->i_sb); | ||
234 | |||
235 | if (cifs_sb->tcon == NULL) | ||
236 | return NULL; | ||
237 | |||
238 | search_path = build_path_from_dentry(dentry); | ||
239 | if (search_path == NULL) | ||
240 | return NULL; | ||
241 | |||
242 | if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { | ||
243 | int i; | ||
244 | /* we should use full path name for correct working with DFS */ | ||
245 | l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) + | ||
246 | strnlen(search_path, MAX_PATHCONF) + 1; | ||
247 | tmp_path = kmalloc(l_max_len, GFP_KERNEL); | ||
248 | if (tmp_path == NULL) { | ||
249 | kfree(search_path); | ||
250 | return NULL; | ||
251 | } | ||
252 | strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); | ||
253 | tmp_path[l_max_len-1] = 0; | ||
254 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | ||
255 | for (i = 0; i < l_max_len; i++) { | ||
256 | if (tmp_path[i] == '\\') | ||
257 | tmp_path[i] = '/'; | ||
258 | } | ||
259 | strncat(tmp_path, search_path, l_max_len - strlen(tmp_path)); | ||
260 | |||
261 | full_path = tmp_path; | ||
262 | kfree(search_path); | ||
263 | } else { | ||
264 | full_path = search_path; | ||
265 | } | ||
266 | return full_path; | ||
267 | } | ||
268 | |||
269 | static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd, | 222 | static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd, |
270 | struct list_head *mntlist) | 223 | struct list_head *mntlist) |
271 | { | 224 | { |
@@ -333,7 +286,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd) | |||
333 | goto out_err; | 286 | goto out_err; |
334 | } | 287 | } |
335 | 288 | ||
336 | full_path = build_full_dfs_path_from_dentry(dentry); | 289 | full_path = build_path_from_dentry(dentry); |
337 | if (full_path == NULL) { | 290 | if (full_path == NULL) { |
338 | rc = -ENOMEM; | 291 | rc = -ENOMEM; |
339 | goto out_err; | 292 | goto out_err; |
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index 8ad2330ba061..877c85409f1f 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h | |||
@@ -30,6 +30,7 @@ | |||
30 | #define CIFS_MOUNT_CIFS_ACL 0x200 /* send ACL requests to non-POSIX srv */ | 30 | #define CIFS_MOUNT_CIFS_ACL 0x200 /* send ACL requests to non-POSIX srv */ |
31 | #define CIFS_MOUNT_OVERR_UID 0x400 /* override uid returned from server */ | 31 | #define CIFS_MOUNT_OVERR_UID 0x400 /* override uid returned from server */ |
32 | #define CIFS_MOUNT_OVERR_GID 0x800 /* override gid returned from server */ | 32 | #define CIFS_MOUNT_OVERR_GID 0x800 /* override gid returned from server */ |
33 | #define CIFS_MOUNT_DYNPERM 0x1000 /* allow in-memory only mode setting */ | ||
33 | 34 | ||
34 | struct cifs_sb_info { | 35 | struct cifs_sb_info { |
35 | struct cifsTconInfo *tcon; /* primary mount */ | 36 | struct cifsTconInfo *tcon; /* primary mount */ |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 427a7c695896..5df93fd6303f 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/cifsfs.c | 2 | * fs/cifs/cifsfs.c |
3 | * | 3 | * |
4 | * Copyright (C) International Business Machines Corp., 2002,2007 | 4 | * Copyright (C) International Business Machines Corp., 2002,2008 |
5 | * Author(s): Steve French (sfrench@us.ibm.com) | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * Common Internet FileSystem (CIFS) client | 7 | * Common Internet FileSystem (CIFS) client |
@@ -353,9 +353,41 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) | |||
353 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) || | 353 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) || |
354 | !(cifs_sb->tcon->unix_ext)) | 354 | !(cifs_sb->tcon->unix_ext)) |
355 | seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); | 355 | seq_printf(s, ",gid=%d", cifs_sb->mnt_gid); |
356 | if (!cifs_sb->tcon->unix_ext) { | ||
357 | seq_printf(s, ",file_mode=0%o,dir_mode=0%o", | ||
358 | cifs_sb->mnt_file_mode, | ||
359 | cifs_sb->mnt_dir_mode); | ||
360 | } | ||
361 | if (cifs_sb->tcon->seal) | ||
362 | seq_printf(s, ",seal"); | ||
363 | if (cifs_sb->tcon->nocase) | ||
364 | seq_printf(s, ",nocase"); | ||
365 | if (cifs_sb->tcon->retry) | ||
366 | seq_printf(s, ",hard"); | ||
356 | } | 367 | } |
357 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | 368 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) |
358 | seq_printf(s, ",posixpaths"); | 369 | seq_printf(s, ",posixpaths"); |
370 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) | ||
371 | seq_printf(s, ",setuids"); | ||
372 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) | ||
373 | seq_printf(s, ",serverino"); | ||
374 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) | ||
375 | seq_printf(s, ",directio"); | ||
376 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) | ||
377 | seq_printf(s, ",nouser_xattr"); | ||
378 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) | ||
379 | seq_printf(s, ",mapchars"); | ||
380 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) | ||
381 | seq_printf(s, ",sfu"); | ||
382 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
383 | seq_printf(s, ",nobrl"); | ||
384 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) | ||
385 | seq_printf(s, ",cifsacl"); | ||
386 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) | ||
387 | seq_printf(s, ",dynperm"); | ||
388 | if (m->mnt_sb->s_flags & MS_POSIXACL) | ||
389 | seq_printf(s, ",acl"); | ||
390 | |||
359 | seq_printf(s, ",rsize=%d", cifs_sb->rsize); | 391 | seq_printf(s, ",rsize=%d", cifs_sb->rsize); |
360 | seq_printf(s, ",wsize=%d", cifs_sb->wsize); | 392 | seq_printf(s, ",wsize=%d", cifs_sb->wsize); |
361 | } | 393 | } |
@@ -657,7 +689,7 @@ const struct file_operations cifs_file_ops = { | |||
657 | .splice_read = generic_file_splice_read, | 689 | .splice_read = generic_file_splice_read, |
658 | .llseek = cifs_llseek, | 690 | .llseek = cifs_llseek, |
659 | #ifdef CONFIG_CIFS_POSIX | 691 | #ifdef CONFIG_CIFS_POSIX |
660 | .ioctl = cifs_ioctl, | 692 | .unlocked_ioctl = cifs_ioctl, |
661 | #endif /* CONFIG_CIFS_POSIX */ | 693 | #endif /* CONFIG_CIFS_POSIX */ |
662 | 694 | ||
663 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 695 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
@@ -677,7 +709,7 @@ const struct file_operations cifs_file_direct_ops = { | |||
677 | .flush = cifs_flush, | 709 | .flush = cifs_flush, |
678 | .splice_read = generic_file_splice_read, | 710 | .splice_read = generic_file_splice_read, |
679 | #ifdef CONFIG_CIFS_POSIX | 711 | #ifdef CONFIG_CIFS_POSIX |
680 | .ioctl = cifs_ioctl, | 712 | .unlocked_ioctl = cifs_ioctl, |
681 | #endif /* CONFIG_CIFS_POSIX */ | 713 | #endif /* CONFIG_CIFS_POSIX */ |
682 | .llseek = cifs_llseek, | 714 | .llseek = cifs_llseek, |
683 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 715 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
@@ -697,7 +729,7 @@ const struct file_operations cifs_file_nobrl_ops = { | |||
697 | .splice_read = generic_file_splice_read, | 729 | .splice_read = generic_file_splice_read, |
698 | .llseek = cifs_llseek, | 730 | .llseek = cifs_llseek, |
699 | #ifdef CONFIG_CIFS_POSIX | 731 | #ifdef CONFIG_CIFS_POSIX |
700 | .ioctl = cifs_ioctl, | 732 | .unlocked_ioctl = cifs_ioctl, |
701 | #endif /* CONFIG_CIFS_POSIX */ | 733 | #endif /* CONFIG_CIFS_POSIX */ |
702 | 734 | ||
703 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 735 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
@@ -716,7 +748,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = { | |||
716 | .flush = cifs_flush, | 748 | .flush = cifs_flush, |
717 | .splice_read = generic_file_splice_read, | 749 | .splice_read = generic_file_splice_read, |
718 | #ifdef CONFIG_CIFS_POSIX | 750 | #ifdef CONFIG_CIFS_POSIX |
719 | .ioctl = cifs_ioctl, | 751 | .unlocked_ioctl = cifs_ioctl, |
720 | #endif /* CONFIG_CIFS_POSIX */ | 752 | #endif /* CONFIG_CIFS_POSIX */ |
721 | .llseek = cifs_llseek, | 753 | .llseek = cifs_llseek, |
722 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 754 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
@@ -731,7 +763,7 @@ const struct file_operations cifs_dir_ops = { | |||
731 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 763 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
732 | .dir_notify = cifs_dir_notify, | 764 | .dir_notify = cifs_dir_notify, |
733 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | 765 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ |
734 | .ioctl = cifs_ioctl, | 766 | .unlocked_ioctl = cifs_ioctl, |
735 | }; | 767 | }; |
736 | 768 | ||
737 | static void | 769 | static void |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index cd1301a09b3b..25a6cbd15529 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -95,8 +95,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *, | |||
95 | size_t, int); | 95 | size_t, int); |
96 | extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); | 96 | extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); |
97 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); | 97 | extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); |
98 | extern int cifs_ioctl(struct inode *inode, struct file *filep, | 98 | extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); |
99 | unsigned int command, unsigned long arg); | ||
100 | 99 | ||
101 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 100 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
102 | extern const struct export_operations cifs_export_ops; | 101 | extern const struct export_operations cifs_export_ops; |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index b7d9f698e63e..08914053242b 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -281,6 +281,7 @@ struct cifsTconInfo { | |||
281 | bool ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */ | 281 | bool ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */ |
282 | bool retry:1; | 282 | bool retry:1; |
283 | bool nocase:1; | 283 | bool nocase:1; |
284 | bool seal:1; /* transport encryption for this mounted share */ | ||
284 | bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol | 285 | bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol |
285 | for this mount even if server would support */ | 286 | for this mount even if server would support */ |
286 | /* BB add field for back pointer to sb struct(s)? */ | 287 | /* BB add field for back pointer to sb struct(s)? */ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index c43bf4b7a556..65d58b4e6a61 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -1904,19 +1904,26 @@ typedef struct smb_com_transaction2_get_dfs_refer_req { | |||
1904 | char RequestFileName[1]; | 1904 | char RequestFileName[1]; |
1905 | } __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ; | 1905 | } __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ; |
1906 | 1906 | ||
1907 | #define DFS_VERSION cpu_to_le16(0x0003) | ||
1908 | |||
1909 | /* DFS server target type */ | ||
1910 | #define DFS_TYPE_LINK 0x0000 /* also for sysvol targets */ | ||
1911 | #define DFS_TYPE_ROOT 0x0001 | ||
1912 | |||
1913 | /* Referral Entry Flags */ | ||
1914 | #define DFS_NAME_LIST_REF 0x0200 | ||
1915 | |||
1907 | typedef struct dfs_referral_level_3 { | 1916 | typedef struct dfs_referral_level_3 { |
1908 | __le16 VersionNumber; | 1917 | __le16 VersionNumber; |
1909 | __le16 ReferralSize; | 1918 | __le16 Size; |
1910 | __le16 ServerType; /* 0x0001 = CIFS server */ | 1919 | __le16 ServerType; /* 0x0001 = root targets; 0x0000 = link targets */ |
1911 | __le16 ReferralFlags; /* or proximity - not clear which since it is | 1920 | __le16 ReferralEntryFlags; /* 0x0200 bit set only for domain |
1912 | always set to zero - SNIA spec says 0x01 | 1921 | or DC referral responce */ |
1913 | means strip off PathConsumed chars before | 1922 | __le32 TimeToLive; |
1914 | submitting RequestFileName to remote node */ | ||
1915 | __le16 TimeToLive; | ||
1916 | __le16 Proximity; | ||
1917 | __le16 DfsPathOffset; | 1923 | __le16 DfsPathOffset; |
1918 | __le16 DfsAlternatePathOffset; | 1924 | __le16 DfsAlternatePathOffset; |
1919 | __le16 NetworkAddressOffset; | 1925 | __le16 NetworkAddressOffset; /* offset of the link target */ |
1926 | __le16 ServiceSiteGuid; | ||
1920 | } __attribute__((packed)) REFERRAL3; | 1927 | } __attribute__((packed)) REFERRAL3; |
1921 | 1928 | ||
1922 | typedef struct smb_com_transaction_get_dfs_refer_rsp { | 1929 | typedef struct smb_com_transaction_get_dfs_refer_rsp { |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index d481f6c5a2be..b9f5e935f821 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -93,7 +93,7 @@ extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time); | |||
93 | 93 | ||
94 | extern int cifs_get_inode_info(struct inode **pinode, | 94 | extern int cifs_get_inode_info(struct inode **pinode, |
95 | const unsigned char *search_path, | 95 | const unsigned char *search_path, |
96 | FILE_ALL_INFO * pfile_info, | 96 | FILE_ALL_INFO *pfile_info, |
97 | struct super_block *sb, int xid, const __u16 *pfid); | 97 | struct super_block *sb, int xid, const __u16 *pfid); |
98 | extern int cifs_get_inode_info_unix(struct inode **pinode, | 98 | extern int cifs_get_inode_info_unix(struct inode **pinode, |
99 | const unsigned char *search_path, | 99 | const unsigned char *search_path, |
@@ -130,7 +130,7 @@ extern int CIFSFindClose(const int, struct cifsTconInfo *tcon, | |||
130 | 130 | ||
131 | extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, | 131 | extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, |
132 | const unsigned char *searchName, | 132 | const unsigned char *searchName, |
133 | FILE_ALL_INFO * findData, | 133 | FILE_ALL_INFO *findData, |
134 | int legacy /* whether to use old info level */, | 134 | int legacy /* whether to use old info level */, |
135 | const struct nls_table *nls_codepage, int remap); | 135 | const struct nls_table *nls_codepage, int remap); |
136 | extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, | 136 | extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, |
@@ -141,18 +141,15 @@ extern int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, | |||
141 | extern int CIFSSMBUnixQPathInfo(const int xid, | 141 | extern int CIFSSMBUnixQPathInfo(const int xid, |
142 | struct cifsTconInfo *tcon, | 142 | struct cifsTconInfo *tcon, |
143 | const unsigned char *searchName, | 143 | const unsigned char *searchName, |
144 | FILE_UNIX_BASIC_INFO * pFindData, | 144 | FILE_UNIX_BASIC_INFO *pFindData, |
145 | const struct nls_table *nls_codepage, int remap); | 145 | const struct nls_table *nls_codepage, int remap); |
146 | 146 | ||
147 | extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, | 147 | extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, |
148 | const unsigned char *searchName, | 148 | const unsigned char *searchName, |
149 | unsigned char **targetUNCs, | 149 | struct dfs_info3_param **target_nodes, |
150 | unsigned int *number_of_UNC_in_array, | 150 | unsigned int *number_of_nodes_in_array, |
151 | const struct nls_table *nls_codepage, int remap); | 151 | const struct nls_table *nls_codepage, int remap); |
152 | 152 | ||
153 | extern int connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo, | ||
154 | const char *old_path, | ||
155 | const struct nls_table *nls_codepage, int remap); | ||
156 | extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, | 153 | extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, |
157 | const char *old_path, | 154 | const char *old_path, |
158 | const struct nls_table *nls_codepage, | 155 | const struct nls_table *nls_codepage, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 95fbba4ea7d4..7b9938445b07 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -81,6 +81,40 @@ static struct { | |||
81 | #endif /* CONFIG_CIFS_WEAK_PW_HASH */ | 81 | #endif /* CONFIG_CIFS_WEAK_PW_HASH */ |
82 | #endif /* CIFS_POSIX */ | 82 | #endif /* CIFS_POSIX */ |
83 | 83 | ||
84 | /* Allocates buffer into dst and copies smb string from src to it. | ||
85 | * caller is responsible for freeing dst if function returned 0. | ||
86 | * returns: | ||
87 | * on success - 0 | ||
88 | * on failure - errno | ||
89 | */ | ||
90 | static int | ||
91 | cifs_strncpy_to_host(char **dst, const char *src, const int maxlen, | ||
92 | const bool is_unicode, const struct nls_table *nls_codepage) | ||
93 | { | ||
94 | int plen; | ||
95 | |||
96 | if (is_unicode) { | ||
97 | plen = UniStrnlen((wchar_t *)src, maxlen); | ||
98 | *dst = kmalloc(plen + 2, GFP_KERNEL); | ||
99 | if (!*dst) | ||
100 | goto cifs_strncpy_to_host_ErrExit; | ||
101 | cifs_strfromUCS_le(*dst, (__le16 *)src, plen, nls_codepage); | ||
102 | } else { | ||
103 | plen = strnlen(src, maxlen); | ||
104 | *dst = kmalloc(plen + 2, GFP_KERNEL); | ||
105 | if (!*dst) | ||
106 | goto cifs_strncpy_to_host_ErrExit; | ||
107 | strncpy(*dst, src, plen); | ||
108 | } | ||
109 | (*dst)[plen] = 0; | ||
110 | (*dst)[plen+1] = 0; /* harmless for ASCII case, needed for Unicode */ | ||
111 | return 0; | ||
112 | |||
113 | cifs_strncpy_to_host_ErrExit: | ||
114 | cERROR(1, ("Failed to allocate buffer for string\n")); | ||
115 | return -ENOMEM; | ||
116 | } | ||
117 | |||
84 | 118 | ||
85 | /* Mark as invalid, all open files on tree connections since they | 119 | /* Mark as invalid, all open files on tree connections since they |
86 | were closed when session to server was lost */ | 120 | were closed when session to server was lost */ |
@@ -1166,6 +1200,20 @@ static __u16 convert_disposition(int disposition) | |||
1166 | return ofun; | 1200 | return ofun; |
1167 | } | 1201 | } |
1168 | 1202 | ||
1203 | static int | ||
1204 | access_flags_to_smbopen_mode(const int access_flags) | ||
1205 | { | ||
1206 | int masked_flags = access_flags & (GENERIC_READ | GENERIC_WRITE); | ||
1207 | |||
1208 | if (masked_flags == GENERIC_READ) | ||
1209 | return SMBOPEN_READ; | ||
1210 | else if (masked_flags == GENERIC_WRITE) | ||
1211 | return SMBOPEN_WRITE; | ||
1212 | |||
1213 | /* just go for read/write */ | ||
1214 | return SMBOPEN_READWRITE; | ||
1215 | } | ||
1216 | |||
1169 | int | 1217 | int |
1170 | SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, | 1218 | SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon, |
1171 | const char *fileName, const int openDisposition, | 1219 | const char *fileName, const int openDisposition, |
@@ -1207,13 +1255,7 @@ OldOpenRetry: | |||
1207 | pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK); | 1255 | pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK); |
1208 | 1256 | ||
1209 | pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO); | 1257 | pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO); |
1210 | /* BB fixme add conversion for access_flags to bits 0 - 2 of mode */ | 1258 | pSMB->Mode = cpu_to_le16(access_flags_to_smbopen_mode(access_flags)); |
1211 | /* 0 = read | ||
1212 | 1 = write | ||
1213 | 2 = rw | ||
1214 | 3 = execute | ||
1215 | */ | ||
1216 | pSMB->Mode = cpu_to_le16(2); | ||
1217 | pSMB->Mode |= cpu_to_le16(0x40); /* deny none */ | 1259 | pSMB->Mode |= cpu_to_le16(0x40); /* deny none */ |
1218 | /* set file as system file if special file such | 1260 | /* set file as system file if special file such |
1219 | as fifo and server expecting SFU style and | 1261 | as fifo and server expecting SFU style and |
@@ -1247,7 +1289,7 @@ OldOpenRetry: | |||
1247 | } else { | 1289 | } else { |
1248 | /* BB verify if wct == 15 */ | 1290 | /* BB verify if wct == 15 */ |
1249 | 1291 | ||
1250 | /* *pOplock = pSMBr->OplockLevel; */ /* BB take from action field BB */ | 1292 | /* *pOplock = pSMBr->OplockLevel; */ /* BB take from action field*/ |
1251 | 1293 | ||
1252 | *netfid = pSMBr->Fid; /* cifs fid stays in le */ | 1294 | *netfid = pSMBr->Fid; /* cifs fid stays in le */ |
1253 | /* Let caller know file was created so we can set the mode. */ | 1295 | /* Let caller know file was created so we can set the mode. */ |
@@ -1767,7 +1809,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | |||
1767 | cFYI(1, ("Posix Lock")); | 1809 | cFYI(1, ("Posix Lock")); |
1768 | 1810 | ||
1769 | if (pLockData == NULL) | 1811 | if (pLockData == NULL) |
1770 | return EINVAL; | 1812 | return -EINVAL; |
1771 | 1813 | ||
1772 | rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); | 1814 | rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); |
1773 | 1815 | ||
@@ -1944,7 +1986,7 @@ renameRetry: | |||
1944 | /* protocol requires ASCII signature byte on Unicode string */ | 1986 | /* protocol requires ASCII signature byte on Unicode string */ |
1945 | pSMB->OldFileName[name_len + 1] = 0x00; | 1987 | pSMB->OldFileName[name_len + 1] = 0x00; |
1946 | name_len2 = | 1988 | name_len2 = |
1947 | cifsConvertToUCS((__le16 *) &pSMB->OldFileName[name_len + 2], | 1989 | cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2], |
1948 | toName, PATH_MAX, nls_codepage, remap); | 1990 | toName, PATH_MAX, nls_codepage, remap); |
1949 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; | 1991 | name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; |
1950 | name_len2 *= 2; /* convert to bytes */ | 1992 | name_len2 *= 2; /* convert to bytes */ |
@@ -2925,7 +2967,8 @@ setAclRetry: | |||
2925 | } | 2967 | } |
2926 | params = 6 + name_len; | 2968 | params = 6 + name_len; |
2927 | pSMB->MaxParameterCount = cpu_to_le16(2); | 2969 | pSMB->MaxParameterCount = cpu_to_le16(2); |
2928 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ | 2970 | /* BB find max SMB size from sess */ |
2971 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
2929 | pSMB->MaxSetupCount = 0; | 2972 | pSMB->MaxSetupCount = 0; |
2930 | pSMB->Reserved = 0; | 2973 | pSMB->Reserved = 0; |
2931 | pSMB->Flags = 0; | 2974 | pSMB->Flags = 0; |
@@ -3322,7 +3365,8 @@ QPathInfoRetry: | |||
3322 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; | 3365 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; |
3323 | pSMB->TotalDataCount = 0; | 3366 | pSMB->TotalDataCount = 0; |
3324 | pSMB->MaxParameterCount = cpu_to_le16(2); | 3367 | pSMB->MaxParameterCount = cpu_to_le16(2); |
3325 | pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ | 3368 | /* BB find exact max SMB PDU from sess structure BB */ |
3369 | pSMB->MaxDataCount = cpu_to_le16(4000); | ||
3326 | pSMB->MaxSetupCount = 0; | 3370 | pSMB->MaxSetupCount = 0; |
3327 | pSMB->Reserved = 0; | 3371 | pSMB->Reserved = 0; |
3328 | pSMB->Flags = 0; | 3372 | pSMB->Flags = 0; |
@@ -3388,7 +3432,7 @@ QPathInfoRetry: | |||
3388 | int | 3432 | int |
3389 | CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, | 3433 | CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, |
3390 | const unsigned char *searchName, | 3434 | const unsigned char *searchName, |
3391 | FILE_UNIX_BASIC_INFO * pFindData, | 3435 | FILE_UNIX_BASIC_INFO *pFindData, |
3392 | const struct nls_table *nls_codepage, int remap) | 3436 | const struct nls_table *nls_codepage, int remap) |
3393 | { | 3437 | { |
3394 | /* SMB_QUERY_FILE_UNIX_BASIC */ | 3438 | /* SMB_QUERY_FILE_UNIX_BASIC */ |
@@ -3679,6 +3723,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3679 | if (rc) { | 3723 | if (rc) { |
3680 | if (rc == -EBADF) { | 3724 | if (rc == -EBADF) { |
3681 | psrch_inf->endOfSearch = true; | 3725 | psrch_inf->endOfSearch = true; |
3726 | cifs_buf_release(pSMB); | ||
3682 | rc = 0; /* search probably was closed at end of search*/ | 3727 | rc = 0; /* search probably was closed at end of search*/ |
3683 | } else | 3728 | } else |
3684 | cFYI(1, ("FindNext returned = %d", rc)); | 3729 | cFYI(1, ("FindNext returned = %d", rc)); |
@@ -3856,25 +3901,112 @@ GetInodeNumOut: | |||
3856 | return rc; | 3901 | return rc; |
3857 | } | 3902 | } |
3858 | 3903 | ||
3904 | /* parses DFS refferal V3 structure | ||
3905 | * caller is responsible for freeing target_nodes | ||
3906 | * returns: | ||
3907 | * on success - 0 | ||
3908 | * on failure - errno | ||
3909 | */ | ||
3910 | static int | ||
3911 | parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, | ||
3912 | unsigned int *num_of_nodes, | ||
3913 | struct dfs_info3_param **target_nodes, | ||
3914 | const struct nls_table *nls_codepage) | ||
3915 | { | ||
3916 | int i, rc = 0; | ||
3917 | char *data_end; | ||
3918 | bool is_unicode; | ||
3919 | struct dfs_referral_level_3 *ref; | ||
3920 | |||
3921 | is_unicode = pSMBr->hdr.Flags2 & SMBFLG2_UNICODE; | ||
3922 | *num_of_nodes = le16_to_cpu(pSMBr->NumberOfReferrals); | ||
3923 | |||
3924 | if (*num_of_nodes < 1) { | ||
3925 | cERROR(1, ("num_referrals: must be at least > 0," | ||
3926 | "but we get num_referrals = %d\n", *num_of_nodes)); | ||
3927 | rc = -EINVAL; | ||
3928 | goto parse_DFS_referrals_exit; | ||
3929 | } | ||
3930 | |||
3931 | ref = (struct dfs_referral_level_3 *) &(pSMBr->referrals); | ||
3932 | if (ref->VersionNumber != 3) { | ||
3933 | cERROR(1, ("Referrals of V%d version are not supported," | ||
3934 | "should be V3", ref->VersionNumber)); | ||
3935 | rc = -EINVAL; | ||
3936 | goto parse_DFS_referrals_exit; | ||
3937 | } | ||
3938 | |||
3939 | /* get the upper boundary of the resp buffer */ | ||
3940 | data_end = (char *)(&(pSMBr->PathConsumed)) + | ||
3941 | le16_to_cpu(pSMBr->t2.DataCount); | ||
3942 | |||
3943 | cFYI(1, ("num_referrals: %d dfs flags: 0x%x ... \n", | ||
3944 | *num_of_nodes, | ||
3945 | le16_to_cpu(pSMBr->DFSFlags))); | ||
3946 | |||
3947 | *target_nodes = kzalloc(sizeof(struct dfs_info3_param) * | ||
3948 | *num_of_nodes, GFP_KERNEL); | ||
3949 | if (*target_nodes == NULL) { | ||
3950 | cERROR(1, ("Failed to allocate buffer for target_nodes\n")); | ||
3951 | rc = -ENOMEM; | ||
3952 | goto parse_DFS_referrals_exit; | ||
3953 | } | ||
3954 | |||
3955 | /* collect neccessary data from referrals */ | ||
3956 | for (i = 0; i < *num_of_nodes; i++) { | ||
3957 | char *temp; | ||
3958 | int max_len; | ||
3959 | struct dfs_info3_param *node = (*target_nodes)+i; | ||
3960 | |||
3961 | node->flags = le16_to_cpu(pSMBr->DFSFlags); | ||
3962 | node->path_consumed = le16_to_cpu(pSMBr->PathConsumed); | ||
3963 | node->server_type = le16_to_cpu(ref->ServerType); | ||
3964 | node->ref_flag = le16_to_cpu(ref->ReferralEntryFlags); | ||
3965 | |||
3966 | /* copy DfsPath */ | ||
3967 | temp = (char *)ref + le16_to_cpu(ref->DfsPathOffset); | ||
3968 | max_len = data_end - temp; | ||
3969 | rc = cifs_strncpy_to_host(&(node->path_name), temp, | ||
3970 | max_len, is_unicode, nls_codepage); | ||
3971 | if (rc) | ||
3972 | goto parse_DFS_referrals_exit; | ||
3973 | |||
3974 | /* copy link target UNC */ | ||
3975 | temp = (char *)ref + le16_to_cpu(ref->NetworkAddressOffset); | ||
3976 | max_len = data_end - temp; | ||
3977 | rc = cifs_strncpy_to_host(&(node->node_name), temp, | ||
3978 | max_len, is_unicode, nls_codepage); | ||
3979 | if (rc) | ||
3980 | goto parse_DFS_referrals_exit; | ||
3981 | |||
3982 | ref += ref->Size; | ||
3983 | } | ||
3984 | |||
3985 | parse_DFS_referrals_exit: | ||
3986 | if (rc) { | ||
3987 | free_dfs_info_array(*target_nodes, *num_of_nodes); | ||
3988 | *target_nodes = NULL; | ||
3989 | *num_of_nodes = 0; | ||
3990 | } | ||
3991 | return rc; | ||
3992 | } | ||
3993 | |||
3859 | int | 3994 | int |
3860 | CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, | 3995 | CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, |
3861 | const unsigned char *searchName, | 3996 | const unsigned char *searchName, |
3862 | unsigned char **targetUNCs, | 3997 | struct dfs_info3_param **target_nodes, |
3863 | unsigned int *number_of_UNC_in_array, | 3998 | unsigned int *num_of_nodes, |
3864 | const struct nls_table *nls_codepage, int remap) | 3999 | const struct nls_table *nls_codepage, int remap) |
3865 | { | 4000 | { |
3866 | /* TRANS2_GET_DFS_REFERRAL */ | 4001 | /* TRANS2_GET_DFS_REFERRAL */ |
3867 | TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL; | 4002 | TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL; |
3868 | TRANSACTION2_GET_DFS_REFER_RSP *pSMBr = NULL; | 4003 | TRANSACTION2_GET_DFS_REFER_RSP *pSMBr = NULL; |
3869 | struct dfs_referral_level_3 *referrals = NULL; | ||
3870 | int rc = 0; | 4004 | int rc = 0; |
3871 | int bytes_returned; | 4005 | int bytes_returned; |
3872 | int name_len; | 4006 | int name_len; |
3873 | unsigned int i; | ||
3874 | char *temp; | ||
3875 | __u16 params, byte_count; | 4007 | __u16 params, byte_count; |
3876 | *number_of_UNC_in_array = 0; | 4008 | *num_of_nodes = 0; |
3877 | *targetUNCs = NULL; | 4009 | *target_nodes = NULL; |
3878 | 4010 | ||
3879 | cFYI(1, ("In GetDFSRefer the path %s", searchName)); | 4011 | cFYI(1, ("In GetDFSRefer the path %s", searchName)); |
3880 | if (ses == NULL) | 4012 | if (ses == NULL) |
@@ -3921,7 +4053,8 @@ getDFSRetry: | |||
3921 | pSMB->DataCount = 0; | 4053 | pSMB->DataCount = 0; |
3922 | pSMB->DataOffset = 0; | 4054 | pSMB->DataOffset = 0; |
3923 | pSMB->MaxParameterCount = 0; | 4055 | pSMB->MaxParameterCount = 0; |
3924 | pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ | 4056 | /* BB find exact max SMB PDU from sess structure BB */ |
4057 | pSMB->MaxDataCount = cpu_to_le16(4000); | ||
3925 | pSMB->MaxSetupCount = 0; | 4058 | pSMB->MaxSetupCount = 0; |
3926 | pSMB->Reserved = 0; | 4059 | pSMB->Reserved = 0; |
3927 | pSMB->Flags = 0; | 4060 | pSMB->Flags = 0; |
@@ -3943,100 +4076,24 @@ getDFSRetry: | |||
3943 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 4076 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
3944 | if (rc) { | 4077 | if (rc) { |
3945 | cFYI(1, ("Send error in GetDFSRefer = %d", rc)); | 4078 | cFYI(1, ("Send error in GetDFSRefer = %d", rc)); |
3946 | } else { /* decode response */ | 4079 | goto GetDFSRefExit; |
3947 | /* BB Add logic to parse referrals here */ | 4080 | } |
3948 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); | 4081 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
3949 | 4082 | ||
3950 | /* BB Also check if enough total bytes returned? */ | 4083 | /* BB Also check if enough total bytes returned? */ |
3951 | if (rc || (pSMBr->ByteCount < 17)) | 4084 | if (rc || (pSMBr->ByteCount < 17)) { |
3952 | rc = -EIO; /* bad smb */ | 4085 | rc = -EIO; /* bad smb */ |
3953 | else { | 4086 | goto GetDFSRefExit; |
3954 | __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); | 4087 | } |
3955 | __u16 data_count = le16_to_cpu(pSMBr->t2.DataCount); | ||
3956 | 4088 | ||
3957 | cFYI(1, | 4089 | cFYI(1, ("Decoding GetDFSRefer response BCC: %d Offset %d", |
3958 | ("Decoding GetDFSRefer response BCC: %d Offset %d", | 4090 | pSMBr->ByteCount, |
3959 | pSMBr->ByteCount, data_offset)); | 4091 | le16_to_cpu(pSMBr->t2.DataOffset))); |
3960 | referrals = | ||
3961 | (struct dfs_referral_level_3 *) | ||
3962 | (8 /* sizeof start of data block */ + | ||
3963 | data_offset + | ||
3964 | (char *) &pSMBr->hdr.Protocol); | ||
3965 | cFYI(1, ("num_referrals: %d dfs flags: 0x%x ... \n" | ||
3966 | "for referral one refer size: 0x%x srv " | ||
3967 | "type: 0x%x refer flags: 0x%x ttl: 0x%x", | ||
3968 | le16_to_cpu(pSMBr->NumberOfReferrals), | ||
3969 | le16_to_cpu(pSMBr->DFSFlags), | ||
3970 | le16_to_cpu(referrals->ReferralSize), | ||
3971 | le16_to_cpu(referrals->ServerType), | ||
3972 | le16_to_cpu(referrals->ReferralFlags), | ||
3973 | le16_to_cpu(referrals->TimeToLive))); | ||
3974 | /* BB This field is actually two bytes in from start of | ||
3975 | data block so we could do safety check that DataBlock | ||
3976 | begins at address of pSMBr->NumberOfReferrals */ | ||
3977 | *number_of_UNC_in_array = | ||
3978 | le16_to_cpu(pSMBr->NumberOfReferrals); | ||
3979 | |||
3980 | /* BB Fix below so can return more than one referral */ | ||
3981 | if (*number_of_UNC_in_array > 1) | ||
3982 | *number_of_UNC_in_array = 1; | ||
3983 | |||
3984 | /* get the length of the strings describing refs */ | ||
3985 | name_len = 0; | ||
3986 | for (i = 0; i < *number_of_UNC_in_array; i++) { | ||
3987 | /* make sure that DfsPathOffset not past end */ | ||
3988 | __u16 offset = | ||
3989 | le16_to_cpu(referrals->DfsPathOffset); | ||
3990 | if (offset > data_count) { | ||
3991 | /* if invalid referral, stop here and do | ||
3992 | not try to copy any more */ | ||
3993 | *number_of_UNC_in_array = i; | ||
3994 | break; | ||
3995 | } | ||
3996 | temp = ((char *)referrals) + offset; | ||
3997 | 4092 | ||
3998 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { | 4093 | /* parse returned result into more usable form */ |
3999 | name_len += UniStrnlen((wchar_t *)temp, | 4094 | rc = parse_DFS_referrals(pSMBr, num_of_nodes, |
4000 | data_count); | 4095 | target_nodes, nls_codepage); |
4001 | } else { | ||
4002 | name_len += strnlen(temp, data_count); | ||
4003 | } | ||
4004 | referrals++; | ||
4005 | /* BB add check that referral pointer does | ||
4006 | not fall off end PDU */ | ||
4007 | } | ||
4008 | /* BB add check for name_len bigger than bcc */ | ||
4009 | *targetUNCs = | ||
4010 | kmalloc(name_len+1+(*number_of_UNC_in_array), | ||
4011 | GFP_KERNEL); | ||
4012 | if (*targetUNCs == NULL) { | ||
4013 | rc = -ENOMEM; | ||
4014 | goto GetDFSRefExit; | ||
4015 | } | ||
4016 | /* copy the ref strings */ | ||
4017 | referrals = (struct dfs_referral_level_3 *) | ||
4018 | (8 /* sizeof data hdr */ + data_offset + | ||
4019 | (char *) &pSMBr->hdr.Protocol); | ||
4020 | |||
4021 | for (i = 0; i < *number_of_UNC_in_array; i++) { | ||
4022 | temp = ((char *)referrals) + | ||
4023 | le16_to_cpu(referrals->DfsPathOffset); | ||
4024 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { | ||
4025 | cifs_strfromUCS_le(*targetUNCs, | ||
4026 | (__le16 *) temp, | ||
4027 | name_len, | ||
4028 | nls_codepage); | ||
4029 | } else { | ||
4030 | strncpy(*targetUNCs, temp, name_len); | ||
4031 | } | ||
4032 | /* BB update target_uncs pointers */ | ||
4033 | referrals++; | ||
4034 | } | ||
4035 | temp = *targetUNCs; | ||
4036 | temp[name_len] = 0; | ||
4037 | } | ||
4038 | 4096 | ||
4039 | } | ||
4040 | GetDFSRefExit: | 4097 | GetDFSRefExit: |
4041 | if (pSMB) | 4098 | if (pSMB) |
4042 | cifs_buf_release(pSMB); | 4099 | cifs_buf_release(pSMB); |
@@ -4229,7 +4286,8 @@ QFSAttributeRetry: | |||
4229 | params = 2; /* level */ | 4286 | params = 2; /* level */ |
4230 | pSMB->TotalDataCount = 0; | 4287 | pSMB->TotalDataCount = 0; |
4231 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4288 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4232 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ | 4289 | /* BB find exact max SMB PDU from sess structure BB */ |
4290 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
4233 | pSMB->MaxSetupCount = 0; | 4291 | pSMB->MaxSetupCount = 0; |
4234 | pSMB->Reserved = 0; | 4292 | pSMB->Reserved = 0; |
4235 | pSMB->Flags = 0; | 4293 | pSMB->Flags = 0; |
@@ -4298,7 +4356,8 @@ QFSDeviceRetry: | |||
4298 | params = 2; /* level */ | 4356 | params = 2; /* level */ |
4299 | pSMB->TotalDataCount = 0; | 4357 | pSMB->TotalDataCount = 0; |
4300 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4358 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4301 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ | 4359 | /* BB find exact max SMB PDU from sess structure BB */ |
4360 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
4302 | pSMB->MaxSetupCount = 0; | 4361 | pSMB->MaxSetupCount = 0; |
4303 | pSMB->Reserved = 0; | 4362 | pSMB->Reserved = 0; |
4304 | pSMB->Flags = 0; | 4363 | pSMB->Flags = 0; |
@@ -4369,7 +4428,8 @@ QFSUnixRetry: | |||
4369 | pSMB->DataCount = 0; | 4428 | pSMB->DataCount = 0; |
4370 | pSMB->DataOffset = 0; | 4429 | pSMB->DataOffset = 0; |
4371 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4430 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4372 | pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ | 4431 | /* BB find exact max SMB PDU from sess structure BB */ |
4432 | pSMB->MaxDataCount = cpu_to_le16(100); | ||
4373 | pSMB->MaxSetupCount = 0; | 4433 | pSMB->MaxSetupCount = 0; |
4374 | pSMB->Reserved = 0; | 4434 | pSMB->Reserved = 0; |
4375 | pSMB->Flags = 0; | 4435 | pSMB->Flags = 0; |
@@ -4444,7 +4504,8 @@ SETFSUnixRetry: | |||
4444 | offset = param_offset + params; | 4504 | offset = param_offset + params; |
4445 | 4505 | ||
4446 | pSMB->MaxParameterCount = cpu_to_le16(4); | 4506 | pSMB->MaxParameterCount = cpu_to_le16(4); |
4447 | pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ | 4507 | /* BB find exact max SMB PDU from sess structure BB */ |
4508 | pSMB->MaxDataCount = cpu_to_le16(100); | ||
4448 | pSMB->SetupCount = 1; | 4509 | pSMB->SetupCount = 1; |
4449 | pSMB->Reserved3 = 0; | 4510 | pSMB->Reserved3 = 0; |
4450 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FS_INFORMATION); | 4511 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FS_INFORMATION); |
@@ -4512,7 +4573,8 @@ QFSPosixRetry: | |||
4512 | pSMB->DataCount = 0; | 4573 | pSMB->DataCount = 0; |
4513 | pSMB->DataOffset = 0; | 4574 | pSMB->DataOffset = 0; |
4514 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4575 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4515 | pSMB->MaxDataCount = cpu_to_le16(100); /* BB find exact max SMB PDU from sess structure BB */ | 4576 | /* BB find exact max SMB PDU from sess structure BB */ |
4577 | pSMB->MaxDataCount = cpu_to_le16(100); | ||
4516 | pSMB->MaxSetupCount = 0; | 4578 | pSMB->MaxSetupCount = 0; |
4517 | pSMB->Reserved = 0; | 4579 | pSMB->Reserved = 0; |
4518 | pSMB->Flags = 0; | 4580 | pSMB->Flags = 0; |
@@ -4702,7 +4764,8 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, | |||
4702 | 4764 | ||
4703 | count = sizeof(struct file_end_of_file_info); | 4765 | count = sizeof(struct file_end_of_file_info); |
4704 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4766 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4705 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ | 4767 | /* BB find exact max SMB PDU from sess structure BB */ |
4768 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
4706 | pSMB->SetupCount = 1; | 4769 | pSMB->SetupCount = 1; |
4707 | pSMB->Reserved3 = 0; | 4770 | pSMB->Reserved3 = 0; |
4708 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); | 4771 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); |
@@ -4789,7 +4852,8 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, | |||
4789 | 4852 | ||
4790 | count = sizeof(FILE_BASIC_INFO); | 4853 | count = sizeof(FILE_BASIC_INFO); |
4791 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4854 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4792 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ | 4855 | /* BB find max SMB PDU from sess */ |
4856 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
4793 | pSMB->SetupCount = 1; | 4857 | pSMB->SetupCount = 1; |
4794 | pSMB->Reserved3 = 0; | 4858 | pSMB->Reserved3 = 0; |
4795 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); | 4859 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); |
@@ -4856,7 +4920,8 @@ SetTimesRetry: | |||
4856 | params = 6 + name_len; | 4920 | params = 6 + name_len; |
4857 | count = sizeof(FILE_BASIC_INFO); | 4921 | count = sizeof(FILE_BASIC_INFO); |
4858 | pSMB->MaxParameterCount = cpu_to_le16(2); | 4922 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4859 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ | 4923 | /* BB find max SMB PDU from sess structure BB */ |
4924 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
4860 | pSMB->MaxSetupCount = 0; | 4925 | pSMB->MaxSetupCount = 0; |
4861 | pSMB->Reserved = 0; | 4926 | pSMB->Reserved = 0; |
4862 | pSMB->Flags = 0; | 4927 | pSMB->Flags = 0; |
@@ -4986,7 +5051,8 @@ setPermsRetry: | |||
4986 | params = 6 + name_len; | 5051 | params = 6 + name_len; |
4987 | count = sizeof(FILE_UNIX_BASIC_INFO); | 5052 | count = sizeof(FILE_UNIX_BASIC_INFO); |
4988 | pSMB->MaxParameterCount = cpu_to_le16(2); | 5053 | pSMB->MaxParameterCount = cpu_to_le16(2); |
4989 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ | 5054 | /* BB find max SMB PDU from sess structure BB */ |
5055 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
4990 | pSMB->MaxSetupCount = 0; | 5056 | pSMB->MaxSetupCount = 0; |
4991 | pSMB->Reserved = 0; | 5057 | pSMB->Reserved = 0; |
4992 | pSMB->Flags = 0; | 5058 | pSMB->Flags = 0; |
@@ -5169,7 +5235,8 @@ QAllEAsRetry: | |||
5169 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; | 5235 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; |
5170 | pSMB->TotalDataCount = 0; | 5236 | pSMB->TotalDataCount = 0; |
5171 | pSMB->MaxParameterCount = cpu_to_le16(2); | 5237 | pSMB->MaxParameterCount = cpu_to_le16(2); |
5172 | pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ | 5238 | /* BB find exact max SMB PDU from sess structure BB */ |
5239 | pSMB->MaxDataCount = cpu_to_le16(4000); | ||
5173 | pSMB->MaxSetupCount = 0; | 5240 | pSMB->MaxSetupCount = 0; |
5174 | pSMB->Reserved = 0; | 5241 | pSMB->Reserved = 0; |
5175 | pSMB->Flags = 0; | 5242 | pSMB->Flags = 0; |
@@ -5317,7 +5384,8 @@ QEARetry: | |||
5317 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; | 5384 | params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; |
5318 | pSMB->TotalDataCount = 0; | 5385 | pSMB->TotalDataCount = 0; |
5319 | pSMB->MaxParameterCount = cpu_to_le16(2); | 5386 | pSMB->MaxParameterCount = cpu_to_le16(2); |
5320 | pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ | 5387 | /* BB find exact max SMB PDU from sess structure BB */ |
5388 | pSMB->MaxDataCount = cpu_to_le16(4000); | ||
5321 | pSMB->MaxSetupCount = 0; | 5389 | pSMB->MaxSetupCount = 0; |
5322 | pSMB->Reserved = 0; | 5390 | pSMB->Reserved = 0; |
5323 | pSMB->Flags = 0; | 5391 | pSMB->Flags = 0; |
@@ -5475,7 +5543,8 @@ SetEARetry: | |||
5475 | 5543 | ||
5476 | count = sizeof(*parm_data) + ea_value_len + name_len; | 5544 | count = sizeof(*parm_data) + ea_value_len + name_len; |
5477 | pSMB->MaxParameterCount = cpu_to_le16(2); | 5545 | pSMB->MaxParameterCount = cpu_to_le16(2); |
5478 | pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */ | 5546 | /* BB find max SMB PDU from sess */ |
5547 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
5479 | pSMB->MaxSetupCount = 0; | 5548 | pSMB->MaxSetupCount = 0; |
5480 | pSMB->Reserved = 0; | 5549 | pSMB->Reserved = 0; |
5481 | pSMB->Flags = 0; | 5550 | pSMB->Flags = 0; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index f428bf3bf1a9..023434f72c15 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -60,7 +60,7 @@ struct smb_vol { | |||
60 | char *domainname; | 60 | char *domainname; |
61 | char *UNC; | 61 | char *UNC; |
62 | char *UNCip; | 62 | char *UNCip; |
63 | char *in6_addr; /* ipv6 address as human readable form of in6_addr */ | 63 | char *in6_addr; /* ipv6 address as human readable form of in6_addr */ |
64 | char *iocharset; /* local code page for mapping to and from Unicode */ | 64 | char *iocharset; /* local code page for mapping to and from Unicode */ |
65 | char source_rfc1001_name[16]; /* netbios name of client */ | 65 | char source_rfc1001_name[16]; /* netbios name of client */ |
66 | char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */ | 66 | char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */ |
@@ -75,19 +75,21 @@ struct smb_vol { | |||
75 | bool setuids:1; | 75 | bool setuids:1; |
76 | bool override_uid:1; | 76 | bool override_uid:1; |
77 | bool override_gid:1; | 77 | bool override_gid:1; |
78 | bool dynperm:1; | ||
78 | bool noperm:1; | 79 | bool noperm:1; |
79 | bool no_psx_acl:1; /* set if posix acl support should be disabled */ | 80 | bool no_psx_acl:1; /* set if posix acl support should be disabled */ |
80 | bool cifs_acl:1; | 81 | bool cifs_acl:1; |
81 | bool no_xattr:1; /* set if xattr (EA) support should be disabled*/ | 82 | bool no_xattr:1; /* set if xattr (EA) support should be disabled*/ |
82 | bool server_ino:1; /* use inode numbers from server ie UniqueId */ | 83 | bool server_ino:1; /* use inode numbers from server ie UniqueId */ |
83 | bool direct_io:1; | 84 | bool direct_io:1; |
84 | bool remap:1; /* set to remap seven reserved chars in filenames */ | 85 | bool remap:1; /* set to remap seven reserved chars in filenames */ |
85 | bool posix_paths:1; /* unset to not ask for posix pathnames. */ | 86 | bool posix_paths:1; /* unset to not ask for posix pathnames. */ |
86 | bool no_linux_ext:1; | 87 | bool no_linux_ext:1; |
87 | bool sfu_emul:1; | 88 | bool sfu_emul:1; |
88 | bool nullauth:1; /* attempt to authenticate with null user */ | 89 | bool nullauth:1; /* attempt to authenticate with null user */ |
89 | unsigned nocase; /* request case insensitive filenames */ | 90 | bool nocase:1; /* request case insensitive filenames */ |
90 | unsigned nobrl; /* disable sending byte range locks to srv */ | 91 | bool nobrl:1; /* disable sending byte range locks to srv */ |
92 | bool seal:1; /* request transport encryption on share */ | ||
91 | unsigned int rsize; | 93 | unsigned int rsize; |
92 | unsigned int wsize; | 94 | unsigned int wsize; |
93 | unsigned int sockopt; | 95 | unsigned int sockopt; |
@@ -1246,6 +1248,10 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1246 | vol->setuids = 1; | 1248 | vol->setuids = 1; |
1247 | } else if (strnicmp(data, "nosetuids", 9) == 0) { | 1249 | } else if (strnicmp(data, "nosetuids", 9) == 0) { |
1248 | vol->setuids = 0; | 1250 | vol->setuids = 0; |
1251 | } else if (strnicmp(data, "dynperm", 7) == 0) { | ||
1252 | vol->dynperm = true; | ||
1253 | } else if (strnicmp(data, "nodynperm", 9) == 0) { | ||
1254 | vol->dynperm = false; | ||
1249 | } else if (strnicmp(data, "nohard", 6) == 0) { | 1255 | } else if (strnicmp(data, "nohard", 6) == 0) { |
1250 | vol->retry = 0; | 1256 | vol->retry = 0; |
1251 | } else if (strnicmp(data, "nosoft", 6) == 0) { | 1257 | } else if (strnicmp(data, "nosoft", 6) == 0) { |
@@ -1268,8 +1274,12 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1268 | vol->no_psx_acl = 1; | 1274 | vol->no_psx_acl = 1; |
1269 | } else if (strnicmp(data, "sign", 4) == 0) { | 1275 | } else if (strnicmp(data, "sign", 4) == 0) { |
1270 | vol->secFlg |= CIFSSEC_MUST_SIGN; | 1276 | vol->secFlg |= CIFSSEC_MUST_SIGN; |
1271 | /* } else if (strnicmp(data, "seal",4) == 0) { | 1277 | } else if (strnicmp(data, "seal", 4) == 0) { |
1272 | vol->secFlg |= CIFSSEC_MUST_SEAL; */ | 1278 | /* we do not do the following in secFlags because seal |
1279 | is a per tree connection (mount) not a per socket | ||
1280 | or per-smb connection option in the protocol */ | ||
1281 | /* vol->secFlg |= CIFSSEC_MUST_SEAL; */ | ||
1282 | vol->seal = 1; | ||
1273 | } else if (strnicmp(data, "direct", 6) == 0) { | 1283 | } else if (strnicmp(data, "direct", 6) == 0) { |
1274 | vol->direct_io = 1; | 1284 | vol->direct_io = 1; |
1275 | } else if (strnicmp(data, "forcedirectio", 13) == 0) { | 1285 | } else if (strnicmp(data, "forcedirectio", 13) == 0) { |
@@ -1414,34 +1424,12 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName) | |||
1414 | } | 1424 | } |
1415 | 1425 | ||
1416 | int | 1426 | int |
1417 | connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo, | ||
1418 | const char *old_path, const struct nls_table *nls_codepage, | ||
1419 | int remap) | ||
1420 | { | ||
1421 | struct dfs_info3_param *referrals = NULL; | ||
1422 | unsigned int num_referrals; | ||
1423 | int rc = 0; | ||
1424 | |||
1425 | rc = get_dfs_path(xid, pSesInfo, old_path, nls_codepage, | ||
1426 | &num_referrals, &referrals, remap); | ||
1427 | |||
1428 | /* BB Add in code to: if valid refrl, if not ip address contact | ||
1429 | the helper that resolves tcp names, mount to it, try to | ||
1430 | tcon to it unmount it if fail */ | ||
1431 | |||
1432 | kfree(referrals); | ||
1433 | |||
1434 | return rc; | ||
1435 | } | ||
1436 | |||
1437 | int | ||
1438 | get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path, | 1427 | get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path, |
1439 | const struct nls_table *nls_codepage, unsigned int *pnum_referrals, | 1428 | const struct nls_table *nls_codepage, unsigned int *pnum_referrals, |
1440 | struct dfs_info3_param **preferrals, int remap) | 1429 | struct dfs_info3_param **preferrals, int remap) |
1441 | { | 1430 | { |
1442 | char *temp_unc; | 1431 | char *temp_unc; |
1443 | int rc = 0; | 1432 | int rc = 0; |
1444 | unsigned char *targetUNCs; | ||
1445 | 1433 | ||
1446 | *pnum_referrals = 0; | 1434 | *pnum_referrals = 0; |
1447 | *preferrals = NULL; | 1435 | *preferrals = NULL; |
@@ -1464,7 +1452,7 @@ get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path, | |||
1464 | kfree(temp_unc); | 1452 | kfree(temp_unc); |
1465 | } | 1453 | } |
1466 | if (rc == 0) | 1454 | if (rc == 0) |
1467 | rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, &targetUNCs, | 1455 | rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals, |
1468 | pnum_referrals, nls_codepage, remap); | 1456 | pnum_referrals, nls_codepage, remap); |
1469 | /* BB map targetUNCs to dfs_info3 structures, here or | 1457 | /* BB map targetUNCs to dfs_info3 structures, here or |
1470 | in CIFSGetDFSRefer BB */ | 1458 | in CIFSGetDFSRefer BB */ |
@@ -1815,7 +1803,7 @@ convert_delimiter(char *path, char delim) | |||
1815 | if (path == NULL) | 1803 | if (path == NULL) |
1816 | return; | 1804 | return; |
1817 | 1805 | ||
1818 | if (delim == '/') | 1806 | if (delim == '/') |
1819 | old_delim = '\\'; | 1807 | old_delim = '\\'; |
1820 | else | 1808 | else |
1821 | old_delim = '/'; | 1809 | old_delim = '/'; |
@@ -2125,6 +2113,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2125 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; | 2113 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; |
2126 | if (volume_info.override_gid) | 2114 | if (volume_info.override_gid) |
2127 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID; | 2115 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID; |
2116 | if (volume_info.dynperm) | ||
2117 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM; | ||
2128 | if (volume_info.direct_io) { | 2118 | if (volume_info.direct_io) { |
2129 | cFYI(1, ("mounting share using direct i/o")); | 2119 | cFYI(1, ("mounting share using direct i/o")); |
2130 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; | 2120 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; |
@@ -2141,6 +2131,9 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2141 | for the retry flag is used */ | 2131 | for the retry flag is used */ |
2142 | tcon->retry = volume_info.retry; | 2132 | tcon->retry = volume_info.retry; |
2143 | tcon->nocase = volume_info.nocase; | 2133 | tcon->nocase = volume_info.nocase; |
2134 | if (tcon->seal != volume_info.seal) | ||
2135 | cERROR(1, ("transport encryption setting " | ||
2136 | "conflicts with existing tid")); | ||
2144 | } else { | 2137 | } else { |
2145 | tcon = tconInfoAlloc(); | 2138 | tcon = tconInfoAlloc(); |
2146 | if (tcon == NULL) | 2139 | if (tcon == NULL) |
@@ -2154,10 +2147,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2154 | if ((strchr(volume_info.UNC + 3, '\\') == NULL) | 2147 | if ((strchr(volume_info.UNC + 3, '\\') == NULL) |
2155 | && (strchr(volume_info.UNC + 3, '/') == | 2148 | && (strchr(volume_info.UNC + 3, '/') == |
2156 | NULL)) { | 2149 | NULL)) { |
2157 | rc = connect_to_dfs_path(xid, pSesInfo, | 2150 | /* rc = connect_to_dfs_path(xid, pSesInfo, |
2158 | "", cifs_sb->local_nls, | 2151 | "", cifs_sb->local_nls, |
2159 | cifs_sb->mnt_cifs_flags & | 2152 | cifs_sb->mnt_cifs_flags & |
2160 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 2153 | CIFS_MOUNT_MAP_SPECIAL_CHR);*/ |
2154 | cFYI(1, ("DFS root not supported")); | ||
2161 | rc = -ENODEV; | 2155 | rc = -ENODEV; |
2162 | goto out; | 2156 | goto out; |
2163 | } else { | 2157 | } else { |
@@ -2173,6 +2167,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2173 | atomic_inc(&pSesInfo->inUse); | 2167 | atomic_inc(&pSesInfo->inUse); |
2174 | tcon->retry = volume_info.retry; | 2168 | tcon->retry = volume_info.retry; |
2175 | tcon->nocase = volume_info.nocase; | 2169 | tcon->nocase = volume_info.nocase; |
2170 | tcon->seal = volume_info.seal; | ||
2176 | } | 2171 | } |
2177 | } | 2172 | } |
2178 | } | 2173 | } |
@@ -2314,9 +2309,10 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2314 | user = ses->userName; | 2309 | user = ses->userName; |
2315 | domain = ses->domainName; | 2310 | domain = ses->domainName; |
2316 | smb_buffer = cifs_buf_get(); | 2311 | smb_buffer = cifs_buf_get(); |
2317 | if (smb_buffer == NULL) { | 2312 | |
2313 | if (smb_buffer == NULL) | ||
2318 | return -ENOMEM; | 2314 | return -ENOMEM; |
2319 | } | 2315 | |
2320 | smb_buffer_response = smb_buffer; | 2316 | smb_buffer_response = smb_buffer; |
2321 | pSMBr = pSMB = (SESSION_SETUP_ANDX *) smb_buffer; | 2317 | pSMBr = pSMB = (SESSION_SETUP_ANDX *) smb_buffer; |
2322 | 2318 | ||
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index e4e0078a0526..f0b5b5f3dd2e 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -49,18 +49,25 @@ build_path_from_dentry(struct dentry *direntry) | |||
49 | struct dentry *temp; | 49 | struct dentry *temp; |
50 | int namelen; | 50 | int namelen; |
51 | int pplen; | 51 | int pplen; |
52 | int dfsplen; | ||
52 | char *full_path; | 53 | char *full_path; |
53 | char dirsep; | 54 | char dirsep; |
55 | struct cifs_sb_info *cifs_sb; | ||
54 | 56 | ||
55 | if (direntry == NULL) | 57 | if (direntry == NULL) |
56 | return NULL; /* not much we can do if dentry is freed and | 58 | return NULL; /* not much we can do if dentry is freed and |
57 | we need to reopen the file after it was closed implicitly | 59 | we need to reopen the file after it was closed implicitly |
58 | when the server crashed */ | 60 | when the server crashed */ |
59 | 61 | ||
60 | dirsep = CIFS_DIR_SEP(CIFS_SB(direntry->d_sb)); | 62 | cifs_sb = CIFS_SB(direntry->d_sb); |
61 | pplen = CIFS_SB(direntry->d_sb)->prepathlen; | 63 | dirsep = CIFS_DIR_SEP(cifs_sb); |
64 | pplen = cifs_sb->prepathlen; | ||
65 | if (cifs_sb->tcon && (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS)) | ||
66 | dfsplen = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE + 1); | ||
67 | else | ||
68 | dfsplen = 0; | ||
62 | cifs_bp_rename_retry: | 69 | cifs_bp_rename_retry: |
63 | namelen = pplen; | 70 | namelen = pplen + dfsplen; |
64 | for (temp = direntry; !IS_ROOT(temp);) { | 71 | for (temp = direntry; !IS_ROOT(temp);) { |
65 | namelen += (1 + temp->d_name.len); | 72 | namelen += (1 + temp->d_name.len); |
66 | temp = temp->d_parent; | 73 | temp = temp->d_parent; |
@@ -91,7 +98,7 @@ cifs_bp_rename_retry: | |||
91 | return NULL; | 98 | return NULL; |
92 | } | 99 | } |
93 | } | 100 | } |
94 | if (namelen != pplen) { | 101 | if (namelen != pplen + dfsplen) { |
95 | cERROR(1, | 102 | cERROR(1, |
96 | ("did not end path lookup where expected namelen is %d", | 103 | ("did not end path lookup where expected namelen is %d", |
97 | namelen)); | 104 | namelen)); |
@@ -107,7 +114,18 @@ cifs_bp_rename_retry: | |||
107 | since the '\' is a valid posix character so we can not switch | 114 | since the '\' is a valid posix character so we can not switch |
108 | those safely to '/' if any are found in the middle of the prepath */ | 115 | those safely to '/' if any are found in the middle of the prepath */ |
109 | /* BB test paths to Windows with '/' in the midst of prepath */ | 116 | /* BB test paths to Windows with '/' in the midst of prepath */ |
110 | strncpy(full_path, CIFS_SB(direntry->d_sb)->prepath, pplen); | 117 | |
118 | if (dfsplen) { | ||
119 | strncpy(full_path, cifs_sb->tcon->treeName, dfsplen); | ||
120 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) { | ||
121 | int i; | ||
122 | for (i = 0; i < dfsplen; i++) { | ||
123 | if (full_path[i] == '\\') | ||
124 | full_path[i] = '/'; | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | strncpy(full_path + dfsplen, CIFS_SB(direntry->d_sb)->prepath, pplen); | ||
111 | return full_path; | 129 | return full_path; |
112 | } | 130 | } |
113 | 131 | ||
@@ -590,7 +608,7 @@ static int cifs_ci_compare(struct dentry *dentry, struct qstr *a, | |||
590 | * case take precedence. If a is not a negative dentry, this | 608 | * case take precedence. If a is not a negative dentry, this |
591 | * should have no side effects | 609 | * should have no side effects |
592 | */ | 610 | */ |
593 | memcpy(a->name, b->name, a->len); | 611 | memcpy((void *)a->name, b->name, a->len); |
594 | return 0; | 612 | return 0; |
595 | } | 613 | } |
596 | return 1; | 614 | return 1; |
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index 939e256f8497..f730ef35499e 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -134,10 +134,6 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) | |||
134 | rkey = request_key(&key_type_dns_resolver, name, ""); | 134 | rkey = request_key(&key_type_dns_resolver, name, ""); |
135 | if (!IS_ERR(rkey)) { | 135 | if (!IS_ERR(rkey)) { |
136 | data = rkey->payload.data; | 136 | data = rkey->payload.data; |
137 | cFYI(1, ("%s: resolved: %s to %s", __func__, | ||
138 | rkey->description, | ||
139 | *ip_addr | ||
140 | )); | ||
141 | } else { | 137 | } else { |
142 | cERROR(1, ("%s: unable to resolve: %s", __func__, name)); | 138 | cERROR(1, ("%s: unable to resolve: %s", __func__, name)); |
143 | goto out; | 139 | goto out; |
@@ -150,6 +146,11 @@ skip_upcall: | |||
150 | if (*ip_addr) { | 146 | if (*ip_addr) { |
151 | memcpy(*ip_addr, data, len); | 147 | memcpy(*ip_addr, data, len); |
152 | (*ip_addr)[len] = '\0'; | 148 | (*ip_addr)[len] = '\0'; |
149 | if (!IS_ERR(rkey)) | ||
150 | cFYI(1, ("%s: resolved: %s to %s", __func__, | ||
151 | name, | ||
152 | *ip_addr | ||
153 | )); | ||
153 | rc = 0; | 154 | rc = 0; |
154 | } else { | 155 | } else { |
155 | rc = -ENOMEM; | 156 | rc = -ENOMEM; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 31a0a33b9d95..8636cec2642c 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -75,7 +75,11 @@ static inline int cifs_convert_flags(unsigned int flags) | |||
75 | return (GENERIC_READ | GENERIC_WRITE); | 75 | return (GENERIC_READ | GENERIC_WRITE); |
76 | } | 76 | } |
77 | 77 | ||
78 | return 0x20197; | 78 | return (READ_CONTROL | FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES | |
79 | FILE_WRITE_EA | FILE_APPEND_DATA | FILE_WRITE_DATA | | ||
80 | FILE_READ_DATA); | ||
81 | |||
82 | |||
79 | } | 83 | } |
80 | 84 | ||
81 | static inline int cifs_get_disposition(unsigned int flags) | 85 | static inline int cifs_get_disposition(unsigned int flags) |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index fcbdbb6ad7bf..00ced97bd53a 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -161,118 +161,115 @@ static void cifs_unix_info_to_inode(struct inode *inode, | |||
161 | spin_unlock(&inode->i_lock); | 161 | spin_unlock(&inode->i_lock); |
162 | } | 162 | } |
163 | 163 | ||
164 | static const unsigned char *cifs_get_search_path(struct cifs_sb_info *cifs_sb, | ||
165 | const char *search_path) | ||
166 | { | ||
167 | int tree_len; | ||
168 | int path_len; | ||
169 | int i; | ||
170 | char *tmp_path; | ||
171 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | ||
172 | |||
173 | if (!(pTcon->Flags & SMB_SHARE_IS_IN_DFS)) | ||
174 | return search_path; | ||
175 | 164 | ||
176 | /* use full path name for working with DFS */ | 165 | /* |
177 | tree_len = strnlen(pTcon->treeName, MAX_TREE_SIZE + 1); | 166 | * Needed to setup inode data for the directory which is the |
178 | path_len = strnlen(search_path, MAX_PATHCONF); | 167 | * junction to the new submount (ie to setup the fake directory |
179 | 168 | * which represents a DFS referral) | |
180 | tmp_path = kmalloc(tree_len+path_len+1, GFP_KERNEL); | 169 | */ |
181 | if (tmp_path == NULL) | 170 | static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat, |
182 | return search_path; | 171 | struct super_block *sb) |
172 | { | ||
173 | struct inode *pinode = NULL; | ||
174 | |||
175 | memset(pfnd_dat, sizeof(FILE_UNIX_BASIC_INFO), 0); | ||
176 | |||
177 | /* __le64 pfnd_dat->EndOfFile = cpu_to_le64(0); | ||
178 | __le64 pfnd_dat->NumOfBytes = cpu_to_le64(0); | ||
179 | __u64 UniqueId = 0; */ | ||
180 | pfnd_dat->LastStatusChange = | ||
181 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
182 | pfnd_dat->LastAccessTime = | ||
183 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
184 | pfnd_dat->LastModificationTime = | ||
185 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
186 | pfnd_dat->Type = cpu_to_le32(UNIX_DIR); | ||
187 | pfnd_dat->Permissions = cpu_to_le64(S_IXUGO | S_IRWXU); | ||
188 | pfnd_dat->Nlinks = cpu_to_le64(2); | ||
189 | if (sb->s_root) | ||
190 | pinode = sb->s_root->d_inode; | ||
191 | if (pinode == NULL) | ||
192 | return; | ||
183 | 193 | ||
184 | strncpy(tmp_path, pTcon->treeName, tree_len); | 194 | /* fill in default values for the remaining based on root |
185 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | 195 | inode since we can not query the server for this inode info */ |
186 | for (i = 0; i < tree_len; i++) { | 196 | pfnd_dat->DevMajor = cpu_to_le64(MAJOR(pinode->i_rdev)); |
187 | if (tmp_path[i] == '\\') | 197 | pfnd_dat->DevMinor = cpu_to_le64(MINOR(pinode->i_rdev)); |
188 | tmp_path[i] = '/'; | 198 | pfnd_dat->Uid = cpu_to_le64(pinode->i_uid); |
189 | } | 199 | pfnd_dat->Gid = cpu_to_le64(pinode->i_gid); |
190 | strncpy(tmp_path+tree_len, search_path, path_len); | ||
191 | tmp_path[tree_len+path_len] = 0; | ||
192 | return tmp_path; | ||
193 | } | 200 | } |
194 | 201 | ||
195 | int cifs_get_inode_info_unix(struct inode **pinode, | 202 | int cifs_get_inode_info_unix(struct inode **pinode, |
196 | const unsigned char *search_path, struct super_block *sb, int xid) | 203 | const unsigned char *full_path, struct super_block *sb, int xid) |
197 | { | 204 | { |
198 | int rc = 0; | 205 | int rc = 0; |
199 | FILE_UNIX_BASIC_INFO findData; | 206 | FILE_UNIX_BASIC_INFO find_data; |
200 | struct cifsTconInfo *pTcon; | 207 | struct cifsTconInfo *pTcon; |
201 | struct inode *inode; | 208 | struct inode *inode; |
202 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 209 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
203 | const unsigned char *full_path; | ||
204 | bool is_dfs_referral = false; | 210 | bool is_dfs_referral = false; |
211 | struct cifsInodeInfo *cifsInfo; | ||
212 | __u64 num_of_bytes; | ||
213 | __u64 end_of_file; | ||
205 | 214 | ||
206 | pTcon = cifs_sb->tcon; | 215 | pTcon = cifs_sb->tcon; |
207 | cFYI(1, ("Getting info on %s", search_path)); | 216 | cFYI(1, ("Getting info on %s", full_path)); |
208 | 217 | ||
209 | full_path = cifs_get_search_path(cifs_sb, search_path); | ||
210 | |||
211 | try_again_CIFSSMBUnixQPathInfo: | ||
212 | /* could have done a find first instead but this returns more info */ | 218 | /* could have done a find first instead but this returns more info */ |
213 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, full_path, &findData, | 219 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, full_path, &find_data, |
214 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | 220 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & |
215 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 221 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
216 | /* dump_mem("\nUnixQPathInfo return data", &findData, | ||
217 | sizeof(findData)); */ | ||
218 | if (rc) { | 222 | if (rc) { |
219 | if (rc == -EREMOTE && !is_dfs_referral) { | 223 | if (rc == -EREMOTE && !is_dfs_referral) { |
220 | is_dfs_referral = true; | 224 | is_dfs_referral = true; |
221 | if (full_path != search_path) { | 225 | cFYI(DBG2, ("DFS ref")); |
222 | kfree(full_path); | 226 | /* for DFS, server does not give us real inode data */ |
223 | full_path = search_path; | 227 | fill_fake_finddataunix(&find_data, sb); |
224 | } | 228 | rc = 0; |
225 | goto try_again_CIFSSMBUnixQPathInfo; | ||
226 | } | 229 | } |
227 | goto cgiiu_exit; | 230 | } |
228 | } else { | 231 | num_of_bytes = le64_to_cpu(find_data.NumOfBytes); |
229 | struct cifsInodeInfo *cifsInfo; | 232 | end_of_file = le64_to_cpu(find_data.EndOfFile); |
230 | __u64 num_of_bytes = le64_to_cpu(findData.NumOfBytes); | ||
231 | __u64 end_of_file = le64_to_cpu(findData.EndOfFile); | ||
232 | 233 | ||
233 | /* get new inode */ | 234 | /* get new inode */ |
235 | if (*pinode == NULL) { | ||
236 | *pinode = new_inode(sb); | ||
234 | if (*pinode == NULL) { | 237 | if (*pinode == NULL) { |
235 | *pinode = new_inode(sb); | 238 | rc = -ENOMEM; |
236 | if (*pinode == NULL) { | 239 | goto cgiiu_exit; |
237 | rc = -ENOMEM; | ||
238 | goto cgiiu_exit; | ||
239 | } | ||
240 | /* Is an i_ino of zero legal? */ | ||
241 | /* Are there sanity checks we can use to ensure that | ||
242 | the server is really filling in that field? */ | ||
243 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | ||
244 | (*pinode)->i_ino = | ||
245 | (unsigned long)findData.UniqueId; | ||
246 | } /* note ino incremented to unique num in new_inode */ | ||
247 | if (sb->s_flags & MS_NOATIME) | ||
248 | (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME; | ||
249 | |||
250 | insert_inode_hash(*pinode); | ||
251 | } | 240 | } |
241 | /* Is an i_ino of zero legal? */ | ||
242 | /* note ino incremented to unique num in new_inode */ | ||
243 | /* Are there sanity checks we can use to ensure that | ||
244 | the server is really filling in that field? */ | ||
245 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) | ||
246 | (*pinode)->i_ino = (unsigned long)find_data.UniqueId; | ||
252 | 247 | ||
253 | inode = *pinode; | 248 | if (sb->s_flags & MS_NOATIME) |
254 | cifsInfo = CIFS_I(inode); | 249 | (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME; |
255 | 250 | ||
256 | cFYI(1, ("Old time %ld", cifsInfo->time)); | 251 | insert_inode_hash(*pinode); |
257 | cifsInfo->time = jiffies; | 252 | } |
258 | cFYI(1, ("New time %ld", cifsInfo->time)); | ||
259 | /* this is ok to set on every inode revalidate */ | ||
260 | atomic_set(&cifsInfo->inUse, 1); | ||
261 | 253 | ||
262 | cifs_unix_info_to_inode(inode, &findData, 0); | 254 | inode = *pinode; |
255 | cifsInfo = CIFS_I(inode); | ||
263 | 256 | ||
257 | cFYI(1, ("Old time %ld", cifsInfo->time)); | ||
258 | cifsInfo->time = jiffies; | ||
259 | cFYI(1, ("New time %ld", cifsInfo->time)); | ||
260 | /* this is ok to set on every inode revalidate */ | ||
261 | atomic_set(&cifsInfo->inUse, 1); | ||
264 | 262 | ||
265 | if (num_of_bytes < end_of_file) | 263 | cifs_unix_info_to_inode(inode, &find_data, 0); |
266 | cFYI(1, ("allocation size less than end of file")); | ||
267 | cFYI(1, ("Size %ld and blocks %llu", | ||
268 | (unsigned long) inode->i_size, | ||
269 | (unsigned long long)inode->i_blocks)); | ||
270 | 264 | ||
271 | cifs_set_ops(inode, is_dfs_referral); | 265 | if (num_of_bytes < end_of_file) |
272 | } | 266 | cFYI(1, ("allocation size less than end of file")); |
267 | cFYI(1, ("Size %ld and blocks %llu", | ||
268 | (unsigned long) inode->i_size, | ||
269 | (unsigned long long)inode->i_blocks)); | ||
270 | |||
271 | cifs_set_ops(inode, is_dfs_referral); | ||
273 | cgiiu_exit: | 272 | cgiiu_exit: |
274 | if (full_path != search_path) | ||
275 | kfree(full_path); | ||
276 | return rc; | 273 | return rc; |
277 | } | 274 | } |
278 | 275 | ||
@@ -379,21 +376,51 @@ static int get_sfu_mode(struct inode *inode, | |||
379 | #endif | 376 | #endif |
380 | } | 377 | } |
381 | 378 | ||
379 | /* | ||
380 | * Needed to setup inode data for the directory which is the | ||
381 | * junction to the new submount (ie to setup the fake directory | ||
382 | * which represents a DFS referral) | ||
383 | */ | ||
384 | static void fill_fake_finddata(FILE_ALL_INFO *pfnd_dat, | ||
385 | struct super_block *sb) | ||
386 | { | ||
387 | memset(pfnd_dat, sizeof(FILE_ALL_INFO), 0); | ||
388 | |||
389 | /* __le64 pfnd_dat->AllocationSize = cpu_to_le64(0); | ||
390 | __le64 pfnd_dat->EndOfFile = cpu_to_le64(0); | ||
391 | __u8 pfnd_dat->DeletePending = 0; | ||
392 | __u8 pfnd_data->Directory = 0; | ||
393 | __le32 pfnd_dat->EASize = 0; | ||
394 | __u64 pfnd_dat->IndexNumber = 0; | ||
395 | __u64 pfnd_dat->IndexNumber1 = 0; */ | ||
396 | pfnd_dat->CreationTime = | ||
397 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
398 | pfnd_dat->LastAccessTime = | ||
399 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
400 | pfnd_dat->LastWriteTime = | ||
401 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
402 | pfnd_dat->ChangeTime = | ||
403 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
404 | pfnd_dat->Attributes = cpu_to_le32(ATTR_DIRECTORY); | ||
405 | pfnd_dat->NumberOfLinks = cpu_to_le32(2); | ||
406 | } | ||
407 | |||
382 | int cifs_get_inode_info(struct inode **pinode, | 408 | int cifs_get_inode_info(struct inode **pinode, |
383 | const unsigned char *search_path, FILE_ALL_INFO *pfindData, | 409 | const unsigned char *full_path, FILE_ALL_INFO *pfindData, |
384 | struct super_block *sb, int xid, const __u16 *pfid) | 410 | struct super_block *sb, int xid, const __u16 *pfid) |
385 | { | 411 | { |
386 | int rc = 0; | 412 | int rc = 0; |
413 | __u32 attr; | ||
414 | struct cifsInodeInfo *cifsInfo; | ||
387 | struct cifsTconInfo *pTcon; | 415 | struct cifsTconInfo *pTcon; |
388 | struct inode *inode; | 416 | struct inode *inode; |
389 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 417 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
390 | const unsigned char *full_path = NULL; | ||
391 | char *buf = NULL; | 418 | char *buf = NULL; |
392 | bool adjustTZ = false; | 419 | bool adjustTZ = false; |
393 | bool is_dfs_referral = false; | 420 | bool is_dfs_referral = false; |
394 | 421 | ||
395 | pTcon = cifs_sb->tcon; | 422 | pTcon = cifs_sb->tcon; |
396 | cFYI(1, ("Getting info on %s", search_path)); | 423 | cFYI(1, ("Getting info on %s", full_path)); |
397 | 424 | ||
398 | if ((pfindData == NULL) && (*pinode != NULL)) { | 425 | if ((pfindData == NULL) && (*pinode != NULL)) { |
399 | if (CIFS_I(*pinode)->clientCanCacheRead) { | 426 | if (CIFS_I(*pinode)->clientCanCacheRead) { |
@@ -409,9 +436,6 @@ int cifs_get_inode_info(struct inode **pinode, | |||
409 | return -ENOMEM; | 436 | return -ENOMEM; |
410 | pfindData = (FILE_ALL_INFO *)buf; | 437 | pfindData = (FILE_ALL_INFO *)buf; |
411 | 438 | ||
412 | full_path = cifs_get_search_path(cifs_sb, search_path); | ||
413 | |||
414 | try_again_CIFSSMBQPathInfo: | ||
415 | /* could do find first instead but this returns more info */ | 439 | /* could do find first instead but this returns more info */ |
416 | rc = CIFSSMBQPathInfo(xid, pTcon, full_path, pfindData, | 440 | rc = CIFSSMBQPathInfo(xid, pTcon, full_path, pfindData, |
417 | 0 /* not legacy */, | 441 | 0 /* not legacy */, |
@@ -429,178 +453,168 @@ try_again_CIFSSMBQPathInfo: | |||
429 | } | 453 | } |
430 | } | 454 | } |
431 | /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ | 455 | /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ |
432 | if (rc) { | 456 | if (rc == -EREMOTE) { |
433 | if (rc == -EREMOTE && !is_dfs_referral) { | 457 | is_dfs_referral = true; |
434 | is_dfs_referral = true; | 458 | fill_fake_finddata(pfindData, sb); |
435 | if (full_path != search_path) { | 459 | rc = 0; |
436 | kfree(full_path); | 460 | } else if (rc) |
437 | full_path = search_path; | ||
438 | } | ||
439 | goto try_again_CIFSSMBQPathInfo; | ||
440 | } | ||
441 | goto cgii_exit; | 461 | goto cgii_exit; |
442 | } else { | ||
443 | struct cifsInodeInfo *cifsInfo; | ||
444 | __u32 attr = le32_to_cpu(pfindData->Attributes); | ||
445 | 462 | ||
446 | /* get new inode */ | 463 | attr = le32_to_cpu(pfindData->Attributes); |
447 | if (*pinode == NULL) { | ||
448 | *pinode = new_inode(sb); | ||
449 | if (*pinode == NULL) { | ||
450 | rc = -ENOMEM; | ||
451 | goto cgii_exit; | ||
452 | } | ||
453 | /* Is an i_ino of zero legal? Can we use that to check | ||
454 | if the server supports returning inode numbers? Are | ||
455 | there other sanity checks we can use to ensure that | ||
456 | the server is really filling in that field? */ | ||
457 | 464 | ||
458 | /* We can not use the IndexNumber field by default from | 465 | /* get new inode */ |
459 | Windows or Samba (in ALL_INFO buf) but we can request | 466 | if (*pinode == NULL) { |
460 | it explicitly. It may not be unique presumably if | 467 | *pinode = new_inode(sb); |
461 | the server has multiple devices mounted under one | 468 | if (*pinode == NULL) { |
462 | share */ | 469 | rc = -ENOMEM; |
463 | 470 | goto cgii_exit; | |
464 | /* There may be higher info levels that work but are | 471 | } |
465 | there Windows server or network appliances for which | 472 | /* Is an i_ino of zero legal? Can we use that to check |
466 | IndexNumber field is not guaranteed unique? */ | 473 | if the server supports returning inode numbers? Are |
467 | 474 | there other sanity checks we can use to ensure that | |
468 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | 475 | the server is really filling in that field? */ |
469 | int rc1 = 0; | 476 | |
470 | __u64 inode_num; | 477 | /* We can not use the IndexNumber field by default from |
471 | 478 | Windows or Samba (in ALL_INFO buf) but we can request | |
472 | rc1 = CIFSGetSrvInodeNumber(xid, pTcon, | 479 | it explicitly. It may not be unique presumably if |
473 | search_path, &inode_num, | 480 | the server has multiple devices mounted under one share */ |
481 | |||
482 | /* There may be higher info levels that work but are | ||
483 | there Windows server or network appliances for which | ||
484 | IndexNumber field is not guaranteed unique? */ | ||
485 | |||
486 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | ||
487 | int rc1 = 0; | ||
488 | __u64 inode_num; | ||
489 | |||
490 | rc1 = CIFSGetSrvInodeNumber(xid, pTcon, | ||
491 | full_path, &inode_num, | ||
474 | cifs_sb->local_nls, | 492 | cifs_sb->local_nls, |
475 | cifs_sb->mnt_cifs_flags & | 493 | cifs_sb->mnt_cifs_flags & |
476 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 494 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
477 | if (rc1) { | 495 | if (rc1) { |
478 | cFYI(1, ("GetSrvInodeNum rc %d", rc1)); | 496 | cFYI(1, ("GetSrvInodeNum rc %d", rc1)); |
479 | /* BB EOPNOSUPP disable SERVER_INUM? */ | 497 | /* BB EOPNOSUPP disable SERVER_INUM? */ |
480 | } else /* do we need cast or hash to ino? */ | 498 | } else /* do we need cast or hash to ino? */ |
481 | (*pinode)->i_ino = inode_num; | 499 | (*pinode)->i_ino = inode_num; |
482 | } /* else ino incremented to unique num in new_inode*/ | 500 | } /* else ino incremented to unique num in new_inode*/ |
483 | if (sb->s_flags & MS_NOATIME) | 501 | if (sb->s_flags & MS_NOATIME) |
484 | (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME; | 502 | (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME; |
485 | insert_inode_hash(*pinode); | 503 | insert_inode_hash(*pinode); |
486 | } | 504 | } |
487 | inode = *pinode; | 505 | inode = *pinode; |
488 | cifsInfo = CIFS_I(inode); | 506 | cifsInfo = CIFS_I(inode); |
489 | cifsInfo->cifsAttrs = attr; | 507 | cifsInfo->cifsAttrs = attr; |
490 | cFYI(1, ("Old time %ld", cifsInfo->time)); | 508 | cFYI(1, ("Old time %ld", cifsInfo->time)); |
491 | cifsInfo->time = jiffies; | 509 | cifsInfo->time = jiffies; |
492 | cFYI(1, ("New time %ld", cifsInfo->time)); | 510 | cFYI(1, ("New time %ld", cifsInfo->time)); |
493 | 511 | ||
494 | /* blksize needs to be multiple of two. So safer to default to | 512 | /* blksize needs to be multiple of two. So safer to default to |
495 | blksize and blkbits set in superblock so 2**blkbits and blksize | 513 | blksize and blkbits set in superblock so 2**blkbits and blksize |
496 | will match rather than setting to: | 514 | will match rather than setting to: |
497 | (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ | 515 | (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ |
498 | 516 | ||
499 | /* Linux can not store file creation time so ignore it */ | 517 | /* Linux can not store file creation time so ignore it */ |
500 | if (pfindData->LastAccessTime) | 518 | if (pfindData->LastAccessTime) |
501 | inode->i_atime = cifs_NTtimeToUnix | 519 | inode->i_atime = cifs_NTtimeToUnix |
502 | (le64_to_cpu(pfindData->LastAccessTime)); | 520 | (le64_to_cpu(pfindData->LastAccessTime)); |
503 | else /* do not need to use current_fs_time - time not stored */ | 521 | else /* do not need to use current_fs_time - time not stored */ |
504 | inode->i_atime = CURRENT_TIME; | 522 | inode->i_atime = CURRENT_TIME; |
505 | inode->i_mtime = | 523 | inode->i_mtime = |
506 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime)); | 524 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastWriteTime)); |
507 | inode->i_ctime = | 525 | inode->i_ctime = |
508 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); | 526 | cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); |
509 | cFYI(0, ("Attributes came in as 0x%x", attr)); | 527 | cFYI(DBG2, ("Attributes came in as 0x%x", attr)); |
510 | if (adjustTZ && (pTcon->ses) && (pTcon->ses->server)) { | 528 | if (adjustTZ && (pTcon->ses) && (pTcon->ses->server)) { |
511 | inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj; | 529 | inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj; |
512 | inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj; | 530 | inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj; |
513 | } | 531 | } |
514 | 532 | ||
515 | /* set default mode. will override for dirs below */ | 533 | /* set default mode. will override for dirs below */ |
516 | if (atomic_read(&cifsInfo->inUse) == 0) | 534 | if (atomic_read(&cifsInfo->inUse) == 0) |
517 | /* new inode, can safely set these fields */ | 535 | /* new inode, can safely set these fields */ |
518 | inode->i_mode = cifs_sb->mnt_file_mode; | 536 | inode->i_mode = cifs_sb->mnt_file_mode; |
519 | else /* since we set the inode type below we need to mask off | 537 | else /* since we set the inode type below we need to mask off |
520 | to avoid strange results if type changes and both | 538 | to avoid strange results if type changes and both |
521 | get orred in */ | 539 | get orred in */ |
522 | inode->i_mode &= ~S_IFMT; | 540 | inode->i_mode &= ~S_IFMT; |
523 | /* if (attr & ATTR_REPARSE) */ | 541 | /* if (attr & ATTR_REPARSE) */ |
524 | /* We no longer handle these as symlinks because we could not | 542 | /* We no longer handle these as symlinks because we could not |
525 | follow them due to the absolute path with drive letter */ | 543 | follow them due to the absolute path with drive letter */ |
526 | if (attr & ATTR_DIRECTORY) { | 544 | if (attr & ATTR_DIRECTORY) { |
527 | /* override default perms since we do not do byte range locking | 545 | /* override default perms since we do not do byte range locking |
528 | on dirs */ | 546 | on dirs */ |
529 | inode->i_mode = cifs_sb->mnt_dir_mode; | 547 | inode->i_mode = cifs_sb->mnt_dir_mode; |
530 | inode->i_mode |= S_IFDIR; | 548 | inode->i_mode |= S_IFDIR; |
531 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | 549 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && |
532 | (cifsInfo->cifsAttrs & ATTR_SYSTEM) && | 550 | (cifsInfo->cifsAttrs & ATTR_SYSTEM) && |
533 | /* No need to le64 convert size of zero */ | 551 | /* No need to le64 convert size of zero */ |
534 | (pfindData->EndOfFile == 0)) { | 552 | (pfindData->EndOfFile == 0)) { |
535 | inode->i_mode = cifs_sb->mnt_file_mode; | 553 | inode->i_mode = cifs_sb->mnt_file_mode; |
536 | inode->i_mode |= S_IFIFO; | 554 | inode->i_mode |= S_IFIFO; |
537 | /* BB Finish for SFU style symlinks and devices */ | 555 | /* BB Finish for SFU style symlinks and devices */ |
538 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | 556 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && |
539 | (cifsInfo->cifsAttrs & ATTR_SYSTEM)) { | 557 | (cifsInfo->cifsAttrs & ATTR_SYSTEM)) { |
540 | if (decode_sfu_inode(inode, | 558 | if (decode_sfu_inode(inode, le64_to_cpu(pfindData->EndOfFile), |
541 | le64_to_cpu(pfindData->EndOfFile), | 559 | full_path, cifs_sb, xid)) |
542 | search_path, | 560 | cFYI(1, ("Unrecognized sfu inode type")); |
543 | cifs_sb, xid)) | ||
544 | cFYI(1, ("Unrecognized sfu inode type")); | ||
545 | |||
546 | cFYI(1, ("sfu mode 0%o", inode->i_mode)); | ||
547 | } else { | ||
548 | inode->i_mode |= S_IFREG; | ||
549 | /* treat the dos attribute of read-only as read-only | ||
550 | mode e.g. 555 */ | ||
551 | if (cifsInfo->cifsAttrs & ATTR_READONLY) | ||
552 | inode->i_mode &= ~(S_IWUGO); | ||
553 | else if ((inode->i_mode & S_IWUGO) == 0) | ||
554 | /* the ATTR_READONLY flag may have been */ | ||
555 | /* changed on server -- set any w bits */ | ||
556 | /* allowed by mnt_file_mode */ | ||
557 | inode->i_mode |= (S_IWUGO & | ||
558 | cifs_sb->mnt_file_mode); | ||
559 | /* BB add code here - | ||
560 | validate if device or weird share or device type? */ | ||
561 | } | ||
562 | 561 | ||
563 | spin_lock(&inode->i_lock); | 562 | cFYI(1, ("sfu mode 0%o", inode->i_mode)); |
564 | if (is_size_safe_to_change(cifsInfo, | 563 | } else { |
565 | le64_to_cpu(pfindData->EndOfFile))) { | 564 | inode->i_mode |= S_IFREG; |
566 | /* can not safely shrink the file size here if the | 565 | /* treat dos attribute of read-only as read-only mode eg 555 */ |
567 | client is writing to it due to potential races */ | 566 | if (cifsInfo->cifsAttrs & ATTR_READONLY) |
568 | i_size_write(inode, le64_to_cpu(pfindData->EndOfFile)); | 567 | inode->i_mode &= ~(S_IWUGO); |
569 | 568 | else if ((inode->i_mode & S_IWUGO) == 0) | |
570 | /* 512 bytes (2**9) is the fake blocksize that must be | 569 | /* the ATTR_READONLY flag may have been */ |
571 | used for this calculation */ | 570 | /* changed on server -- set any w bits */ |
572 | inode->i_blocks = (512 - 1 + le64_to_cpu( | 571 | /* allowed by mnt_file_mode */ |
573 | pfindData->AllocationSize)) >> 9; | 572 | inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode); |
574 | } | 573 | /* BB add code to validate if device or weird share or device type? */ |
575 | spin_unlock(&inode->i_lock); | 574 | } |
575 | |||
576 | spin_lock(&inode->i_lock); | ||
577 | if (is_size_safe_to_change(cifsInfo, | ||
578 | le64_to_cpu(pfindData->EndOfFile))) { | ||
579 | /* can not safely shrink the file size here if the | ||
580 | client is writing to it due to potential races */ | ||
581 | i_size_write(inode, le64_to_cpu(pfindData->EndOfFile)); | ||
582 | |||
583 | /* 512 bytes (2**9) is the fake blocksize that must be | ||
584 | used for this calculation */ | ||
585 | inode->i_blocks = (512 - 1 + le64_to_cpu( | ||
586 | pfindData->AllocationSize)) >> 9; | ||
587 | } | ||
588 | spin_unlock(&inode->i_lock); | ||
576 | 589 | ||
577 | inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); | 590 | inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); |
578 | 591 | ||
579 | /* BB fill in uid and gid here? with help from winbind? | 592 | /* BB fill in uid and gid here? with help from winbind? |
580 | or retrieve from NTFS stream extended attribute */ | 593 | or retrieve from NTFS stream extended attribute */ |
581 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 594 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
582 | /* fill in 0777 bits from ACL */ | 595 | /* fill in 0777 bits from ACL */ |
583 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | 596 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { |
584 | cFYI(1, ("Getting mode bits from ACL")); | 597 | cFYI(1, ("Getting mode bits from ACL")); |
585 | acl_to_uid_mode(inode, search_path, pfid); | 598 | acl_to_uid_mode(inode, full_path, pfid); |
586 | } | 599 | } |
587 | #endif | 600 | #endif |
588 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { | 601 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { |
589 | /* fill in remaining high mode bits e.g. SUID, VTX */ | 602 | /* fill in remaining high mode bits e.g. SUID, VTX */ |
590 | get_sfu_mode(inode, search_path, cifs_sb, xid); | 603 | get_sfu_mode(inode, full_path, cifs_sb, xid); |
591 | } else if (atomic_read(&cifsInfo->inUse) == 0) { | 604 | } else if (atomic_read(&cifsInfo->inUse) == 0) { |
592 | inode->i_uid = cifs_sb->mnt_uid; | 605 | inode->i_uid = cifs_sb->mnt_uid; |
593 | inode->i_gid = cifs_sb->mnt_gid; | 606 | inode->i_gid = cifs_sb->mnt_gid; |
594 | /* set so we do not keep refreshing these fields with | 607 | /* set so we do not keep refreshing these fields with |
595 | bad data after user has changed them in memory */ | 608 | bad data after user has changed them in memory */ |
596 | atomic_set(&cifsInfo->inUse, 1); | 609 | atomic_set(&cifsInfo->inUse, 1); |
597 | } | ||
598 | |||
599 | cifs_set_ops(inode, is_dfs_referral); | ||
600 | } | 610 | } |
611 | |||
612 | cifs_set_ops(inode, is_dfs_referral); | ||
613 | |||
614 | |||
615 | |||
616 | |||
601 | cgii_exit: | 617 | cgii_exit: |
602 | if (full_path != search_path) | ||
603 | kfree(full_path); | ||
604 | kfree(buf); | 618 | kfree(buf); |
605 | return rc; | 619 | return rc; |
606 | } | 620 | } |
@@ -1502,8 +1516,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1502 | int oplock = 0; | 1516 | int oplock = 0; |
1503 | 1517 | ||
1504 | rc = SMBLegacyOpen(xid, pTcon, full_path, | 1518 | rc = SMBLegacyOpen(xid, pTcon, full_path, |
1505 | FILE_OPEN, | 1519 | FILE_OPEN, GENERIC_WRITE, |
1506 | SYNCHRONIZE | FILE_WRITE_ATTRIBUTES, | ||
1507 | CREATE_NOT_DIR, &netfid, &oplock, | 1520 | CREATE_NOT_DIR, &netfid, &oplock, |
1508 | NULL, cifs_sb->local_nls, | 1521 | NULL, cifs_sb->local_nls, |
1509 | cifs_sb->mnt_cifs_flags & | 1522 | cifs_sb->mnt_cifs_flags & |
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index 5c792df13d62..0088a5b52564 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c | |||
@@ -30,9 +30,9 @@ | |||
30 | 30 | ||
31 | #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) | 31 | #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) |
32 | 32 | ||
33 | int cifs_ioctl(struct inode *inode, struct file *filep, | 33 | long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) |
34 | unsigned int command, unsigned long arg) | ||
35 | { | 34 | { |
35 | struct inode *inode = filep->f_dentry->d_inode; | ||
36 | int rc = -ENOTTY; /* strange error - but the precedent */ | 36 | int rc = -ENOTTY; /* strange error - but the precedent */ |
37 | int xid; | 37 | int xid; |
38 | struct cifs_sb_info *cifs_sb; | 38 | struct cifs_sb_info *cifs_sb; |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 1c2c3ce5020b..63f644000ce5 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -234,7 +234,6 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) | |||
234 | struct cifs_sb_info *cifs_sb; | 234 | struct cifs_sb_info *cifs_sb; |
235 | struct cifsTconInfo *pTcon; | 235 | struct cifsTconInfo *pTcon; |
236 | char *full_path = NULL; | 236 | char *full_path = NULL; |
237 | char *tmp_path = NULL; | ||
238 | char *tmpbuffer; | 237 | char *tmpbuffer; |
239 | int len; | 238 | int len; |
240 | __u16 fid; | 239 | __u16 fid; |
@@ -295,45 +294,9 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) | |||
295 | cFYI(1, ("Error closing junction point " | 294 | cFYI(1, ("Error closing junction point " |
296 | "(open for ioctl)")); | 295 | "(open for ioctl)")); |
297 | } | 296 | } |
298 | /* BB unwind this long, nested function, or remove BB */ | 297 | /* If it is a DFS junction earlier we would have gotten |
299 | if (rc == -EIO) { | 298 | PATH_NOT_COVERED returned from server so we do |
300 | /* Query if DFS Junction */ | 299 | not need to request the DFS info here */ |
301 | unsigned int num_referrals = 0; | ||
302 | struct dfs_info3_param *refs = NULL; | ||
303 | tmp_path = | ||
304 | kmalloc(MAX_TREE_SIZE + MAX_PATHCONF + 1, | ||
305 | GFP_KERNEL); | ||
306 | if (tmp_path) { | ||
307 | strncpy(tmp_path, pTcon->treeName, | ||
308 | MAX_TREE_SIZE); | ||
309 | strncat(tmp_path, full_path, | ||
310 | MAX_PATHCONF); | ||
311 | rc = get_dfs_path(xid, pTcon->ses, | ||
312 | tmp_path, | ||
313 | cifs_sb->local_nls, | ||
314 | &num_referrals, &refs, | ||
315 | cifs_sb->mnt_cifs_flags & | ||
316 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
317 | cFYI(1, ("Get DFS for %s rc = %d ", | ||
318 | tmp_path, rc)); | ||
319 | if ((num_referrals == 0) && (rc == 0)) | ||
320 | rc = -EACCES; | ||
321 | else { | ||
322 | cFYI(1, ("num referral: %d", | ||
323 | num_referrals)); | ||
324 | if (refs && refs->path_name) { | ||
325 | strncpy(tmpbuffer, | ||
326 | refs->path_name, | ||
327 | len-1); | ||
328 | } | ||
329 | } | ||
330 | kfree(refs); | ||
331 | kfree(tmp_path); | ||
332 | } | ||
333 | /* BB add code like else decode referrals | ||
334 | then memcpy to tmpbuffer and free referrals | ||
335 | string array BB */ | ||
336 | } | ||
337 | } | 300 | } |
338 | } | 301 | } |
339 | /* BB Anything else to do to handle recursive links? */ | 302 | /* BB Anything else to do to handle recursive links? */ |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 00f4cff400b3..8703d68f5b20 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -141,11 +141,11 @@ cifs_inet_pton(const int address_family, const char *cp, void *dst) | |||
141 | int ret = 0; | 141 | int ret = 0; |
142 | 142 | ||
143 | /* calculate length by finding first slash or NULL */ | 143 | /* calculate length by finding first slash or NULL */ |
144 | if (address_family == AF_INET) { | 144 | if (address_family == AF_INET) |
145 | ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); | 145 | ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); |
146 | } else if (address_family == AF_INET6) { | 146 | else if (address_family == AF_INET6) |
147 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); | 147 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); |
148 | } | 148 | |
149 | cFYI(DBG2, ("address conversion returned %d for %s", ret, cp)); | 149 | cFYI(DBG2, ("address conversion returned %d for %s", ret, cp)); |
150 | if (ret > 0) | 150 | if (ret > 0) |
151 | ret = 1; | 151 | ret = 1; |
diff --git a/fs/cifs/ntlmssp.h b/fs/cifs/ntlmssp.h index 7170a9b70f1e..c377d8065d99 100644 --- a/fs/cifs/ntlmssp.h +++ b/fs/cifs/ntlmssp.h | |||
@@ -64,7 +64,7 @@ typedef struct _SECURITY_BUFFER { | |||
64 | } __attribute__((packed)) SECURITY_BUFFER; | 64 | } __attribute__((packed)) SECURITY_BUFFER; |
65 | 65 | ||
66 | typedef struct _NEGOTIATE_MESSAGE { | 66 | typedef struct _NEGOTIATE_MESSAGE { |
67 | __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; | 67 | __u8 Signature[sizeof(NTLMSSP_SIGNATURE)]; |
68 | __le32 MessageType; /* 1 */ | 68 | __le32 MessageType; /* 1 */ |
69 | __le32 NegotiateFlags; | 69 | __le32 NegotiateFlags; |
70 | SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */ | 70 | SECURITY_BUFFER DomainName; /* RFC 1001 style and ASCII */ |
@@ -74,7 +74,7 @@ typedef struct _NEGOTIATE_MESSAGE { | |||
74 | } __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; | 74 | } __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; |
75 | 75 | ||
76 | typedef struct _CHALLENGE_MESSAGE { | 76 | typedef struct _CHALLENGE_MESSAGE { |
77 | __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; | 77 | __u8 Signature[sizeof(NTLMSSP_SIGNATURE)]; |
78 | __le32 MessageType; /* 2 */ | 78 | __le32 MessageType; /* 2 */ |
79 | SECURITY_BUFFER TargetName; | 79 | SECURITY_BUFFER TargetName; |
80 | __le32 NegotiateFlags; | 80 | __le32 NegotiateFlags; |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 34ec32100c72..713c25110197 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -670,8 +670,11 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
670 | (index_to_find < first_entry_in_buffer)) { | 670 | (index_to_find < first_entry_in_buffer)) { |
671 | /* close and restart search */ | 671 | /* close and restart search */ |
672 | cFYI(1, ("search backing up - close and restart search")); | 672 | cFYI(1, ("search backing up - close and restart search")); |
673 | cifsFile->invalidHandle = true; | 673 | if (!cifsFile->srch_inf.endOfSearch && |
674 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 674 | !cifsFile->invalidHandle) { |
675 | cifsFile->invalidHandle = true; | ||
676 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | ||
677 | } | ||
675 | kfree(cifsFile->search_resume_name); | 678 | kfree(cifsFile->search_resume_name); |
676 | cifsFile->search_resume_name = NULL; | 679 | cifsFile->search_resume_name = NULL; |
677 | if (cifsFile->srch_inf.ntwrk_buf_start) { | 680 | if (cifsFile->srch_inf.ntwrk_buf_start) { |
diff --git a/fs/compat.c b/fs/compat.c index 332a869d2c53..ed43e17a5dc6 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1405,7 +1405,7 @@ int compat_do_execve(char * filename, | |||
1405 | /* execve success */ | 1405 | /* execve success */ |
1406 | security_bprm_free(bprm); | 1406 | security_bprm_free(bprm); |
1407 | acct_update_integrals(current); | 1407 | acct_update_integrals(current); |
1408 | kfree(bprm); | 1408 | free_bprm(bprm); |
1409 | return retval; | 1409 | return retval; |
1410 | } | 1410 | } |
1411 | 1411 | ||
@@ -1424,7 +1424,7 @@ out_file: | |||
1424 | } | 1424 | } |
1425 | 1425 | ||
1426 | out_kfree: | 1426 | out_kfree: |
1427 | kfree(bprm); | 1427 | free_bprm(bprm); |
1428 | 1428 | ||
1429 | out_ret: | 1429 | out_ret: |
1430 | return retval; | 1430 | return retval; |
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 7c1e5e5cccd8..637018c891ef 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/pagemap.h> | 50 | #include <linux/pagemap.h> |
51 | #include <linux/idr.h> | 51 | #include <linux/idr.h> |
52 | #include <linux/file.h> | 52 | #include <linux/file.h> |
53 | #include <linux/mutex.h> | ||
53 | #include <linux/sctp.h> | 54 | #include <linux/sctp.h> |
54 | #include <net/sctp/user.h> | 55 | #include <net/sctp/user.h> |
55 | 56 | ||
@@ -138,7 +139,7 @@ static struct workqueue_struct *recv_workqueue; | |||
138 | static struct workqueue_struct *send_workqueue; | 139 | static struct workqueue_struct *send_workqueue; |
139 | 140 | ||
140 | static DEFINE_IDR(connections_idr); | 141 | static DEFINE_IDR(connections_idr); |
141 | static DECLARE_MUTEX(connections_lock); | 142 | static DEFINE_MUTEX(connections_lock); |
142 | static int max_nodeid; | 143 | static int max_nodeid; |
143 | static struct kmem_cache *con_cache; | 144 | static struct kmem_cache *con_cache; |
144 | 145 | ||
@@ -205,9 +206,9 @@ static struct connection *nodeid2con(int nodeid, gfp_t allocation) | |||
205 | { | 206 | { |
206 | struct connection *con; | 207 | struct connection *con; |
207 | 208 | ||
208 | down(&connections_lock); | 209 | mutex_lock(&connections_lock); |
209 | con = __nodeid2con(nodeid, allocation); | 210 | con = __nodeid2con(nodeid, allocation); |
210 | up(&connections_lock); | 211 | mutex_unlock(&connections_lock); |
211 | 212 | ||
212 | return con; | 213 | return con; |
213 | } | 214 | } |
@@ -218,15 +219,15 @@ static struct connection *assoc2con(int assoc_id) | |||
218 | int i; | 219 | int i; |
219 | struct connection *con; | 220 | struct connection *con; |
220 | 221 | ||
221 | down(&connections_lock); | 222 | mutex_lock(&connections_lock); |
222 | for (i=0; i<=max_nodeid; i++) { | 223 | for (i=0; i<=max_nodeid; i++) { |
223 | con = __nodeid2con(i, 0); | 224 | con = __nodeid2con(i, 0); |
224 | if (con && con->sctp_assoc == assoc_id) { | 225 | if (con && con->sctp_assoc == assoc_id) { |
225 | up(&connections_lock); | 226 | mutex_unlock(&connections_lock); |
226 | return con; | 227 | return con; |
227 | } | 228 | } |
228 | } | 229 | } |
229 | up(&connections_lock); | 230 | mutex_unlock(&connections_lock); |
230 | return NULL; | 231 | return NULL; |
231 | } | 232 | } |
232 | 233 | ||
@@ -381,7 +382,7 @@ static void sctp_init_failed(void) | |||
381 | int i; | 382 | int i; |
382 | struct connection *con; | 383 | struct connection *con; |
383 | 384 | ||
384 | down(&connections_lock); | 385 | mutex_lock(&connections_lock); |
385 | for (i=1; i<=max_nodeid; i++) { | 386 | for (i=1; i<=max_nodeid; i++) { |
386 | con = __nodeid2con(i, 0); | 387 | con = __nodeid2con(i, 0); |
387 | if (!con) | 388 | if (!con) |
@@ -393,7 +394,7 @@ static void sctp_init_failed(void) | |||
393 | } | 394 | } |
394 | } | 395 | } |
395 | } | 396 | } |
396 | up(&connections_lock); | 397 | mutex_unlock(&connections_lock); |
397 | } | 398 | } |
398 | 399 | ||
399 | /* Something happened to an association */ | 400 | /* Something happened to an association */ |
@@ -930,7 +931,7 @@ out_err: | |||
930 | * errors we try again until the max number of retries is reached. | 931 | * errors we try again until the max number of retries is reached. |
931 | */ | 932 | */ |
932 | if (result != -EHOSTUNREACH && result != -ENETUNREACH && | 933 | if (result != -EHOSTUNREACH && result != -ENETUNREACH && |
933 | result != -ENETDOWN && result != EINVAL | 934 | result != -ENETDOWN && result != -EINVAL |
934 | && result != -EPROTONOSUPPORT) { | 935 | && result != -EPROTONOSUPPORT) { |
935 | lowcomms_connect_sock(con); | 936 | lowcomms_connect_sock(con); |
936 | result = 0; | 937 | result = 0; |
@@ -1417,7 +1418,7 @@ void dlm_lowcomms_stop(void) | |||
1417 | /* Set all the flags to prevent any | 1418 | /* Set all the flags to prevent any |
1418 | socket activity. | 1419 | socket activity. |
1419 | */ | 1420 | */ |
1420 | down(&connections_lock); | 1421 | mutex_lock(&connections_lock); |
1421 | for (i = 0; i <= max_nodeid; i++) { | 1422 | for (i = 0; i <= max_nodeid; i++) { |
1422 | con = __nodeid2con(i, 0); | 1423 | con = __nodeid2con(i, 0); |
1423 | if (con) { | 1424 | if (con) { |
@@ -1426,11 +1427,11 @@ void dlm_lowcomms_stop(void) | |||
1426 | con->sock->sk->sk_user_data = NULL; | 1427 | con->sock->sk->sk_user_data = NULL; |
1427 | } | 1428 | } |
1428 | } | 1429 | } |
1429 | up(&connections_lock); | 1430 | mutex_unlock(&connections_lock); |
1430 | 1431 | ||
1431 | work_stop(); | 1432 | work_stop(); |
1432 | 1433 | ||
1433 | down(&connections_lock); | 1434 | mutex_lock(&connections_lock); |
1434 | clean_writequeues(); | 1435 | clean_writequeues(); |
1435 | 1436 | ||
1436 | for (i = 0; i <= max_nodeid; i++) { | 1437 | for (i = 0; i <= max_nodeid; i++) { |
@@ -1443,7 +1444,7 @@ void dlm_lowcomms_stop(void) | |||
1443 | } | 1444 | } |
1444 | } | 1445 | } |
1445 | max_nodeid = 0; | 1446 | max_nodeid = 0; |
1446 | up(&connections_lock); | 1447 | mutex_unlock(&connections_lock); |
1447 | kmem_cache_destroy(con_cache); | 1448 | kmem_cache_destroy(con_cache); |
1448 | idr_init(&connections_idr); | 1449 | idr_init(&connections_idr); |
1449 | } | 1450 | } |
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c index 714593621f4f..18bda83cc892 100644 --- a/fs/dlm/netlink.c +++ b/fs/dlm/netlink.c | |||
@@ -95,7 +95,7 @@ int __init dlm_netlink_init(void) | |||
95 | return rv; | 95 | return rv; |
96 | } | 96 | } |
97 | 97 | ||
98 | void __exit dlm_netlink_exit(void) | 98 | void dlm_netlink_exit(void) |
99 | { | 99 | { |
100 | genl_unregister_ops(&family, &dlm_nl_ops); | 100 | genl_unregister_ops(&family, &dlm_nl_ops); |
101 | genl_unregister_family(&family); | 101 | genl_unregister_family(&family); |
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c index d6d6e370f89c..78878c5781ca 100644 --- a/fs/dlm/plock.c +++ b/fs/dlm/plock.c | |||
@@ -379,7 +379,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count, | |||
379 | struct plock_xop *xop; | 379 | struct plock_xop *xop; |
380 | xop = (struct plock_xop *)op; | 380 | xop = (struct plock_xop *)op; |
381 | if (xop->callback) | 381 | if (xop->callback) |
382 | count = dlm_plock_callback(op); | 382 | dlm_plock_callback(op); |
383 | else | 383 | else |
384 | wake_up(&recv_wq); | 384 | wake_up(&recv_wq); |
385 | } else | 385 | } else |
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c index 6560da1a58ce..50c994a249a5 100644 --- a/fs/ecryptfs/miscdev.c +++ b/fs/ecryptfs/miscdev.c | |||
@@ -243,7 +243,6 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count, | |||
243 | struct ecryptfs_daemon *daemon; | 243 | struct ecryptfs_daemon *daemon; |
244 | struct ecryptfs_msg_ctx *msg_ctx; | 244 | struct ecryptfs_msg_ctx *msg_ctx; |
245 | size_t packet_length_size; | 245 | size_t packet_length_size; |
246 | u32 counter_nbo; | ||
247 | char packet_length[3]; | 246 | char packet_length[3]; |
248 | size_t i; | 247 | size_t i; |
249 | size_t total_length; | 248 | size_t total_length; |
@@ -328,20 +327,18 @@ check_list: | |||
328 | "pending message\n", __func__, count, total_length); | 327 | "pending message\n", __func__, count, total_length); |
329 | goto out_unlock_msg_ctx; | 328 | goto out_unlock_msg_ctx; |
330 | } | 329 | } |
331 | i = 0; | 330 | rc = -EFAULT; |
332 | buf[i++] = msg_ctx->type; | 331 | if (put_user(msg_ctx->type, buf)) |
333 | counter_nbo = cpu_to_be32(msg_ctx->counter); | 332 | goto out_unlock_msg_ctx; |
334 | memcpy(&buf[i], (char *)&counter_nbo, 4); | 333 | if (put_user(cpu_to_be32(msg_ctx->counter), (__be32 __user *)(buf + 1))) |
335 | i += 4; | 334 | goto out_unlock_msg_ctx; |
335 | i = 5; | ||
336 | if (msg_ctx->msg) { | 336 | if (msg_ctx->msg) { |
337 | memcpy(&buf[i], packet_length, packet_length_size); | 337 | if (copy_to_user(&buf[i], packet_length, packet_length_size)) |
338 | goto out_unlock_msg_ctx; | ||
338 | i += packet_length_size; | 339 | i += packet_length_size; |
339 | rc = copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size); | 340 | if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size)) |
340 | if (rc) { | ||
341 | printk(KERN_ERR "%s: copy_to_user returned error " | ||
342 | "[%d]\n", __func__, rc); | ||
343 | goto out_unlock_msg_ctx; | 341 | goto out_unlock_msg_ctx; |
344 | } | ||
345 | i += msg_ctx->msg_size; | 342 | i += msg_ctx->msg_size; |
346 | } | 343 | } |
347 | rc = i; | 344 | rc = i; |
@@ -452,7 +449,8 @@ static ssize_t | |||
452 | ecryptfs_miscdev_write(struct file *file, const char __user *buf, | 449 | ecryptfs_miscdev_write(struct file *file, const char __user *buf, |
453 | size_t count, loff_t *ppos) | 450 | size_t count, loff_t *ppos) |
454 | { | 451 | { |
455 | u32 counter_nbo, seq; | 452 | __be32 counter_nbo; |
453 | u32 seq; | ||
456 | size_t packet_size, packet_size_length, i; | 454 | size_t packet_size, packet_size_length, i; |
457 | ssize_t sz = 0; | 455 | ssize_t sz = 0; |
458 | char *data; | 456 | char *data; |
@@ -485,7 +483,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf, | |||
485 | count); | 483 | count); |
486 | goto out_free; | 484 | goto out_free; |
487 | } | 485 | } |
488 | memcpy((char *)&counter_nbo, &data[i], 4); | 486 | memcpy(&counter_nbo, &data[i], 4); |
489 | seq = be32_to_cpu(counter_nbo); | 487 | seq = be32_to_cpu(counter_nbo); |
490 | i += 4; | 488 | i += 4; |
491 | rc = ecryptfs_parse_packet_length(&data[i], &packet_size, | 489 | rc = ecryptfs_parse_packet_length(&data[i], &packet_size, |
@@ -1251,6 +1251,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1251 | 1251 | ||
1252 | EXPORT_SYMBOL(search_binary_handler); | 1252 | EXPORT_SYMBOL(search_binary_handler); |
1253 | 1253 | ||
1254 | void free_bprm(struct linux_binprm *bprm) | ||
1255 | { | ||
1256 | free_arg_pages(bprm); | ||
1257 | kfree(bprm); | ||
1258 | } | ||
1259 | |||
1254 | /* | 1260 | /* |
1255 | * sys_execve() executes a new program. | 1261 | * sys_execve() executes a new program. |
1256 | */ | 1262 | */ |
@@ -1320,17 +1326,15 @@ int do_execve(char * filename, | |||
1320 | retval = search_binary_handler(bprm,regs); | 1326 | retval = search_binary_handler(bprm,regs); |
1321 | if (retval >= 0) { | 1327 | if (retval >= 0) { |
1322 | /* execve success */ | 1328 | /* execve success */ |
1323 | free_arg_pages(bprm); | ||
1324 | security_bprm_free(bprm); | 1329 | security_bprm_free(bprm); |
1325 | acct_update_integrals(current); | 1330 | acct_update_integrals(current); |
1326 | kfree(bprm); | 1331 | free_bprm(bprm); |
1327 | if (displaced) | 1332 | if (displaced) |
1328 | put_files_struct(displaced); | 1333 | put_files_struct(displaced); |
1329 | return retval; | 1334 | return retval; |
1330 | } | 1335 | } |
1331 | 1336 | ||
1332 | out: | 1337 | out: |
1333 | free_arg_pages(bprm); | ||
1334 | if (bprm->security) | 1338 | if (bprm->security) |
1335 | security_bprm_free(bprm); | 1339 | security_bprm_free(bprm); |
1336 | 1340 | ||
@@ -1344,7 +1348,7 @@ out_file: | |||
1344 | fput(bprm->file); | 1348 | fput(bprm->file); |
1345 | } | 1349 | } |
1346 | out_kfree: | 1350 | out_kfree: |
1347 | kfree(bprm); | 1351 | free_bprm(bprm); |
1348 | 1352 | ||
1349 | out_files: | 1353 | out_files: |
1350 | if (displaced) | 1354 | if (displaced) |
@@ -26,6 +26,8 @@ struct fdtable_defer { | |||
26 | }; | 26 | }; |
27 | 27 | ||
28 | int sysctl_nr_open __read_mostly = 1024*1024; | 28 | int sysctl_nr_open __read_mostly = 1024*1024; |
29 | int sysctl_nr_open_min = BITS_PER_LONG; | ||
30 | int sysctl_nr_open_max = 1024 * 1024; /* raised later */ | ||
29 | 31 | ||
30 | /* | 32 | /* |
31 | * We use this list to defer free fdtables that have vmalloced | 33 | * We use this list to defer free fdtables that have vmalloced |
@@ -119,8 +121,6 @@ static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt) | |||
119 | unsigned int cpy, set; | 121 | unsigned int cpy, set; |
120 | 122 | ||
121 | BUG_ON(nfdt->max_fds < ofdt->max_fds); | 123 | BUG_ON(nfdt->max_fds < ofdt->max_fds); |
122 | if (ofdt->max_fds == 0) | ||
123 | return; | ||
124 | 124 | ||
125 | cpy = ofdt->max_fds * sizeof(struct file *); | 125 | cpy = ofdt->max_fds * sizeof(struct file *); |
126 | set = (nfdt->max_fds - ofdt->max_fds) * sizeof(struct file *); | 126 | set = (nfdt->max_fds - ofdt->max_fds) * sizeof(struct file *); |
@@ -261,6 +261,139 @@ int expand_files(struct files_struct *files, int nr) | |||
261 | return expand_fdtable(files, nr); | 261 | return expand_fdtable(files, nr); |
262 | } | 262 | } |
263 | 263 | ||
264 | static int count_open_files(struct fdtable *fdt) | ||
265 | { | ||
266 | int size = fdt->max_fds; | ||
267 | int i; | ||
268 | |||
269 | /* Find the last open fd */ | ||
270 | for (i = size/(8*sizeof(long)); i > 0; ) { | ||
271 | if (fdt->open_fds->fds_bits[--i]) | ||
272 | break; | ||
273 | } | ||
274 | i = (i+1) * 8 * sizeof(long); | ||
275 | return i; | ||
276 | } | ||
277 | |||
278 | /* | ||
279 | * Allocate a new files structure and copy contents from the | ||
280 | * passed in files structure. | ||
281 | * errorp will be valid only when the returned files_struct is NULL. | ||
282 | */ | ||
283 | struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) | ||
284 | { | ||
285 | struct files_struct *newf; | ||
286 | struct file **old_fds, **new_fds; | ||
287 | int open_files, size, i; | ||
288 | struct fdtable *old_fdt, *new_fdt; | ||
289 | |||
290 | *errorp = -ENOMEM; | ||
291 | newf = kmem_cache_alloc(files_cachep, GFP_KERNEL); | ||
292 | if (!newf) | ||
293 | goto out; | ||
294 | |||
295 | atomic_set(&newf->count, 1); | ||
296 | |||
297 | spin_lock_init(&newf->file_lock); | ||
298 | newf->next_fd = 0; | ||
299 | new_fdt = &newf->fdtab; | ||
300 | new_fdt->max_fds = NR_OPEN_DEFAULT; | ||
301 | new_fdt->close_on_exec = (fd_set *)&newf->close_on_exec_init; | ||
302 | new_fdt->open_fds = (fd_set *)&newf->open_fds_init; | ||
303 | new_fdt->fd = &newf->fd_array[0]; | ||
304 | INIT_RCU_HEAD(&new_fdt->rcu); | ||
305 | new_fdt->next = NULL; | ||
306 | |||
307 | spin_lock(&oldf->file_lock); | ||
308 | old_fdt = files_fdtable(oldf); | ||
309 | open_files = count_open_files(old_fdt); | ||
310 | |||
311 | /* | ||
312 | * Check whether we need to allocate a larger fd array and fd set. | ||
313 | */ | ||
314 | while (unlikely(open_files > new_fdt->max_fds)) { | ||
315 | spin_unlock(&oldf->file_lock); | ||
316 | |||
317 | if (new_fdt != &newf->fdtab) { | ||
318 | free_fdarr(new_fdt); | ||
319 | free_fdset(new_fdt); | ||
320 | kfree(new_fdt); | ||
321 | } | ||
322 | |||
323 | new_fdt = alloc_fdtable(open_files - 1); | ||
324 | if (!new_fdt) { | ||
325 | *errorp = -ENOMEM; | ||
326 | goto out_release; | ||
327 | } | ||
328 | |||
329 | /* beyond sysctl_nr_open; nothing to do */ | ||
330 | if (unlikely(new_fdt->max_fds < open_files)) { | ||
331 | free_fdarr(new_fdt); | ||
332 | free_fdset(new_fdt); | ||
333 | kfree(new_fdt); | ||
334 | *errorp = -EMFILE; | ||
335 | goto out_release; | ||
336 | } | ||
337 | |||
338 | /* | ||
339 | * Reacquire the oldf lock and a pointer to its fd table | ||
340 | * who knows it may have a new bigger fd table. We need | ||
341 | * the latest pointer. | ||
342 | */ | ||
343 | spin_lock(&oldf->file_lock); | ||
344 | old_fdt = files_fdtable(oldf); | ||
345 | open_files = count_open_files(old_fdt); | ||
346 | } | ||
347 | |||
348 | old_fds = old_fdt->fd; | ||
349 | new_fds = new_fdt->fd; | ||
350 | |||
351 | memcpy(new_fdt->open_fds->fds_bits, | ||
352 | old_fdt->open_fds->fds_bits, open_files/8); | ||
353 | memcpy(new_fdt->close_on_exec->fds_bits, | ||
354 | old_fdt->close_on_exec->fds_bits, open_files/8); | ||
355 | |||
356 | for (i = open_files; i != 0; i--) { | ||
357 | struct file *f = *old_fds++; | ||
358 | if (f) { | ||
359 | get_file(f); | ||
360 | } else { | ||
361 | /* | ||
362 | * The fd may be claimed in the fd bitmap but not yet | ||
363 | * instantiated in the files array if a sibling thread | ||
364 | * is partway through open(). So make sure that this | ||
365 | * fd is available to the new process. | ||
366 | */ | ||
367 | FD_CLR(open_files - i, new_fdt->open_fds); | ||
368 | } | ||
369 | rcu_assign_pointer(*new_fds++, f); | ||
370 | } | ||
371 | spin_unlock(&oldf->file_lock); | ||
372 | |||
373 | /* compute the remainder to be cleared */ | ||
374 | size = (new_fdt->max_fds - open_files) * sizeof(struct file *); | ||
375 | |||
376 | /* This is long word aligned thus could use a optimized version */ | ||
377 | memset(new_fds, 0, size); | ||
378 | |||
379 | if (new_fdt->max_fds > open_files) { | ||
380 | int left = (new_fdt->max_fds-open_files)/8; | ||
381 | int start = open_files / (8 * sizeof(unsigned long)); | ||
382 | |||
383 | memset(&new_fdt->open_fds->fds_bits[start], 0, left); | ||
384 | memset(&new_fdt->close_on_exec->fds_bits[start], 0, left); | ||
385 | } | ||
386 | |||
387 | rcu_assign_pointer(newf->fdt, new_fdt); | ||
388 | |||
389 | return newf; | ||
390 | |||
391 | out_release: | ||
392 | kmem_cache_free(files_cachep, newf); | ||
393 | out: | ||
394 | return NULL; | ||
395 | } | ||
396 | |||
264 | static void __devinit fdtable_defer_list_init(int cpu) | 397 | static void __devinit fdtable_defer_list_init(int cpu) |
265 | { | 398 | { |
266 | struct fdtable_defer *fddef = &per_cpu(fdtable_defer_list, cpu); | 399 | struct fdtable_defer *fddef = &per_cpu(fdtable_defer_list, cpu); |
@@ -274,4 +407,19 @@ void __init files_defer_init(void) | |||
274 | int i; | 407 | int i; |
275 | for_each_possible_cpu(i) | 408 | for_each_possible_cpu(i) |
276 | fdtable_defer_list_init(i); | 409 | fdtable_defer_list_init(i); |
410 | sysctl_nr_open_max = min((size_t)INT_MAX, ~(size_t)0/sizeof(void *)) & | ||
411 | -BITS_PER_LONG; | ||
277 | } | 412 | } |
413 | |||
414 | struct files_struct init_files = { | ||
415 | .count = ATOMIC_INIT(1), | ||
416 | .fdt = &init_files.fdtab, | ||
417 | .fdtab = { | ||
418 | .max_fds = NR_OPEN_DEFAULT, | ||
419 | .fd = &init_files.fd_array[0], | ||
420 | .close_on_exec = (fd_set *)&init_files.close_on_exec_init, | ||
421 | .open_fds = (fd_set *)&init_files.open_fds_init, | ||
422 | .rcu = RCU_HEAD_INIT, | ||
423 | }, | ||
424 | .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), | ||
425 | }; | ||
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index d31badadef8f..07d84d16cda4 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -249,7 +249,7 @@ static int inode_go_lock(struct gfs2_holder *gh) | |||
249 | struct gfs2_inode *ip = gl->gl_object; | 249 | struct gfs2_inode *ip = gl->gl_object; |
250 | int error = 0; | 250 | int error = 0; |
251 | 251 | ||
252 | if (!ip) | 252 | if (!ip || (gh->gh_flags & GL_SKIP)) |
253 | return 0; | 253 | return 0; |
254 | 254 | ||
255 | if (test_bit(GIF_INVALID, &ip->i_flags)) { | 255 | if (test_bit(GIF_INVALID, &ip->i_flags)) { |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 9c2c0b90b22a..eabe5eac41da 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -236,6 +236,7 @@ enum { | |||
236 | GIF_INVALID = 0, | 236 | GIF_INVALID = 0, |
237 | GIF_QD_LOCKED = 1, | 237 | GIF_QD_LOCKED = 1, |
238 | GIF_SW_PAGED = 3, | 238 | GIF_SW_PAGED = 3, |
239 | GIF_USER = 4, /* user inode, not metadata addr space */ | ||
239 | }; | 240 | }; |
240 | 241 | ||
241 | struct gfs2_dinode_host { | 242 | struct gfs2_dinode_host { |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 3a9ef526c308..09453d057e41 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -47,8 +47,7 @@ static int iget_test(struct inode *inode, void *opaque) | |||
47 | struct gfs2_inode *ip = GFS2_I(inode); | 47 | struct gfs2_inode *ip = GFS2_I(inode); |
48 | u64 *no_addr = opaque; | 48 | u64 *no_addr = opaque; |
49 | 49 | ||
50 | if (ip->i_no_addr == *no_addr && | 50 | if (ip->i_no_addr == *no_addr && test_bit(GIF_USER, &ip->i_flags)) |
51 | inode->i_private != NULL) | ||
52 | return 1; | 51 | return 1; |
53 | 52 | ||
54 | return 0; | 53 | return 0; |
@@ -61,6 +60,7 @@ static int iget_set(struct inode *inode, void *opaque) | |||
61 | 60 | ||
62 | inode->i_ino = (unsigned long)*no_addr; | 61 | inode->i_ino = (unsigned long)*no_addr; |
63 | ip->i_no_addr = *no_addr; | 62 | ip->i_no_addr = *no_addr; |
63 | set_bit(GIF_USER, &ip->i_flags); | ||
64 | return 0; | 64 | return 0; |
65 | } | 65 | } |
66 | 66 | ||
@@ -86,7 +86,7 @@ static int iget_skip_test(struct inode *inode, void *opaque) | |||
86 | struct gfs2_inode *ip = GFS2_I(inode); | 86 | struct gfs2_inode *ip = GFS2_I(inode); |
87 | struct gfs2_skip_data *data = opaque; | 87 | struct gfs2_skip_data *data = opaque; |
88 | 88 | ||
89 | if (ip->i_no_addr == data->no_addr && inode->i_private != NULL){ | 89 | if (ip->i_no_addr == data->no_addr && test_bit(GIF_USER, &ip->i_flags)){ |
90 | if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)){ | 90 | if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)){ |
91 | data->skipped = 1; | 91 | data->skipped = 1; |
92 | return 0; | 92 | return 0; |
@@ -105,6 +105,7 @@ static int iget_skip_set(struct inode *inode, void *opaque) | |||
105 | return 1; | 105 | return 1; |
106 | inode->i_ino = (unsigned long)(data->no_addr); | 106 | inode->i_ino = (unsigned long)(data->no_addr); |
107 | ip->i_no_addr = data->no_addr; | 107 | ip->i_no_addr = data->no_addr; |
108 | set_bit(GIF_USER, &ip->i_flags); | ||
108 | return 0; | 109 | return 0; |
109 | } | 110 | } |
110 | 111 | ||
@@ -166,7 +167,7 @@ void gfs2_set_iop(struct inode *inode) | |||
166 | * Returns: A VFS inode, or an error | 167 | * Returns: A VFS inode, or an error |
167 | */ | 168 | */ |
168 | 169 | ||
169 | struct inode *gfs2_inode_lookup(struct super_block *sb, | 170 | struct inode *gfs2_inode_lookup(struct super_block *sb, |
170 | unsigned int type, | 171 | unsigned int type, |
171 | u64 no_addr, | 172 | u64 no_addr, |
172 | u64 no_formal_ino, int skip_freeing) | 173 | u64 no_formal_ino, int skip_freeing) |
@@ -187,7 +188,6 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, | |||
187 | 188 | ||
188 | if (inode->i_state & I_NEW) { | 189 | if (inode->i_state & I_NEW) { |
189 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 190 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
190 | inode->i_private = ip; | ||
191 | ip->i_no_formal_ino = no_formal_ino; | 191 | ip->i_no_formal_ino = no_formal_ino; |
192 | 192 | ||
193 | error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl); | 193 | error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl); |
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 85aea27b4a86..78d75f892f82 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This copyrighted material is made available to anyone wishing to use, | 5 | * This copyrighted material is made available to anyone wishing to use, |
6 | * modify, copy, or redistribute it subject to the terms and conditions | 6 | * modify, copy, or redistribute it subject to the terms and conditions |
@@ -69,13 +69,15 @@ static const struct address_space_operations aspace_aops = { | |||
69 | struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) | 69 | struct inode *gfs2_aspace_get(struct gfs2_sbd *sdp) |
70 | { | 70 | { |
71 | struct inode *aspace; | 71 | struct inode *aspace; |
72 | struct gfs2_inode *ip; | ||
72 | 73 | ||
73 | aspace = new_inode(sdp->sd_vfs); | 74 | aspace = new_inode(sdp->sd_vfs); |
74 | if (aspace) { | 75 | if (aspace) { |
75 | mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); | 76 | mapping_set_gfp_mask(aspace->i_mapping, GFP_NOFS); |
76 | aspace->i_mapping->a_ops = &aspace_aops; | 77 | aspace->i_mapping->a_ops = &aspace_aops; |
77 | aspace->i_size = ~0ULL; | 78 | aspace->i_size = ~0ULL; |
78 | aspace->i_private = NULL; | 79 | ip = GFS2_I(aspace); |
80 | clear_bit(GIF_USER, &ip->i_flags); | ||
79 | insert_inode_hash(aspace); | 81 | insert_inode_hash(aspace); |
80 | } | 82 | } |
81 | return aspace; | 83 | return aspace; |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index ef9c6c4f80f6..b2028c82e8d1 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -142,8 +142,8 @@ static int init_names(struct gfs2_sbd *sdp, int silent) | |||
142 | if (!table[0]) | 142 | if (!table[0]) |
143 | table = sdp->sd_vfs->s_id; | 143 | table = sdp->sd_vfs->s_id; |
144 | 144 | ||
145 | snprintf(sdp->sd_proto_name, GFS2_FSNAME_LEN, "%s", proto); | 145 | strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN); |
146 | snprintf(sdp->sd_table_name, GFS2_FSNAME_LEN, "%s", table); | 146 | strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN); |
147 | 147 | ||
148 | table = sdp->sd_table_name; | 148 | table = sdp->sd_table_name; |
149 | while ((table = strchr(table, '/'))) | 149 | while ((table = strchr(table, '/'))) |
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c index 2278c68b7e35..0b7cc920eb89 100644 --- a/fs/gfs2/ops_super.c +++ b/fs/gfs2/ops_super.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This copyrighted material is made available to anyone wishing to use, | 5 | * This copyrighted material is made available to anyone wishing to use, |
6 | * modify, copy, or redistribute it subject to the terms and conditions | 6 | * modify, copy, or redistribute it subject to the terms and conditions |
@@ -52,7 +52,7 @@ static int gfs2_write_inode(struct inode *inode, int sync) | |||
52 | struct gfs2_inode *ip = GFS2_I(inode); | 52 | struct gfs2_inode *ip = GFS2_I(inode); |
53 | 53 | ||
54 | /* Check this is a "normal" inode */ | 54 | /* Check this is a "normal" inode */ |
55 | if (inode->i_private) { | 55 | if (test_bit(GIF_USER, &ip->i_flags)) { |
56 | if (current->flags & PF_MEMALLOC) | 56 | if (current->flags & PF_MEMALLOC) |
57 | return 0; | 57 | return 0; |
58 | if (sync) | 58 | if (sync) |
@@ -297,8 +297,9 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data) | |||
297 | */ | 297 | */ |
298 | static void gfs2_drop_inode(struct inode *inode) | 298 | static void gfs2_drop_inode(struct inode *inode) |
299 | { | 299 | { |
300 | if (inode->i_private && inode->i_nlink) { | 300 | struct gfs2_inode *ip = GFS2_I(inode); |
301 | struct gfs2_inode *ip = GFS2_I(inode); | 301 | |
302 | if (test_bit(GIF_USER, &ip->i_flags) && inode->i_nlink) { | ||
302 | struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; | 303 | struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl; |
303 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) | 304 | if (gl && test_bit(GLF_DEMOTE, &gl->gl_flags)) |
304 | clear_nlink(inode); | 305 | clear_nlink(inode); |
@@ -314,12 +315,13 @@ static void gfs2_drop_inode(struct inode *inode) | |||
314 | 315 | ||
315 | static void gfs2_clear_inode(struct inode *inode) | 316 | static void gfs2_clear_inode(struct inode *inode) |
316 | { | 317 | { |
318 | struct gfs2_inode *ip = GFS2_I(inode); | ||
319 | |||
317 | /* This tells us its a "real" inode and not one which only | 320 | /* This tells us its a "real" inode and not one which only |
318 | * serves to contain an address space (see rgrp.c, meta_io.c) | 321 | * serves to contain an address space (see rgrp.c, meta_io.c) |
319 | * which therefore doesn't have its own glocks. | 322 | * which therefore doesn't have its own glocks. |
320 | */ | 323 | */ |
321 | if (inode->i_private) { | 324 | if (test_bit(GIF_USER, &ip->i_flags)) { |
322 | struct gfs2_inode *ip = GFS2_I(inode); | ||
323 | ip->i_gl->gl_object = NULL; | 325 | ip->i_gl->gl_object = NULL; |
324 | gfs2_glock_schedule_for_reclaim(ip->i_gl); | 326 | gfs2_glock_schedule_for_reclaim(ip->i_gl); |
325 | gfs2_glock_put(ip->i_gl); | 327 | gfs2_glock_put(ip->i_gl); |
@@ -419,7 +421,7 @@ static void gfs2_delete_inode(struct inode *inode) | |||
419 | struct gfs2_holder gh; | 421 | struct gfs2_holder gh; |
420 | int error; | 422 | int error; |
421 | 423 | ||
422 | if (!inode->i_private) | 424 | if (!test_bit(GIF_USER, &ip->i_flags)) |
423 | goto out; | 425 | goto out; |
424 | 426 | ||
425 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 427 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 7e8f0b1d6c6e..6387523a3153 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1495,7 +1495,7 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n) | |||
1495 | 1495 | ||
1496 | al->al_alloced += *n; | 1496 | al->al_alloced += *n; |
1497 | 1497 | ||
1498 | gfs2_statfs_change(sdp, 0, -*n, 0); | 1498 | gfs2_statfs_change(sdp, 0, -(s64)*n, 0); |
1499 | gfs2_quota_change(ip, *n, ip->i_inode.i_uid, ip->i_inode.i_gid); | 1499 | gfs2_quota_change(ip, *n, ip->i_inode.i_uid, ip->i_inode.i_gid); |
1500 | 1500 | ||
1501 | spin_lock(&sdp->sd_rindex_spin); | 1501 | spin_lock(&sdp->sd_rindex_spin); |
diff --git a/fs/hppfs/Makefile b/fs/hppfs/Makefile index 8a1f50344368..3a982bd975d2 100644 --- a/fs/hppfs/Makefile +++ b/fs/hppfs/Makefile | |||
@@ -3,7 +3,4 @@ | |||
3 | # Licensed under the GPL | 3 | # Licensed under the GPL |
4 | # | 4 | # |
5 | 5 | ||
6 | hppfs-objs := hppfs.o | 6 | obj-$(CONFIG_HPPFS) += hppfs.o |
7 | |||
8 | obj-y = | ||
9 | obj-$(CONFIG_HPPFS) += $(hppfs-objs) | ||
diff --git a/fs/namei.c b/fs/namei.c index 32fd9655485b..c7e43536c49a 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2003,18 +2003,22 @@ struct dentry *lookup_create(struct nameidata *nd, int is_dir) | |||
2003 | if (IS_ERR(dentry)) | 2003 | if (IS_ERR(dentry)) |
2004 | goto fail; | 2004 | goto fail; |
2005 | 2005 | ||
2006 | if (dentry->d_inode) | ||
2007 | goto eexist; | ||
2006 | /* | 2008 | /* |
2007 | * Special case - lookup gave negative, but... we had foo/bar/ | 2009 | * Special case - lookup gave negative, but... we had foo/bar/ |
2008 | * From the vfs_mknod() POV we just have a negative dentry - | 2010 | * From the vfs_mknod() POV we just have a negative dentry - |
2009 | * all is fine. Let's be bastards - you had / on the end, you've | 2011 | * all is fine. Let's be bastards - you had / on the end, you've |
2010 | * been asking for (non-existent) directory. -ENOENT for you. | 2012 | * been asking for (non-existent) directory. -ENOENT for you. |
2011 | */ | 2013 | */ |
2012 | if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode) | 2014 | if (unlikely(!is_dir && nd->last.name[nd->last.len])) { |
2013 | goto enoent; | 2015 | dput(dentry); |
2016 | dentry = ERR_PTR(-ENOENT); | ||
2017 | } | ||
2014 | return dentry; | 2018 | return dentry; |
2015 | enoent: | 2019 | eexist: |
2016 | dput(dentry); | 2020 | dput(dentry); |
2017 | dentry = ERR_PTR(-ENOENT); | 2021 | dentry = ERR_PTR(-EEXIST); |
2018 | fail: | 2022 | fail: |
2019 | return dentry; | 2023 | return dentry; |
2020 | } | 2024 | } |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 5606ae3d72d3..c1e7c8300629 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -182,7 +182,7 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp) | |||
182 | if (clp == NULL) | 182 | if (clp == NULL) |
183 | return SVC_DROP; | 183 | return SVC_DROP; |
184 | 184 | ||
185 | dprintk("%s: %s NFSv4 callback!\n", __FUNCTION__, | 185 | dprintk("%s: %s NFSv4 callback!\n", __func__, |
186 | svc_print_addr(rqstp, buf, sizeof(buf))); | 186 | svc_print_addr(rqstp, buf, sizeof(buf))); |
187 | nfs_put_client(clp); | 187 | nfs_put_client(clp); |
188 | 188 | ||
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 15f7785048d3..f7e83e23cf9f 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -57,7 +57,7 @@ out_iput: | |||
57 | out_putclient: | 57 | out_putclient: |
58 | nfs_put_client(clp); | 58 | nfs_put_client(clp); |
59 | out: | 59 | out: |
60 | dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(res->status)); | 60 | dprintk("%s: exit with status = %d\n", __func__, ntohl(res->status)); |
61 | return res->status; | 61 | return res->status; |
62 | } | 62 | } |
63 | 63 | ||
@@ -98,6 +98,6 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy) | |||
98 | nfs_put_client(prev); | 98 | nfs_put_client(prev); |
99 | } while (clp != NULL); | 99 | } while (clp != NULL); |
100 | out: | 100 | out: |
101 | dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(res)); | 101 | dprintk("%s: exit with status = %d\n", __func__, ntohl(res)); |
102 | return res; | 102 | return res; |
103 | } | 103 | } |
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index 13619d24f023..dd0ef34b5845 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -141,7 +141,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound | |||
141 | /* We do not like overly long tags! */ | 141 | /* We do not like overly long tags! */ |
142 | if (hdr->taglen > CB_OP_TAGLEN_MAXSZ - 12) { | 142 | if (hdr->taglen > CB_OP_TAGLEN_MAXSZ - 12) { |
143 | printk("NFSv4 CALLBACK %s: client sent tag of length %u\n", | 143 | printk("NFSv4 CALLBACK %s: client sent tag of length %u\n", |
144 | __FUNCTION__, hdr->taglen); | 144 | __func__, hdr->taglen); |
145 | return htonl(NFS4ERR_RESOURCE); | 145 | return htonl(NFS4ERR_RESOURCE); |
146 | } | 146 | } |
147 | p = read_buf(xdr, 12); | 147 | p = read_buf(xdr, 12); |
@@ -151,7 +151,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound | |||
151 | /* Check minor version is zero. */ | 151 | /* Check minor version is zero. */ |
152 | if (minor_version != 0) { | 152 | if (minor_version != 0) { |
153 | printk(KERN_WARNING "%s: NFSv4 server callback with illegal minor version %u!\n", | 153 | printk(KERN_WARNING "%s: NFSv4 server callback with illegal minor version %u!\n", |
154 | __FUNCTION__, minor_version); | 154 | __func__, minor_version); |
155 | return htonl(NFS4ERR_MINOR_VERS_MISMATCH); | 155 | return htonl(NFS4ERR_MINOR_VERS_MISMATCH); |
156 | } | 156 | } |
157 | hdr->callback_ident = ntohl(*p++); | 157 | hdr->callback_ident = ntohl(*p++); |
@@ -179,7 +179,7 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr | |||
179 | args->addr = svc_addr(rqstp); | 179 | args->addr = svc_addr(rqstp); |
180 | status = decode_bitmap(xdr, args->bitmap); | 180 | status = decode_bitmap(xdr, args->bitmap); |
181 | out: | 181 | out: |
182 | dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); | 182 | dprintk("%s: exit with status = %d\n", __func__, ntohl(status)); |
183 | return status; | 183 | return status; |
184 | } | 184 | } |
185 | 185 | ||
@@ -200,7 +200,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, | |||
200 | args->truncate = ntohl(*p); | 200 | args->truncate = ntohl(*p); |
201 | status = decode_fh(xdr, &args->fh); | 201 | status = decode_fh(xdr, &args->fh); |
202 | out: | 202 | out: |
203 | dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); | 203 | dprintk("%s: exit with status = %d\n", __func__, ntohl(status)); |
204 | return status; | 204 | return status; |
205 | } | 205 | } |
206 | 206 | ||
@@ -349,7 +349,7 @@ static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, | |||
349 | status = encode_attr_mtime(xdr, res->bitmap, &res->mtime); | 349 | status = encode_attr_mtime(xdr, res->bitmap, &res->mtime); |
350 | *savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1))); | 350 | *savep = htonl((unsigned int)((char *)xdr->p - (char *)(savep+1))); |
351 | out: | 351 | out: |
352 | dprintk("%s: exit with status = %d\n", __FUNCTION__, ntohl(status)); | 352 | dprintk("%s: exit with status = %d\n", __func__, ntohl(status)); |
353 | return status; | 353 | return status; |
354 | } | 354 | } |
355 | 355 | ||
@@ -363,7 +363,7 @@ static __be32 process_op(struct svc_rqst *rqstp, | |||
363 | long maxlen; | 363 | long maxlen; |
364 | __be32 res; | 364 | __be32 res; |
365 | 365 | ||
366 | dprintk("%s: start\n", __FUNCTION__); | 366 | dprintk("%s: start\n", __func__); |
367 | status = decode_op_hdr(xdr_in, &op_nr); | 367 | status = decode_op_hdr(xdr_in, &op_nr); |
368 | if (likely(status == 0)) { | 368 | if (likely(status == 0)) { |
369 | switch (op_nr) { | 369 | switch (op_nr) { |
@@ -392,7 +392,7 @@ static __be32 process_op(struct svc_rqst *rqstp, | |||
392 | status = res; | 392 | status = res; |
393 | if (op->encode_res != NULL && status == 0) | 393 | if (op->encode_res != NULL && status == 0) |
394 | status = op->encode_res(rqstp, xdr_out, resp); | 394 | status = op->encode_res(rqstp, xdr_out, resp); |
395 | dprintk("%s: done, status = %d\n", __FUNCTION__, ntohl(status)); | 395 | dprintk("%s: done, status = %d\n", __func__, ntohl(status)); |
396 | return status; | 396 | return status; |
397 | } | 397 | } |
398 | 398 | ||
@@ -401,37 +401,37 @@ static __be32 process_op(struct svc_rqst *rqstp, | |||
401 | */ | 401 | */ |
402 | static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) | 402 | static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) |
403 | { | 403 | { |
404 | struct cb_compound_hdr_arg hdr_arg; | 404 | struct cb_compound_hdr_arg hdr_arg = { 0 }; |
405 | struct cb_compound_hdr_res hdr_res; | 405 | struct cb_compound_hdr_res hdr_res = { NULL }; |
406 | struct xdr_stream xdr_in, xdr_out; | 406 | struct xdr_stream xdr_in, xdr_out; |
407 | __be32 *p; | 407 | __be32 *p; |
408 | __be32 status; | 408 | __be32 status; |
409 | unsigned int nops = 1; | 409 | unsigned int nops = 0; |
410 | 410 | ||
411 | dprintk("%s: start\n", __FUNCTION__); | 411 | dprintk("%s: start\n", __func__); |
412 | 412 | ||
413 | xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); | 413 | xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); |
414 | 414 | ||
415 | p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); | 415 | p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); |
416 | xdr_init_encode(&xdr_out, &rqstp->rq_res, p); | 416 | xdr_init_encode(&xdr_out, &rqstp->rq_res, p); |
417 | 417 | ||
418 | decode_compound_hdr_arg(&xdr_in, &hdr_arg); | 418 | status = decode_compound_hdr_arg(&xdr_in, &hdr_arg); |
419 | if (status == __constant_htonl(NFS4ERR_RESOURCE)) | ||
420 | return rpc_garbage_args; | ||
421 | |||
419 | hdr_res.taglen = hdr_arg.taglen; | 422 | hdr_res.taglen = hdr_arg.taglen; |
420 | hdr_res.tag = hdr_arg.tag; | 423 | hdr_res.tag = hdr_arg.tag; |
421 | hdr_res.nops = NULL; | 424 | if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0) |
422 | encode_compound_hdr_res(&xdr_out, &hdr_res); | 425 | return rpc_system_err; |
423 | 426 | ||
424 | for (;;) { | 427 | while (status == 0 && nops != hdr_arg.nops) { |
425 | status = process_op(rqstp, &xdr_in, argp, &xdr_out, resp); | 428 | status = process_op(rqstp, &xdr_in, argp, &xdr_out, resp); |
426 | if (status != 0) | ||
427 | break; | ||
428 | if (nops == hdr_arg.nops) | ||
429 | break; | ||
430 | nops++; | 429 | nops++; |
431 | } | 430 | } |
431 | |||
432 | *hdr_res.status = status; | 432 | *hdr_res.status = status; |
433 | *hdr_res.nops = htonl(nops); | 433 | *hdr_res.nops = htonl(nops); |
434 | dprintk("%s: done, status = %u\n", __FUNCTION__, ntohl(status)); | 434 | dprintk("%s: done, status = %u\n", __func__, ntohl(status)); |
435 | return rpc_success; | 435 | return rpc_success; |
436 | } | 436 | } |
437 | 437 | ||
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 89ac5bb0401c..f2a092ca69b5 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -488,7 +488,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp, | |||
488 | clnt = rpc_create(&args); | 488 | clnt = rpc_create(&args); |
489 | if (IS_ERR(clnt)) { | 489 | if (IS_ERR(clnt)) { |
490 | dprintk("%s: cannot create RPC client. Error = %ld\n", | 490 | dprintk("%s: cannot create RPC client. Error = %ld\n", |
491 | __FUNCTION__, PTR_ERR(clnt)); | 491 | __func__, PTR_ERR(clnt)); |
492 | return PTR_ERR(clnt); | 492 | return PTR_ERR(clnt); |
493 | } | 493 | } |
494 | 494 | ||
@@ -576,7 +576,7 @@ static int nfs_init_server_rpcclient(struct nfs_server *server, | |||
576 | 576 | ||
577 | server->client = rpc_clone_client(clp->cl_rpcclient); | 577 | server->client = rpc_clone_client(clp->cl_rpcclient); |
578 | if (IS_ERR(server->client)) { | 578 | if (IS_ERR(server->client)) { |
579 | dprintk("%s: couldn't create rpc_client!\n", __FUNCTION__); | 579 | dprintk("%s: couldn't create rpc_client!\n", __func__); |
580 | return PTR_ERR(server->client); | 580 | return PTR_ERR(server->client); |
581 | } | 581 | } |
582 | 582 | ||
@@ -590,7 +590,7 @@ static int nfs_init_server_rpcclient(struct nfs_server *server, | |||
590 | 590 | ||
591 | auth = rpcauth_create(pseudoflavour, server->client); | 591 | auth = rpcauth_create(pseudoflavour, server->client); |
592 | if (IS_ERR(auth)) { | 592 | if (IS_ERR(auth)) { |
593 | dprintk("%s: couldn't create credcache!\n", __FUNCTION__); | 593 | dprintk("%s: couldn't create credcache!\n", __func__); |
594 | return PTR_ERR(auth); | 594 | return PTR_ERR(auth); |
595 | } | 595 | } |
596 | } | 596 | } |
@@ -985,7 +985,7 @@ static int nfs4_init_client(struct nfs_client *clp, | |||
985 | error = nfs_idmap_new(clp); | 985 | error = nfs_idmap_new(clp); |
986 | if (error < 0) { | 986 | if (error < 0) { |
987 | dprintk("%s: failed to create idmapper. Error = %d\n", | 987 | dprintk("%s: failed to create idmapper. Error = %d\n", |
988 | __FUNCTION__, error); | 988 | __func__, error); |
989 | goto error; | 989 | goto error; |
990 | } | 990 | } |
991 | __set_bit(NFS_CS_IDMAP, &clp->cl_res_state); | 991 | __set_bit(NFS_CS_IDMAP, &clp->cl_res_state); |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 00a5e4405e16..cc563cfa6940 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -60,7 +60,7 @@ static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_ | |||
60 | switch (status) { | 60 | switch (status) { |
61 | default: | 61 | default: |
62 | printk(KERN_ERR "%s: unhandled error %d.\n", | 62 | printk(KERN_ERR "%s: unhandled error %d.\n", |
63 | __FUNCTION__, status); | 63 | __func__, status); |
64 | case -NFS4ERR_EXPIRED: | 64 | case -NFS4ERR_EXPIRED: |
65 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ | 65 | /* kill_proc(fl->fl_pid, SIGLOST, 1); */ |
66 | case -NFS4ERR_STALE_CLIENTID: | 66 | case -NFS4ERR_STALE_CLIENTID: |
@@ -186,7 +186,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct | |||
186 | */ | 186 | */ |
187 | dfprintk(FILE, "%s: server %s handed out " | 187 | dfprintk(FILE, "%s: server %s handed out " |
188 | "a duplicate delegation!\n", | 188 | "a duplicate delegation!\n", |
189 | __FUNCTION__, clp->cl_hostname); | 189 | __func__, clp->cl_hostname); |
190 | if (delegation->type <= nfsi->delegation->type) { | 190 | if (delegation->type <= nfsi->delegation->type) { |
191 | freeme = delegation; | 191 | freeme = delegation; |
192 | delegation = NULL; | 192 | delegation = NULL; |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index f288b3ecab4a..58d43daec084 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -180,7 +180,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) | |||
180 | int error; | 180 | int error; |
181 | 181 | ||
182 | dfprintk(DIRCACHE, "NFS: %s: reading cookie %Lu into page %lu\n", | 182 | dfprintk(DIRCACHE, "NFS: %s: reading cookie %Lu into page %lu\n", |
183 | __FUNCTION__, (long long)desc->entry->cookie, | 183 | __func__, (long long)desc->entry->cookie, |
184 | page->index); | 184 | page->index); |
185 | 185 | ||
186 | again: | 186 | again: |
@@ -256,7 +256,7 @@ int find_dirent(nfs_readdir_descriptor_t *desc) | |||
256 | 256 | ||
257 | while((status = dir_decode(desc)) == 0) { | 257 | while((status = dir_decode(desc)) == 0) { |
258 | dfprintk(DIRCACHE, "NFS: %s: examining cookie %Lu\n", | 258 | dfprintk(DIRCACHE, "NFS: %s: examining cookie %Lu\n", |
259 | __FUNCTION__, (unsigned long long)entry->cookie); | 259 | __func__, (unsigned long long)entry->cookie); |
260 | if (entry->prev_cookie == *desc->dir_cookie) | 260 | if (entry->prev_cookie == *desc->dir_cookie) |
261 | break; | 261 | break; |
262 | if (loop_count++ > 200) { | 262 | if (loop_count++ > 200) { |
@@ -315,7 +315,7 @@ int find_dirent_page(nfs_readdir_descriptor_t *desc) | |||
315 | int status; | 315 | int status; |
316 | 316 | ||
317 | dfprintk(DIRCACHE, "NFS: %s: searching page %ld for target %Lu\n", | 317 | dfprintk(DIRCACHE, "NFS: %s: searching page %ld for target %Lu\n", |
318 | __FUNCTION__, desc->page_index, | 318 | __func__, desc->page_index, |
319 | (long long) *desc->dir_cookie); | 319 | (long long) *desc->dir_cookie); |
320 | 320 | ||
321 | /* If we find the page in the page_cache, we cannot be sure | 321 | /* If we find the page in the page_cache, we cannot be sure |
@@ -339,7 +339,7 @@ int find_dirent_page(nfs_readdir_descriptor_t *desc) | |||
339 | if (status < 0) | 339 | if (status < 0) |
340 | dir_page_release(desc); | 340 | dir_page_release(desc); |
341 | out: | 341 | out: |
342 | dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __FUNCTION__, status); | 342 | dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __func__, status); |
343 | return status; | 343 | return status; |
344 | } | 344 | } |
345 | 345 | ||
@@ -380,7 +380,7 @@ int readdir_search_pagecache(nfs_readdir_descriptor_t *desc) | |||
380 | } | 380 | } |
381 | } | 381 | } |
382 | 382 | ||
383 | dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __FUNCTION__, res); | 383 | dfprintk(DIRCACHE, "NFS: %s: returns %d\n", __func__, res); |
384 | return res; | 384 | return res; |
385 | } | 385 | } |
386 | 386 | ||
@@ -506,7 +506,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
506 | desc->entry->eof = 0; | 506 | desc->entry->eof = 0; |
507 | out: | 507 | out: |
508 | dfprintk(DIRCACHE, "NFS: %s: returns %d\n", | 508 | dfprintk(DIRCACHE, "NFS: %s: returns %d\n", |
509 | __FUNCTION__, status); | 509 | __func__, status); |
510 | return status; | 510 | return status; |
511 | out_release: | 511 | out_release: |
512 | dir_page_release(desc); | 512 | dir_page_release(desc); |
@@ -780,7 +780,7 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd) | |||
780 | 780 | ||
781 | if (is_bad_inode(inode)) { | 781 | if (is_bad_inode(inode)) { |
782 | dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n", | 782 | dfprintk(LOOKUPCACHE, "%s: %s/%s has dud inode\n", |
783 | __FUNCTION__, dentry->d_parent->d_name.name, | 783 | __func__, dentry->d_parent->d_name.name, |
784 | dentry->d_name.name); | 784 | dentry->d_name.name); |
785 | goto out_bad; | 785 | goto out_bad; |
786 | } | 786 | } |
@@ -808,7 +808,7 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd) | |||
808 | unlock_kernel(); | 808 | unlock_kernel(); |
809 | dput(parent); | 809 | dput(parent); |
810 | dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n", | 810 | dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is valid\n", |
811 | __FUNCTION__, dentry->d_parent->d_name.name, | 811 | __func__, dentry->d_parent->d_name.name, |
812 | dentry->d_name.name); | 812 | dentry->d_name.name); |
813 | return 1; | 813 | return 1; |
814 | out_zap_parent: | 814 | out_zap_parent: |
@@ -827,7 +827,7 @@ out_zap_parent: | |||
827 | unlock_kernel(); | 827 | unlock_kernel(); |
828 | dput(parent); | 828 | dput(parent); |
829 | dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is invalid\n", | 829 | dfprintk(LOOKUPCACHE, "NFS: %s(%s/%s) is invalid\n", |
830 | __FUNCTION__, dentry->d_parent->d_name.name, | 830 | __func__, dentry->d_parent->d_name.name, |
831 | dentry->d_name.name); | 831 | dentry->d_name.name); |
832 | return 0; | 832 | return 0; |
833 | } | 833 | } |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 3536b01164f9..d84a3d8f32af 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -526,7 +526,7 @@ static int do_vfs_lock(struct file *file, struct file_lock *fl) | |||
526 | if (res < 0) | 526 | if (res < 0) |
527 | dprintk(KERN_WARNING "%s: VFS is out of sync with lock manager" | 527 | dprintk(KERN_WARNING "%s: VFS is out of sync with lock manager" |
528 | " - error %d!\n", | 528 | " - error %d!\n", |
529 | __FUNCTION__, res); | 529 | __func__, res); |
530 | return res; | 530 | return res; |
531 | } | 531 | } |
532 | 532 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 5cb3345eb694..596c5d8e86f4 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -541,8 +541,7 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait) | |||
541 | } | 541 | } |
542 | if (ctx->cred != NULL) | 542 | if (ctx->cred != NULL) |
543 | put_rpccred(ctx->cred); | 543 | put_rpccred(ctx->cred); |
544 | dput(ctx->path.dentry); | 544 | path_put(&ctx->path); |
545 | mntput(ctx->path.mnt); | ||
546 | kfree(ctx); | 545 | kfree(ctx); |
547 | } | 546 | } |
548 | 547 | ||
@@ -707,6 +706,13 @@ int nfs_attribute_timeout(struct inode *inode) | |||
707 | 706 | ||
708 | if (nfs_have_delegation(inode, FMODE_READ)) | 707 | if (nfs_have_delegation(inode, FMODE_READ)) |
709 | return 0; | 708 | return 0; |
709 | /* | ||
710 | * Special case: if the attribute timeout is set to 0, then always | ||
711 | * treat the cache as having expired (unless holding | ||
712 | * a delegation). | ||
713 | */ | ||
714 | if (nfsi->attrtimeo == 0) | ||
715 | return 1; | ||
710 | return !time_in_range(jiffies, nfsi->read_cache_jiffies, nfsi->read_cache_jiffies + nfsi->attrtimeo); | 716 | return !time_in_range(jiffies, nfsi->read_cache_jiffies, nfsi->read_cache_jiffies + nfsi->attrtimeo); |
711 | } | 717 | } |
712 | 718 | ||
@@ -995,7 +1001,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
995 | unsigned long now = jiffies; | 1001 | unsigned long now = jiffies; |
996 | 1002 | ||
997 | dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", | 1003 | dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n", |
998 | __FUNCTION__, inode->i_sb->s_id, inode->i_ino, | 1004 | __func__, inode->i_sb->s_id, inode->i_ino, |
999 | atomic_read(&inode->i_count), fattr->valid); | 1005 | atomic_read(&inode->i_count), fattr->valid); |
1000 | 1006 | ||
1001 | if (nfsi->fileid != fattr->fileid) | 1007 | if (nfsi->fileid != fattr->fileid) |
@@ -1119,7 +1125,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1119 | * Big trouble! The inode has become a different object. | 1125 | * Big trouble! The inode has become a different object. |
1120 | */ | 1126 | */ |
1121 | printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n", | 1127 | printk(KERN_DEBUG "%s: inode %ld mode changed, %07o to %07o\n", |
1122 | __FUNCTION__, inode->i_ino, inode->i_mode, fattr->mode); | 1128 | __func__, inode->i_ino, inode->i_mode, fattr->mode); |
1123 | out_err: | 1129 | out_err: |
1124 | /* | 1130 | /* |
1125 | * No need to worry about unhashing the dentry, as the | 1131 | * No need to worry about unhashing the dentry, as the |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index af4d0f1e402c..2f285ef76399 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -106,7 +106,7 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd) | |||
106 | dprintk("--> nfs_follow_mountpoint()\n"); | 106 | dprintk("--> nfs_follow_mountpoint()\n"); |
107 | 107 | ||
108 | BUG_ON(IS_ROOT(dentry)); | 108 | BUG_ON(IS_ROOT(dentry)); |
109 | dprintk("%s: enter\n", __FUNCTION__); | 109 | dprintk("%s: enter\n", __func__); |
110 | dput(nd->path.dentry); | 110 | dput(nd->path.dentry); |
111 | nd->path.dentry = dget(dentry); | 111 | nd->path.dentry = dget(dentry); |
112 | 112 | ||
@@ -137,13 +137,12 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd) | |||
137 | goto out_follow; | 137 | goto out_follow; |
138 | goto out_err; | 138 | goto out_err; |
139 | } | 139 | } |
140 | mntput(nd->path.mnt); | 140 | path_put(&nd->path); |
141 | dput(nd->path.dentry); | ||
142 | nd->path.mnt = mnt; | 141 | nd->path.mnt = mnt; |
143 | nd->path.dentry = dget(mnt->mnt_root); | 142 | nd->path.dentry = dget(mnt->mnt_root); |
144 | schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout); | 143 | schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout); |
145 | out: | 144 | out: |
146 | dprintk("%s: done, returned %d\n", __FUNCTION__, err); | 145 | dprintk("%s: done, returned %d\n", __func__, err); |
147 | 146 | ||
148 | dprintk("<-- nfs_follow_mountpoint() = %d\n", err); | 147 | dprintk("<-- nfs_follow_mountpoint() = %d\n", err); |
149 | return ERR_PTR(err); | 148 | return ERR_PTR(err); |
@@ -230,7 +229,7 @@ static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent, | |||
230 | 229 | ||
231 | dprintk("--> nfs_do_submount()\n"); | 230 | dprintk("--> nfs_do_submount()\n"); |
232 | 231 | ||
233 | dprintk("%s: submounting on %s/%s\n", __FUNCTION__, | 232 | dprintk("%s: submounting on %s/%s\n", __func__, |
234 | dentry->d_parent->d_name.name, | 233 | dentry->d_parent->d_name.name, |
235 | dentry->d_name.name); | 234 | dentry->d_name.name); |
236 | if (page == NULL) | 235 | if (page == NULL) |
@@ -243,7 +242,7 @@ static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent, | |||
243 | free_page: | 242 | free_page: |
244 | free_page((unsigned long)page); | 243 | free_page((unsigned long)page); |
245 | out: | 244 | out: |
246 | dprintk("%s: done\n", __FUNCTION__); | 245 | dprintk("%s: done\n", __func__); |
247 | 246 | ||
248 | dprintk("<-- nfs_do_submount() = %p\n", mnt); | 247 | dprintk("<-- nfs_do_submount() = %p\n", mnt); |
249 | return mnt; | 248 | return mnt; |
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 549dbce714a4..c3523ad03ed1 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -63,15 +63,15 @@ do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle, | |||
63 | }; | 63 | }; |
64 | int status; | 64 | int status; |
65 | 65 | ||
66 | dprintk("%s: call fsinfo\n", __FUNCTION__); | 66 | dprintk("%s: call fsinfo\n", __func__); |
67 | nfs_fattr_init(info->fattr); | 67 | nfs_fattr_init(info->fattr); |
68 | status = rpc_call_sync(client, &msg, 0); | 68 | status = rpc_call_sync(client, &msg, 0); |
69 | dprintk("%s: reply fsinfo: %d\n", __FUNCTION__, status); | 69 | dprintk("%s: reply fsinfo: %d\n", __func__, status); |
70 | if (!(info->fattr->valid & NFS_ATTR_FATTR)) { | 70 | if (!(info->fattr->valid & NFS_ATTR_FATTR)) { |
71 | msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR]; | 71 | msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR]; |
72 | msg.rpc_resp = info->fattr; | 72 | msg.rpc_resp = info->fattr; |
73 | status = rpc_call_sync(client, &msg, 0); | 73 | status = rpc_call_sync(client, &msg, 0); |
74 | dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); | 74 | dprintk("%s: reply getattr: %d\n", __func__, status); |
75 | } | 75 | } |
76 | return status; | 76 | return status; |
77 | } | 77 | } |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index bd1b9d663fb9..ea790645fda6 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -206,7 +206,6 @@ struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp); | |||
206 | 206 | ||
207 | extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); | 207 | extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); |
208 | extern void nfs4_put_state_owner(struct nfs4_state_owner *); | 208 | extern void nfs4_put_state_owner(struct nfs4_state_owner *); |
209 | extern void nfs4_drop_state_owner(struct nfs4_state_owner *); | ||
210 | extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); | 209 | extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); |
211 | extern void nfs4_put_open_state(struct nfs4_state *); | 210 | extern void nfs4_put_open_state(struct nfs4_state *); |
212 | extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); | 211 | extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); |
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 5f9ba41ed5bf..b112857301f7 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -86,7 +86,7 @@ static int nfs4_validate_fspath(const struct vfsmount *mnt_parent, | |||
86 | 86 | ||
87 | if (strncmp(path, fs_path, strlen(fs_path)) != 0) { | 87 | if (strncmp(path, fs_path, strlen(fs_path)) != 0) { |
88 | dprintk("%s: path %s does not begin with fsroot %s\n", | 88 | dprintk("%s: path %s does not begin with fsroot %s\n", |
89 | __FUNCTION__, path, fs_path); | 89 | __func__, path, fs_path); |
90 | return -ENOENT; | 90 | return -ENOENT; |
91 | } | 91 | } |
92 | 92 | ||
@@ -134,7 +134,7 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent, | |||
134 | if (locations == NULL || locations->nlocations <= 0) | 134 | if (locations == NULL || locations->nlocations <= 0) |
135 | goto out; | 135 | goto out; |
136 | 136 | ||
137 | dprintk("%s: referral at %s/%s\n", __FUNCTION__, | 137 | dprintk("%s: referral at %s/%s\n", __func__, |
138 | dentry->d_parent->d_name.name, dentry->d_name.name); | 138 | dentry->d_parent->d_name.name, dentry->d_name.name); |
139 | 139 | ||
140 | page = (char *) __get_free_page(GFP_USER); | 140 | page = (char *) __get_free_page(GFP_USER); |
@@ -204,7 +204,7 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent, | |||
204 | out: | 204 | out: |
205 | free_page((unsigned long) page); | 205 | free_page((unsigned long) page); |
206 | free_page((unsigned long) page2); | 206 | free_page((unsigned long) page2); |
207 | dprintk("%s: done\n", __FUNCTION__); | 207 | dprintk("%s: done\n", __func__); |
208 | return mnt; | 208 | return mnt; |
209 | } | 209 | } |
210 | 210 | ||
@@ -223,7 +223,7 @@ struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentr | |||
223 | int err; | 223 | int err; |
224 | 224 | ||
225 | /* BUG_ON(IS_ROOT(dentry)); */ | 225 | /* BUG_ON(IS_ROOT(dentry)); */ |
226 | dprintk("%s: enter\n", __FUNCTION__); | 226 | dprintk("%s: enter\n", __func__); |
227 | 227 | ||
228 | page = alloc_page(GFP_KERNEL); | 228 | page = alloc_page(GFP_KERNEL); |
229 | if (page == NULL) | 229 | if (page == NULL) |
@@ -238,7 +238,7 @@ struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentr | |||
238 | 238 | ||
239 | parent = dget_parent(dentry); | 239 | parent = dget_parent(dentry); |
240 | dprintk("%s: getting locations for %s/%s\n", | 240 | dprintk("%s: getting locations for %s/%s\n", |
241 | __FUNCTION__, parent->d_name.name, dentry->d_name.name); | 241 | __func__, parent->d_name.name, dentry->d_name.name); |
242 | 242 | ||
243 | err = nfs4_proc_fs_locations(parent->d_inode, &dentry->d_name, fs_locations, page); | 243 | err = nfs4_proc_fs_locations(parent->d_inode, &dentry->d_name, fs_locations, page); |
244 | dput(parent); | 244 | dput(parent); |
@@ -252,6 +252,6 @@ out_free: | |||
252 | __free_page(page); | 252 | __free_page(page); |
253 | kfree(fs_locations); | 253 | kfree(fs_locations); |
254 | out: | 254 | out: |
255 | dprintk("%s: done\n", __FUNCTION__); | 255 | dprintk("%s: done\n", __func__); |
256 | return mnt; | 256 | return mnt; |
257 | } | 257 | } |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index dbc09271af02..1293e0acd82b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -73,7 +73,7 @@ int nfs4_map_errors(int err) | |||
73 | { | 73 | { |
74 | if (err < -1000) { | 74 | if (err < -1000) { |
75 | dprintk("%s could not handle NFSv4 error %d\n", | 75 | dprintk("%s could not handle NFSv4 error %d\n", |
76 | __FUNCTION__, -err); | 76 | __func__, -err); |
77 | return -EIO; | 77 | return -EIO; |
78 | } | 78 | } |
79 | return err; | 79 | return err; |
@@ -306,8 +306,7 @@ static void nfs4_opendata_free(struct kref *kref) | |||
306 | nfs4_put_open_state(p->state); | 306 | nfs4_put_open_state(p->state); |
307 | nfs4_put_state_owner(p->owner); | 307 | nfs4_put_state_owner(p->owner); |
308 | dput(p->dir); | 308 | dput(p->dir); |
309 | dput(p->path.dentry); | 309 | path_put(&p->path); |
310 | mntput(p->path.mnt); | ||
311 | kfree(p); | 310 | kfree(p); |
312 | } | 311 | } |
313 | 312 | ||
@@ -1210,8 +1209,7 @@ static void nfs4_free_closedata(void *data) | |||
1210 | nfs4_put_open_state(calldata->state); | 1209 | nfs4_put_open_state(calldata->state); |
1211 | nfs_free_seqid(calldata->arg.seqid); | 1210 | nfs_free_seqid(calldata->arg.seqid); |
1212 | nfs4_put_state_owner(sp); | 1211 | nfs4_put_state_owner(sp); |
1213 | dput(calldata->path.dentry); | 1212 | path_put(&calldata->path); |
1214 | mntput(calldata->path.mnt); | ||
1215 | kfree(calldata); | 1213 | kfree(calldata); |
1216 | } | 1214 | } |
1217 | 1215 | ||
@@ -1578,7 +1576,7 @@ static int nfs4_get_referral(struct inode *dir, const struct qstr *name, struct | |||
1578 | goto out; | 1576 | goto out; |
1579 | /* Make sure server returned a different fsid for the referral */ | 1577 | /* Make sure server returned a different fsid for the referral */ |
1580 | if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) { | 1578 | if (nfs_fsid_equal(&NFS_SERVER(dir)->fsid, &locations->fattr.fsid)) { |
1581 | dprintk("%s: server did not return a different fsid for a referral at %s\n", __FUNCTION__, name->name); | 1579 | dprintk("%s: server did not return a different fsid for a referral at %s\n", __func__, name->name); |
1582 | status = -EIO; | 1580 | status = -EIO; |
1583 | goto out; | 1581 | goto out; |
1584 | } | 1582 | } |
@@ -2211,7 +2209,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
2211 | }; | 2209 | }; |
2212 | int status; | 2210 | int status; |
2213 | 2211 | ||
2214 | dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __FUNCTION__, | 2212 | dprintk("%s: dentry = %s/%s, cookie = %Lu\n", __func__, |
2215 | dentry->d_parent->d_name.name, | 2213 | dentry->d_parent->d_name.name, |
2216 | dentry->d_name.name, | 2214 | dentry->d_name.name, |
2217 | (unsigned long long)cookie); | 2215 | (unsigned long long)cookie); |
@@ -2223,7 +2221,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, | |||
2223 | 2221 | ||
2224 | nfs_invalidate_atime(dir); | 2222 | nfs_invalidate_atime(dir); |
2225 | 2223 | ||
2226 | dprintk("%s: returns %d\n", __FUNCTION__, status); | 2224 | dprintk("%s: returns %d\n", __func__, status); |
2227 | return status; | 2225 | return status; |
2228 | } | 2226 | } |
2229 | 2227 | ||
@@ -3342,7 +3340,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
3342 | struct nfs4_lockdata *data = calldata; | 3340 | struct nfs4_lockdata *data = calldata; |
3343 | struct nfs4_state *state = data->lsp->ls_state; | 3341 | struct nfs4_state *state = data->lsp->ls_state; |
3344 | 3342 | ||
3345 | dprintk("%s: begin!\n", __FUNCTION__); | 3343 | dprintk("%s: begin!\n", __func__); |
3346 | if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) | 3344 | if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) |
3347 | return; | 3345 | return; |
3348 | /* Do we need to do an open_to_lock_owner? */ | 3346 | /* Do we need to do an open_to_lock_owner? */ |
@@ -3356,14 +3354,14 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
3356 | data->arg.new_lock_owner = 0; | 3354 | data->arg.new_lock_owner = 0; |
3357 | data->timestamp = jiffies; | 3355 | data->timestamp = jiffies; |
3358 | rpc_call_start(task); | 3356 | rpc_call_start(task); |
3359 | dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status); | 3357 | dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status); |
3360 | } | 3358 | } |
3361 | 3359 | ||
3362 | static void nfs4_lock_done(struct rpc_task *task, void *calldata) | 3360 | static void nfs4_lock_done(struct rpc_task *task, void *calldata) |
3363 | { | 3361 | { |
3364 | struct nfs4_lockdata *data = calldata; | 3362 | struct nfs4_lockdata *data = calldata; |
3365 | 3363 | ||
3366 | dprintk("%s: begin!\n", __FUNCTION__); | 3364 | dprintk("%s: begin!\n", __func__); |
3367 | 3365 | ||
3368 | data->rpc_status = task->tk_status; | 3366 | data->rpc_status = task->tk_status; |
3369 | if (RPC_ASSASSINATED(task)) | 3367 | if (RPC_ASSASSINATED(task)) |
@@ -3381,14 +3379,14 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata) | |||
3381 | renew_lease(NFS_SERVER(data->ctx->path.dentry->d_inode), data->timestamp); | 3379 | renew_lease(NFS_SERVER(data->ctx->path.dentry->d_inode), data->timestamp); |
3382 | } | 3380 | } |
3383 | out: | 3381 | out: |
3384 | dprintk("%s: done, ret = %d!\n", __FUNCTION__, data->rpc_status); | 3382 | dprintk("%s: done, ret = %d!\n", __func__, data->rpc_status); |
3385 | } | 3383 | } |
3386 | 3384 | ||
3387 | static void nfs4_lock_release(void *calldata) | 3385 | static void nfs4_lock_release(void *calldata) |
3388 | { | 3386 | { |
3389 | struct nfs4_lockdata *data = calldata; | 3387 | struct nfs4_lockdata *data = calldata; |
3390 | 3388 | ||
3391 | dprintk("%s: begin!\n", __FUNCTION__); | 3389 | dprintk("%s: begin!\n", __func__); |
3392 | nfs_free_seqid(data->arg.open_seqid); | 3390 | nfs_free_seqid(data->arg.open_seqid); |
3393 | if (data->cancelled != 0) { | 3391 | if (data->cancelled != 0) { |
3394 | struct rpc_task *task; | 3392 | struct rpc_task *task; |
@@ -3396,13 +3394,13 @@ static void nfs4_lock_release(void *calldata) | |||
3396 | data->arg.lock_seqid); | 3394 | data->arg.lock_seqid); |
3397 | if (!IS_ERR(task)) | 3395 | if (!IS_ERR(task)) |
3398 | rpc_put_task(task); | 3396 | rpc_put_task(task); |
3399 | dprintk("%s: cancelling lock!\n", __FUNCTION__); | 3397 | dprintk("%s: cancelling lock!\n", __func__); |
3400 | } else | 3398 | } else |
3401 | nfs_free_seqid(data->arg.lock_seqid); | 3399 | nfs_free_seqid(data->arg.lock_seqid); |
3402 | nfs4_put_lock_state(data->lsp); | 3400 | nfs4_put_lock_state(data->lsp); |
3403 | put_nfs_open_context(data->ctx); | 3401 | put_nfs_open_context(data->ctx); |
3404 | kfree(data); | 3402 | kfree(data); |
3405 | dprintk("%s: done!\n", __FUNCTION__); | 3403 | dprintk("%s: done!\n", __func__); |
3406 | } | 3404 | } |
3407 | 3405 | ||
3408 | static const struct rpc_call_ops nfs4_lock_ops = { | 3406 | static const struct rpc_call_ops nfs4_lock_ops = { |
@@ -3428,7 +3426,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | |||
3428 | }; | 3426 | }; |
3429 | int ret; | 3427 | int ret; |
3430 | 3428 | ||
3431 | dprintk("%s: begin!\n", __FUNCTION__); | 3429 | dprintk("%s: begin!\n", __func__); |
3432 | data = nfs4_alloc_lockdata(fl, nfs_file_open_context(fl->fl_file), | 3430 | data = nfs4_alloc_lockdata(fl, nfs_file_open_context(fl->fl_file), |
3433 | fl->fl_u.nfs4_fl.owner); | 3431 | fl->fl_u.nfs4_fl.owner); |
3434 | if (data == NULL) | 3432 | if (data == NULL) |
@@ -3451,7 +3449,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | |||
3451 | } else | 3449 | } else |
3452 | data->cancelled = 1; | 3450 | data->cancelled = 1; |
3453 | rpc_put_task(task); | 3451 | rpc_put_task(task); |
3454 | dprintk("%s: done, ret = %d!\n", __FUNCTION__, ret); | 3452 | dprintk("%s: done, ret = %d!\n", __func__, ret); |
3455 | return ret; | 3453 | return ret; |
3456 | } | 3454 | } |
3457 | 3455 | ||
@@ -3527,7 +3525,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
3527 | /* Note: we always want to sleep here! */ | 3525 | /* Note: we always want to sleep here! */ |
3528 | request->fl_flags = fl_flags | FL_SLEEP; | 3526 | request->fl_flags = fl_flags | FL_SLEEP; |
3529 | if (do_vfs_lock(request->fl_file, request) < 0) | 3527 | if (do_vfs_lock(request->fl_file, request) < 0) |
3530 | printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", __FUNCTION__); | 3528 | printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", __func__); |
3531 | out_unlock: | 3529 | out_unlock: |
3532 | up_read(&clp->cl_sem); | 3530 | up_read(&clp->cl_sem); |
3533 | out: | 3531 | out: |
@@ -3665,12 +3663,12 @@ int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, | |||
3665 | }; | 3663 | }; |
3666 | int status; | 3664 | int status; |
3667 | 3665 | ||
3668 | dprintk("%s: start\n", __FUNCTION__); | 3666 | dprintk("%s: start\n", __func__); |
3669 | nfs_fattr_init(&fs_locations->fattr); | 3667 | nfs_fattr_init(&fs_locations->fattr); |
3670 | fs_locations->server = server; | 3668 | fs_locations->server = server; |
3671 | fs_locations->nlocations = 0; | 3669 | fs_locations->nlocations = 0; |
3672 | status = rpc_call_sync(server->client, &msg, 0); | 3670 | status = rpc_call_sync(server->client, &msg, 0); |
3673 | dprintk("%s: returned status = %d\n", __FUNCTION__, status); | 3671 | dprintk("%s: returned status = %d\n", __func__, status); |
3674 | return status; | 3672 | return status; |
3675 | } | 3673 | } |
3676 | 3674 | ||
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index 5e2e4af1a0e6..3305acbbe2ae 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
@@ -66,7 +66,7 @@ nfs4_renew_state(struct work_struct *work) | |||
66 | unsigned long last, now; | 66 | unsigned long last, now; |
67 | 67 | ||
68 | down_read(&clp->cl_sem); | 68 | down_read(&clp->cl_sem); |
69 | dprintk("%s: start\n", __FUNCTION__); | 69 | dprintk("%s: start\n", __func__); |
70 | /* Are there any active superblocks? */ | 70 | /* Are there any active superblocks? */ |
71 | if (list_empty(&clp->cl_superblocks)) | 71 | if (list_empty(&clp->cl_superblocks)) |
72 | goto out; | 72 | goto out; |
@@ -92,17 +92,17 @@ nfs4_renew_state(struct work_struct *work) | |||
92 | spin_lock(&clp->cl_lock); | 92 | spin_lock(&clp->cl_lock); |
93 | } else | 93 | } else |
94 | dprintk("%s: failed to call renewd. Reason: lease not expired \n", | 94 | dprintk("%s: failed to call renewd. Reason: lease not expired \n", |
95 | __FUNCTION__); | 95 | __func__); |
96 | if (timeout < 5 * HZ) /* safeguard */ | 96 | if (timeout < 5 * HZ) /* safeguard */ |
97 | timeout = 5 * HZ; | 97 | timeout = 5 * HZ; |
98 | dprintk("%s: requeueing work. Lease period = %ld\n", | 98 | dprintk("%s: requeueing work. Lease period = %ld\n", |
99 | __FUNCTION__, (timeout + HZ - 1) / HZ); | 99 | __func__, (timeout + HZ - 1) / HZ); |
100 | cancel_delayed_work(&clp->cl_renewd); | 100 | cancel_delayed_work(&clp->cl_renewd); |
101 | schedule_delayed_work(&clp->cl_renewd, timeout); | 101 | schedule_delayed_work(&clp->cl_renewd, timeout); |
102 | spin_unlock(&clp->cl_lock); | 102 | spin_unlock(&clp->cl_lock); |
103 | out: | 103 | out: |
104 | up_read(&clp->cl_sem); | 104 | up_read(&clp->cl_sem); |
105 | dprintk("%s: done\n", __FUNCTION__); | 105 | dprintk("%s: done\n", __func__); |
106 | } | 106 | } |
107 | 107 | ||
108 | /* Must be called with clp->cl_sem locked for writes */ | 108 | /* Must be called with clp->cl_sem locked for writes */ |
@@ -117,7 +117,7 @@ nfs4_schedule_state_renewal(struct nfs_client *clp) | |||
117 | if (timeout < 5 * HZ) | 117 | if (timeout < 5 * HZ) |
118 | timeout = 5 * HZ; | 118 | timeout = 5 * HZ; |
119 | dprintk("%s: requeueing work. Lease period = %ld\n", | 119 | dprintk("%s: requeueing work. Lease period = %ld\n", |
120 | __FUNCTION__, (timeout + HZ - 1) / HZ); | 120 | __func__, (timeout + HZ - 1) / HZ); |
121 | cancel_delayed_work(&clp->cl_renewd); | 121 | cancel_delayed_work(&clp->cl_renewd); |
122 | schedule_delayed_work(&clp->cl_renewd, timeout); | 122 | schedule_delayed_work(&clp->cl_renewd, timeout); |
123 | set_bit(NFS_CS_RENEWD, &clp->cl_res_state); | 123 | set_bit(NFS_CS_RENEWD, &clp->cl_res_state); |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 46eb624e4f16..856a8934f610 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -282,7 +282,7 @@ nfs4_alloc_state_owner(void) | |||
282 | return sp; | 282 | return sp; |
283 | } | 283 | } |
284 | 284 | ||
285 | void | 285 | static void |
286 | nfs4_drop_state_owner(struct nfs4_state_owner *sp) | 286 | nfs4_drop_state_owner(struct nfs4_state_owner *sp) |
287 | { | 287 | { |
288 | if (!RB_EMPTY_NODE(&sp->so_client_node)) { | 288 | if (!RB_EMPTY_NODE(&sp->so_client_node)) { |
@@ -828,7 +828,7 @@ static int nfs4_reclaim_locks(struct nfs4_state_recovery_ops *ops, struct nfs4_s | |||
828 | switch (status) { | 828 | switch (status) { |
829 | default: | 829 | default: |
830 | printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", | 830 | printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", |
831 | __FUNCTION__, status); | 831 | __func__, status); |
832 | case -NFS4ERR_EXPIRED: | 832 | case -NFS4ERR_EXPIRED: |
833 | case -NFS4ERR_NO_GRACE: | 833 | case -NFS4ERR_NO_GRACE: |
834 | case -NFS4ERR_RECLAIM_BAD: | 834 | case -NFS4ERR_RECLAIM_BAD: |
@@ -869,14 +869,14 @@ static int nfs4_reclaim_open_state(struct nfs4_state_recovery_ops *ops, struct n | |||
869 | list_for_each_entry(lock, &state->lock_states, ls_locks) { | 869 | list_for_each_entry(lock, &state->lock_states, ls_locks) { |
870 | if (!(lock->ls_flags & NFS_LOCK_INITIALIZED)) | 870 | if (!(lock->ls_flags & NFS_LOCK_INITIALIZED)) |
871 | printk("%s: Lock reclaim failed!\n", | 871 | printk("%s: Lock reclaim failed!\n", |
872 | __FUNCTION__); | 872 | __func__); |
873 | } | 873 | } |
874 | continue; | 874 | continue; |
875 | } | 875 | } |
876 | switch (status) { | 876 | switch (status) { |
877 | default: | 877 | default: |
878 | printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", | 878 | printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n", |
879 | __FUNCTION__, status); | 879 | __func__, status); |
880 | case -ENOENT: | 880 | case -ENOENT: |
881 | case -NFS4ERR_RECLAIM_BAD: | 881 | case -NFS4ERR_RECLAIM_BAD: |
882 | case -NFS4ERR_RECLAIM_CONFLICT: | 882 | case -NFS4ERR_RECLAIM_CONFLICT: |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 5a2d64927b35..b916297d2334 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -1831,7 +1831,7 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf | |||
1831 | xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, | 1831 | xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, |
1832 | args->pgbase, args->count); | 1832 | args->pgbase, args->count); |
1833 | dprintk("%s: inlined page args = (%u, %p, %u, %u)\n", | 1833 | dprintk("%s: inlined page args = (%u, %p, %u, %u)\n", |
1834 | __FUNCTION__, replen, args->pages, | 1834 | __func__, replen, args->pages, |
1835 | args->pgbase, args->count); | 1835 | args->pgbase, args->count); |
1836 | 1836 | ||
1837 | out: | 1837 | out: |
@@ -2192,9 +2192,9 @@ out: | |||
2192 | p = xdr_inline_decode(xdr, nbytes); \ | 2192 | p = xdr_inline_decode(xdr, nbytes); \ |
2193 | if (unlikely(!p)) { \ | 2193 | if (unlikely(!p)) { \ |
2194 | dprintk("nfs: %s: prematurely hit end of receive" \ | 2194 | dprintk("nfs: %s: prematurely hit end of receive" \ |
2195 | " buffer\n", __FUNCTION__); \ | 2195 | " buffer\n", __func__); \ |
2196 | dprintk("nfs: %s: xdr->p=%p, bytes=%u, xdr->end=%p\n", \ | 2196 | dprintk("nfs: %s: xdr->p=%p, bytes=%u, xdr->end=%p\n", \ |
2197 | __FUNCTION__, xdr->p, nbytes, xdr->end); \ | 2197 | __func__, xdr->p, nbytes, xdr->end); \ |
2198 | return -EIO; \ | 2198 | return -EIO; \ |
2199 | } \ | 2199 | } \ |
2200 | } while (0) | 2200 | } while (0) |
@@ -2306,12 +2306,12 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t * | |||
2306 | READ_BUF(4); | 2306 | READ_BUF(4); |
2307 | READ32(*type); | 2307 | READ32(*type); |
2308 | if (*type < NF4REG || *type > NF4NAMEDATTR) { | 2308 | if (*type < NF4REG || *type > NF4NAMEDATTR) { |
2309 | dprintk("%s: bad type %d\n", __FUNCTION__, *type); | 2309 | dprintk("%s: bad type %d\n", __func__, *type); |
2310 | return -EIO; | 2310 | return -EIO; |
2311 | } | 2311 | } |
2312 | bitmap[0] &= ~FATTR4_WORD0_TYPE; | 2312 | bitmap[0] &= ~FATTR4_WORD0_TYPE; |
2313 | } | 2313 | } |
2314 | dprintk("%s: type=0%o\n", __FUNCTION__, nfs_type2fmt[*type].nfs2type); | 2314 | dprintk("%s: type=0%o\n", __func__, nfs_type2fmt[*type].nfs2type); |
2315 | return 0; | 2315 | return 0; |
2316 | } | 2316 | } |
2317 | 2317 | ||
@@ -2327,7 +2327,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2327 | READ64(*change); | 2327 | READ64(*change); |
2328 | bitmap[0] &= ~FATTR4_WORD0_CHANGE; | 2328 | bitmap[0] &= ~FATTR4_WORD0_CHANGE; |
2329 | } | 2329 | } |
2330 | dprintk("%s: change attribute=%Lu\n", __FUNCTION__, | 2330 | dprintk("%s: change attribute=%Lu\n", __func__, |
2331 | (unsigned long long)*change); | 2331 | (unsigned long long)*change); |
2332 | return 0; | 2332 | return 0; |
2333 | } | 2333 | } |
@@ -2344,7 +2344,7 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t * | |||
2344 | READ64(*size); | 2344 | READ64(*size); |
2345 | bitmap[0] &= ~FATTR4_WORD0_SIZE; | 2345 | bitmap[0] &= ~FATTR4_WORD0_SIZE; |
2346 | } | 2346 | } |
2347 | dprintk("%s: file size=%Lu\n", __FUNCTION__, (unsigned long long)*size); | 2347 | dprintk("%s: file size=%Lu\n", __func__, (unsigned long long)*size); |
2348 | return 0; | 2348 | return 0; |
2349 | } | 2349 | } |
2350 | 2350 | ||
@@ -2360,7 +2360,7 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui | |||
2360 | READ32(*res); | 2360 | READ32(*res); |
2361 | bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; | 2361 | bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; |
2362 | } | 2362 | } |
2363 | dprintk("%s: link support=%s\n", __FUNCTION__, *res == 0 ? "false" : "true"); | 2363 | dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true"); |
2364 | return 0; | 2364 | return 0; |
2365 | } | 2365 | } |
2366 | 2366 | ||
@@ -2376,7 +2376,7 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, | |||
2376 | READ32(*res); | 2376 | READ32(*res); |
2377 | bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT; | 2377 | bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT; |
2378 | } | 2378 | } |
2379 | dprintk("%s: symlink support=%s\n", __FUNCTION__, *res == 0 ? "false" : "true"); | 2379 | dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true"); |
2380 | return 0; | 2380 | return 0; |
2381 | } | 2381 | } |
2382 | 2382 | ||
@@ -2394,7 +2394,7 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs | |||
2394 | READ64(fsid->minor); | 2394 | READ64(fsid->minor); |
2395 | bitmap[0] &= ~FATTR4_WORD0_FSID; | 2395 | bitmap[0] &= ~FATTR4_WORD0_FSID; |
2396 | } | 2396 | } |
2397 | dprintk("%s: fsid=(0x%Lx/0x%Lx)\n", __FUNCTION__, | 2397 | dprintk("%s: fsid=(0x%Lx/0x%Lx)\n", __func__, |
2398 | (unsigned long long)fsid->major, | 2398 | (unsigned long long)fsid->major, |
2399 | (unsigned long long)fsid->minor); | 2399 | (unsigned long long)fsid->minor); |
2400 | return 0; | 2400 | return 0; |
@@ -2412,7 +2412,7 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2412 | READ32(*res); | 2412 | READ32(*res); |
2413 | bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; | 2413 | bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; |
2414 | } | 2414 | } |
2415 | dprintk("%s: file size=%u\n", __FUNCTION__, (unsigned int)*res); | 2415 | dprintk("%s: file size=%u\n", __func__, (unsigned int)*res); |
2416 | return 0; | 2416 | return 0; |
2417 | } | 2417 | } |
2418 | 2418 | ||
@@ -2428,7 +2428,7 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2428 | READ32(*res); | 2428 | READ32(*res); |
2429 | bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT; | 2429 | bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT; |
2430 | } | 2430 | } |
2431 | dprintk("%s: ACLs supported=%u\n", __FUNCTION__, (unsigned int)*res); | 2431 | dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res); |
2432 | return 0; | 2432 | return 0; |
2433 | } | 2433 | } |
2434 | 2434 | ||
@@ -2444,7 +2444,7 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t | |||
2444 | READ64(*fileid); | 2444 | READ64(*fileid); |
2445 | bitmap[0] &= ~FATTR4_WORD0_FILEID; | 2445 | bitmap[0] &= ~FATTR4_WORD0_FILEID; |
2446 | } | 2446 | } |
2447 | dprintk("%s: fileid=%Lu\n", __FUNCTION__, (unsigned long long)*fileid); | 2447 | dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); |
2448 | return 0; | 2448 | return 0; |
2449 | } | 2449 | } |
2450 | 2450 | ||
@@ -2460,7 +2460,7 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma | |||
2460 | READ64(*fileid); | 2460 | READ64(*fileid); |
2461 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; | 2461 | bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; |
2462 | } | 2462 | } |
2463 | dprintk("%s: fileid=%Lu\n", __FUNCTION__, (unsigned long long)*fileid); | 2463 | dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); |
2464 | return 0; | 2464 | return 0; |
2465 | } | 2465 | } |
2466 | 2466 | ||
@@ -2477,7 +2477,7 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2477 | READ64(*res); | 2477 | READ64(*res); |
2478 | bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; | 2478 | bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; |
2479 | } | 2479 | } |
2480 | dprintk("%s: files avail=%Lu\n", __FUNCTION__, (unsigned long long)*res); | 2480 | dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res); |
2481 | return status; | 2481 | return status; |
2482 | } | 2482 | } |
2483 | 2483 | ||
@@ -2494,7 +2494,7 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2494 | READ64(*res); | 2494 | READ64(*res); |
2495 | bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; | 2495 | bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; |
2496 | } | 2496 | } |
2497 | dprintk("%s: files free=%Lu\n", __FUNCTION__, (unsigned long long)*res); | 2497 | dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res); |
2498 | return status; | 2498 | return status; |
2499 | } | 2499 | } |
2500 | 2500 | ||
@@ -2511,7 +2511,7 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2511 | READ64(*res); | 2511 | READ64(*res); |
2512 | bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; | 2512 | bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; |
2513 | } | 2513 | } |
2514 | dprintk("%s: files total=%Lu\n", __FUNCTION__, (unsigned long long)*res); | 2514 | dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res); |
2515 | return status; | 2515 | return status; |
2516 | } | 2516 | } |
2517 | 2517 | ||
@@ -2569,7 +2569,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st | |||
2569 | status = 0; | 2569 | status = 0; |
2570 | if (unlikely(!(bitmap[0] & FATTR4_WORD0_FS_LOCATIONS))) | 2570 | if (unlikely(!(bitmap[0] & FATTR4_WORD0_FS_LOCATIONS))) |
2571 | goto out; | 2571 | goto out; |
2572 | dprintk("%s: fsroot ", __FUNCTION__); | 2572 | dprintk("%s: fsroot ", __func__); |
2573 | status = decode_pathname(xdr, &res->fs_path); | 2573 | status = decode_pathname(xdr, &res->fs_path); |
2574 | if (unlikely(status != 0)) | 2574 | if (unlikely(status != 0)) |
2575 | goto out; | 2575 | goto out; |
@@ -2586,7 +2586,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st | |||
2586 | READ32(m); | 2586 | READ32(m); |
2587 | 2587 | ||
2588 | loc->nservers = 0; | 2588 | loc->nservers = 0; |
2589 | dprintk("%s: servers ", __FUNCTION__); | 2589 | dprintk("%s: servers ", __func__); |
2590 | while (loc->nservers < m) { | 2590 | while (loc->nservers < m) { |
2591 | struct nfs4_string *server = &loc->servers[loc->nservers]; | 2591 | struct nfs4_string *server = &loc->servers[loc->nservers]; |
2592 | status = decode_opaque_inline(xdr, &server->len, &server->data); | 2592 | status = decode_opaque_inline(xdr, &server->len, &server->data); |
@@ -2599,7 +2599,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st | |||
2599 | unsigned int i; | 2599 | unsigned int i; |
2600 | dprintk("%s: using first %u of %u servers " | 2600 | dprintk("%s: using first %u of %u servers " |
2601 | "returned for location %u\n", | 2601 | "returned for location %u\n", |
2602 | __FUNCTION__, | 2602 | __func__, |
2603 | NFS4_FS_LOCATION_MAXSERVERS, | 2603 | NFS4_FS_LOCATION_MAXSERVERS, |
2604 | m, res->nlocations); | 2604 | m, res->nlocations); |
2605 | for (i = loc->nservers; i < m; i++) { | 2605 | for (i = loc->nservers; i < m; i++) { |
@@ -2618,7 +2618,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st | |||
2618 | res->nlocations++; | 2618 | res->nlocations++; |
2619 | } | 2619 | } |
2620 | out: | 2620 | out: |
2621 | dprintk("%s: fs_locations done, error = %d\n", __FUNCTION__, status); | 2621 | dprintk("%s: fs_locations done, error = %d\n", __func__, status); |
2622 | return status; | 2622 | return status; |
2623 | out_eio: | 2623 | out_eio: |
2624 | status = -EIO; | 2624 | status = -EIO; |
@@ -2638,7 +2638,7 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2638 | READ64(*res); | 2638 | READ64(*res); |
2639 | bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; | 2639 | bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; |
2640 | } | 2640 | } |
2641 | dprintk("%s: maxfilesize=%Lu\n", __FUNCTION__, (unsigned long long)*res); | 2641 | dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res); |
2642 | return status; | 2642 | return status; |
2643 | } | 2643 | } |
2644 | 2644 | ||
@@ -2655,7 +2655,7 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
2655 | READ32(*maxlink); | 2655 | READ32(*maxlink); |
2656 | bitmap[0] &= ~FATTR4_WORD0_MAXLINK; | 2656 | bitmap[0] &= ~FATTR4_WORD0_MAXLINK; |
2657 | } | 2657 | } |
2658 | dprintk("%s: maxlink=%u\n", __FUNCTION__, *maxlink); | 2658 | dprintk("%s: maxlink=%u\n", __func__, *maxlink); |
2659 | return status; | 2659 | return status; |
2660 | } | 2660 | } |
2661 | 2661 | ||
@@ -2672,7 +2672,7 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
2672 | READ32(*maxname); | 2672 | READ32(*maxname); |
2673 | bitmap[0] &= ~FATTR4_WORD0_MAXNAME; | 2673 | bitmap[0] &= ~FATTR4_WORD0_MAXNAME; |
2674 | } | 2674 | } |
2675 | dprintk("%s: maxname=%u\n", __FUNCTION__, *maxname); | 2675 | dprintk("%s: maxname=%u\n", __func__, *maxname); |
2676 | return status; | 2676 | return status; |
2677 | } | 2677 | } |
2678 | 2678 | ||
@@ -2693,7 +2693,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_ | |||
2693 | *res = (uint32_t)maxread; | 2693 | *res = (uint32_t)maxread; |
2694 | bitmap[0] &= ~FATTR4_WORD0_MAXREAD; | 2694 | bitmap[0] &= ~FATTR4_WORD0_MAXREAD; |
2695 | } | 2695 | } |
2696 | dprintk("%s: maxread=%lu\n", __FUNCTION__, (unsigned long)*res); | 2696 | dprintk("%s: maxread=%lu\n", __func__, (unsigned long)*res); |
2697 | return status; | 2697 | return status; |
2698 | } | 2698 | } |
2699 | 2699 | ||
@@ -2714,7 +2714,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32 | |||
2714 | *res = (uint32_t)maxwrite; | 2714 | *res = (uint32_t)maxwrite; |
2715 | bitmap[0] &= ~FATTR4_WORD0_MAXWRITE; | 2715 | bitmap[0] &= ~FATTR4_WORD0_MAXWRITE; |
2716 | } | 2716 | } |
2717 | dprintk("%s: maxwrite=%lu\n", __FUNCTION__, (unsigned long)*res); | 2717 | dprintk("%s: maxwrite=%lu\n", __func__, (unsigned long)*res); |
2718 | return status; | 2718 | return status; |
2719 | } | 2719 | } |
2720 | 2720 | ||
@@ -2731,7 +2731,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t * | |||
2731 | *mode &= ~S_IFMT; | 2731 | *mode &= ~S_IFMT; |
2732 | bitmap[1] &= ~FATTR4_WORD1_MODE; | 2732 | bitmap[1] &= ~FATTR4_WORD1_MODE; |
2733 | } | 2733 | } |
2734 | dprintk("%s: file mode=0%o\n", __FUNCTION__, (unsigned int)*mode); | 2734 | dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode); |
2735 | return 0; | 2735 | return 0; |
2736 | } | 2736 | } |
2737 | 2737 | ||
@@ -2747,7 +2747,7 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t | |||
2747 | READ32(*nlink); | 2747 | READ32(*nlink); |
2748 | bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; | 2748 | bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; |
2749 | } | 2749 | } |
2750 | dprintk("%s: nlink=%u\n", __FUNCTION__, (unsigned int)*nlink); | 2750 | dprintk("%s: nlink=%u\n", __func__, (unsigned int)*nlink); |
2751 | return 0; | 2751 | return 0; |
2752 | } | 2752 | } |
2753 | 2753 | ||
@@ -2766,13 +2766,13 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2766 | if (len < XDR_MAX_NETOBJ) { | 2766 | if (len < XDR_MAX_NETOBJ) { |
2767 | if (nfs_map_name_to_uid(clp, (char *)p, len, uid) != 0) | 2767 | if (nfs_map_name_to_uid(clp, (char *)p, len, uid) != 0) |
2768 | dprintk("%s: nfs_map_name_to_uid failed!\n", | 2768 | dprintk("%s: nfs_map_name_to_uid failed!\n", |
2769 | __FUNCTION__); | 2769 | __func__); |
2770 | } else | 2770 | } else |
2771 | dprintk("%s: name too long (%u)!\n", | 2771 | dprintk("%s: name too long (%u)!\n", |
2772 | __FUNCTION__, len); | 2772 | __func__, len); |
2773 | bitmap[1] &= ~FATTR4_WORD1_OWNER; | 2773 | bitmap[1] &= ~FATTR4_WORD1_OWNER; |
2774 | } | 2774 | } |
2775 | dprintk("%s: uid=%d\n", __FUNCTION__, (int)*uid); | 2775 | dprintk("%s: uid=%d\n", __func__, (int)*uid); |
2776 | return 0; | 2776 | return 0; |
2777 | } | 2777 | } |
2778 | 2778 | ||
@@ -2791,13 +2791,13 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2791 | if (len < XDR_MAX_NETOBJ) { | 2791 | if (len < XDR_MAX_NETOBJ) { |
2792 | if (nfs_map_group_to_gid(clp, (char *)p, len, gid) != 0) | 2792 | if (nfs_map_group_to_gid(clp, (char *)p, len, gid) != 0) |
2793 | dprintk("%s: nfs_map_group_to_gid failed!\n", | 2793 | dprintk("%s: nfs_map_group_to_gid failed!\n", |
2794 | __FUNCTION__); | 2794 | __func__); |
2795 | } else | 2795 | } else |
2796 | dprintk("%s: name too long (%u)!\n", | 2796 | dprintk("%s: name too long (%u)!\n", |
2797 | __FUNCTION__, len); | 2797 | __func__, len); |
2798 | bitmap[1] &= ~FATTR4_WORD1_OWNER_GROUP; | 2798 | bitmap[1] &= ~FATTR4_WORD1_OWNER_GROUP; |
2799 | } | 2799 | } |
2800 | dprintk("%s: gid=%d\n", __FUNCTION__, (int)*gid); | 2800 | dprintk("%s: gid=%d\n", __func__, (int)*gid); |
2801 | return 0; | 2801 | return 0; |
2802 | } | 2802 | } |
2803 | 2803 | ||
@@ -2820,7 +2820,7 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde | |||
2820 | *rdev = tmp; | 2820 | *rdev = tmp; |
2821 | bitmap[1] &= ~ FATTR4_WORD1_RAWDEV; | 2821 | bitmap[1] &= ~ FATTR4_WORD1_RAWDEV; |
2822 | } | 2822 | } |
2823 | dprintk("%s: rdev=(0x%x:0x%x)\n", __FUNCTION__, major, minor); | 2823 | dprintk("%s: rdev=(0x%x:0x%x)\n", __func__, major, minor); |
2824 | return 0; | 2824 | return 0; |
2825 | } | 2825 | } |
2826 | 2826 | ||
@@ -2837,7 +2837,7 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2837 | READ64(*res); | 2837 | READ64(*res); |
2838 | bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; | 2838 | bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; |
2839 | } | 2839 | } |
2840 | dprintk("%s: space avail=%Lu\n", __FUNCTION__, (unsigned long long)*res); | 2840 | dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res); |
2841 | return status; | 2841 | return status; |
2842 | } | 2842 | } |
2843 | 2843 | ||
@@ -2854,7 +2854,7 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2854 | READ64(*res); | 2854 | READ64(*res); |
2855 | bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; | 2855 | bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; |
2856 | } | 2856 | } |
2857 | dprintk("%s: space free=%Lu\n", __FUNCTION__, (unsigned long long)*res); | 2857 | dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res); |
2858 | return status; | 2858 | return status; |
2859 | } | 2859 | } |
2860 | 2860 | ||
@@ -2871,7 +2871,7 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin | |||
2871 | READ64(*res); | 2871 | READ64(*res); |
2872 | bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; | 2872 | bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; |
2873 | } | 2873 | } |
2874 | dprintk("%s: space total=%Lu\n", __FUNCTION__, (unsigned long long)*res); | 2874 | dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res); |
2875 | return status; | 2875 | return status; |
2876 | } | 2876 | } |
2877 | 2877 | ||
@@ -2887,7 +2887,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint | |||
2887 | READ64(*used); | 2887 | READ64(*used); |
2888 | bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; | 2888 | bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; |
2889 | } | 2889 | } |
2890 | dprintk("%s: space used=%Lu\n", __FUNCTION__, | 2890 | dprintk("%s: space used=%Lu\n", __func__, |
2891 | (unsigned long long)*used); | 2891 | (unsigned long long)*used); |
2892 | return 0; | 2892 | return 0; |
2893 | } | 2893 | } |
@@ -2918,7 +2918,7 @@ static int decode_attr_time_access(struct xdr_stream *xdr, uint32_t *bitmap, str | |||
2918 | status = decode_attr_time(xdr, time); | 2918 | status = decode_attr_time(xdr, time); |
2919 | bitmap[1] &= ~FATTR4_WORD1_TIME_ACCESS; | 2919 | bitmap[1] &= ~FATTR4_WORD1_TIME_ACCESS; |
2920 | } | 2920 | } |
2921 | dprintk("%s: atime=%ld\n", __FUNCTION__, (long)time->tv_sec); | 2921 | dprintk("%s: atime=%ld\n", __func__, (long)time->tv_sec); |
2922 | return status; | 2922 | return status; |
2923 | } | 2923 | } |
2924 | 2924 | ||
@@ -2934,7 +2934,7 @@ static int decode_attr_time_metadata(struct xdr_stream *xdr, uint32_t *bitmap, s | |||
2934 | status = decode_attr_time(xdr, time); | 2934 | status = decode_attr_time(xdr, time); |
2935 | bitmap[1] &= ~FATTR4_WORD1_TIME_METADATA; | 2935 | bitmap[1] &= ~FATTR4_WORD1_TIME_METADATA; |
2936 | } | 2936 | } |
2937 | dprintk("%s: ctime=%ld\n", __FUNCTION__, (long)time->tv_sec); | 2937 | dprintk("%s: ctime=%ld\n", __func__, (long)time->tv_sec); |
2938 | return status; | 2938 | return status; |
2939 | } | 2939 | } |
2940 | 2940 | ||
@@ -2950,7 +2950,7 @@ static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, str | |||
2950 | status = decode_attr_time(xdr, time); | 2950 | status = decode_attr_time(xdr, time); |
2951 | bitmap[1] &= ~FATTR4_WORD1_TIME_MODIFY; | 2951 | bitmap[1] &= ~FATTR4_WORD1_TIME_MODIFY; |
2952 | } | 2952 | } |
2953 | dprintk("%s: mtime=%ld\n", __FUNCTION__, (long)time->tv_sec); | 2953 | dprintk("%s: mtime=%ld\n", __func__, (long)time->tv_sec); |
2954 | return status; | 2954 | return status; |
2955 | } | 2955 | } |
2956 | 2956 | ||
@@ -2962,7 +2962,7 @@ static int verify_attr_len(struct xdr_stream *xdr, __be32 *savep, uint32_t attrl | |||
2962 | if (unlikely(attrwords != nwords)) { | 2962 | if (unlikely(attrwords != nwords)) { |
2963 | dprintk("%s: server returned incorrect attribute length: " | 2963 | dprintk("%s: server returned incorrect attribute length: " |
2964 | "%u %c %u\n", | 2964 | "%u %c %u\n", |
2965 | __FUNCTION__, | 2965 | __func__, |
2966 | attrwords << 2, | 2966 | attrwords << 2, |
2967 | (attrwords < nwords) ? '<' : '>', | 2967 | (attrwords < nwords) ? '<' : '>', |
2968 | nwords << 2); | 2968 | nwords << 2); |
@@ -3067,7 +3067,7 @@ static int decode_server_caps(struct xdr_stream *xdr, struct nfs4_server_caps_re | |||
3067 | goto xdr_error; | 3067 | goto xdr_error; |
3068 | status = verify_attr_len(xdr, savep, attrlen); | 3068 | status = verify_attr_len(xdr, savep, attrlen); |
3069 | xdr_error: | 3069 | xdr_error: |
3070 | dprintk("%s: xdr returned %d!\n", __FUNCTION__, -status); | 3070 | dprintk("%s: xdr returned %d!\n", __func__, -status); |
3071 | return status; | 3071 | return status; |
3072 | } | 3072 | } |
3073 | 3073 | ||
@@ -3100,7 +3100,7 @@ static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) | |||
3100 | 3100 | ||
3101 | status = verify_attr_len(xdr, savep, attrlen); | 3101 | status = verify_attr_len(xdr, savep, attrlen); |
3102 | xdr_error: | 3102 | xdr_error: |
3103 | dprintk("%s: xdr returned %d!\n", __FUNCTION__, -status); | 3103 | dprintk("%s: xdr returned %d!\n", __func__, -status); |
3104 | return status; | 3104 | return status; |
3105 | } | 3105 | } |
3106 | 3106 | ||
@@ -3125,7 +3125,7 @@ static int decode_pathconf(struct xdr_stream *xdr, struct nfs_pathconf *pathconf | |||
3125 | 3125 | ||
3126 | status = verify_attr_len(xdr, savep, attrlen); | 3126 | status = verify_attr_len(xdr, savep, attrlen); |
3127 | xdr_error: | 3127 | xdr_error: |
3128 | dprintk("%s: xdr returned %d!\n", __FUNCTION__, -status); | 3128 | dprintk("%s: xdr returned %d!\n", __func__, -status); |
3129 | return status; | 3129 | return status; |
3130 | } | 3130 | } |
3131 | 3131 | ||
@@ -3193,7 +3193,7 @@ static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, cons | |||
3193 | if ((status = verify_attr_len(xdr, savep, attrlen)) == 0) | 3193 | if ((status = verify_attr_len(xdr, savep, attrlen)) == 0) |
3194 | fattr->valid = NFS_ATTR_FATTR | NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4; | 3194 | fattr->valid = NFS_ATTR_FATTR | NFS_ATTR_FATTR_V3 | NFS_ATTR_FATTR_V4; |
3195 | xdr_error: | 3195 | xdr_error: |
3196 | dprintk("%s: xdr returned %d\n", __FUNCTION__, -status); | 3196 | dprintk("%s: xdr returned %d\n", __func__, -status); |
3197 | return status; | 3197 | return status; |
3198 | } | 3198 | } |
3199 | 3199 | ||
@@ -3226,7 +3226,7 @@ static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo) | |||
3226 | 3226 | ||
3227 | status = verify_attr_len(xdr, savep, attrlen); | 3227 | status = verify_attr_len(xdr, savep, attrlen); |
3228 | xdr_error: | 3228 | xdr_error: |
3229 | dprintk("%s: xdr returned %d!\n", __FUNCTION__, -status); | 3229 | dprintk("%s: xdr returned %d!\n", __func__, -status); |
3230 | return status; | 3230 | return status; |
3231 | } | 3231 | } |
3232 | 3232 | ||
@@ -3418,7 +3418,7 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3418 | 3418 | ||
3419 | return decode_delegation(xdr, res); | 3419 | return decode_delegation(xdr, res); |
3420 | xdr_error: | 3420 | xdr_error: |
3421 | dprintk("%s: Bitmap too large! Length = %u\n", __FUNCTION__, bmlen); | 3421 | dprintk("%s: Bitmap too large! Length = %u\n", __func__, bmlen); |
3422 | return -EIO; | 3422 | return -EIO; |
3423 | } | 3423 | } |
3424 | 3424 | ||
@@ -3575,7 +3575,7 @@ short_pkt: | |||
3575 | * the call was successful, but incomplete. The caller can retry the | 3575 | * the call was successful, but incomplete. The caller can retry the |
3576 | * readdir starting at the last cookie. | 3576 | * readdir starting at the last cookie. |
3577 | */ | 3577 | */ |
3578 | dprintk("%s: short packet at entry %d\n", __FUNCTION__, nr); | 3578 | dprintk("%s: short packet at entry %d\n", __func__, nr); |
3579 | entry[0] = entry[1] = 0; | 3579 | entry[0] = entry[1] = 0; |
3580 | if (nr) | 3580 | if (nr) |
3581 | goto out; | 3581 | goto out; |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 5ccf7faee19c..03599bfe81cf 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -63,17 +63,17 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, | |||
63 | }; | 63 | }; |
64 | int status; | 64 | int status; |
65 | 65 | ||
66 | dprintk("%s: call getattr\n", __FUNCTION__); | 66 | dprintk("%s: call getattr\n", __func__); |
67 | nfs_fattr_init(fattr); | 67 | nfs_fattr_init(fattr); |
68 | status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0); | 68 | status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0); |
69 | dprintk("%s: reply getattr: %d\n", __FUNCTION__, status); | 69 | dprintk("%s: reply getattr: %d\n", __func__, status); |
70 | if (status) | 70 | if (status) |
71 | return status; | 71 | return status; |
72 | dprintk("%s: call statfs\n", __FUNCTION__); | 72 | dprintk("%s: call statfs\n", __func__); |
73 | msg.rpc_proc = &nfs_procedures[NFSPROC_STATFS]; | 73 | msg.rpc_proc = &nfs_procedures[NFSPROC_STATFS]; |
74 | msg.rpc_resp = &fsinfo; | 74 | msg.rpc_resp = &fsinfo; |
75 | status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0); | 75 | status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0); |
76 | dprintk("%s: reply statfs: %d\n", __FUNCTION__, status); | 76 | dprintk("%s: reply statfs: %d\n", __func__, status); |
77 | if (status) | 77 | if (status) |
78 | return status; | 78 | return status; |
79 | info->rtmax = NFS_MAXDATA; | 79 | info->rtmax = NFS_MAXDATA; |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 16f57e0af999..40d17987d0e8 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -329,7 +329,7 @@ int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data) | |||
329 | { | 329 | { |
330 | int status; | 330 | int status; |
331 | 331 | ||
332 | dprintk("NFS: %s: %5u, (status %d)\n", __FUNCTION__, task->tk_pid, | 332 | dprintk("NFS: %s: %5u, (status %d)\n", __func__, task->tk_pid, |
333 | task->tk_status); | 333 | task->tk_status); |
334 | 334 | ||
335 | status = NFS_PROTO(data->inode)->read_done(task, data); | 335 | status = NFS_PROTO(data->inode)->read_done(task, data); |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 7226a506f3ca..2a4a024a4e7b 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -405,7 +405,7 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
405 | return 0; | 405 | return 0; |
406 | 406 | ||
407 | out_err: | 407 | out_err: |
408 | dprintk("%s: statfs error = %d\n", __FUNCTION__, -error); | 408 | dprintk("%s: statfs error = %d\n", __func__, -error); |
409 | unlock_kernel(); | 409 | unlock_kernel(); |
410 | return error; | 410 | return error; |
411 | } | 411 | } |
@@ -2015,6 +2015,10 @@ static int nfs4_get_sb(struct file_system_type *fs_type, | |||
2015 | goto error_splat_super; | 2015 | goto error_splat_super; |
2016 | } | 2016 | } |
2017 | 2017 | ||
2018 | error = security_sb_set_mnt_opts(s, &data.lsm_opts); | ||
2019 | if (error) | ||
2020 | goto error_splat_root; | ||
2021 | |||
2018 | s->s_flags |= MS_ACTIVE; | 2022 | s->s_flags |= MS_ACTIVE; |
2019 | mnt->mnt_sb = s; | 2023 | mnt->mnt_sb = s; |
2020 | mnt->mnt_root = mntroot; | 2024 | mnt->mnt_root = mntroot; |
@@ -2031,6 +2035,8 @@ out_free: | |||
2031 | nfs_free_server(server); | 2035 | nfs_free_server(server); |
2032 | goto out; | 2036 | goto out; |
2033 | 2037 | ||
2038 | error_splat_root: | ||
2039 | dput(mntroot); | ||
2034 | error_splat_super: | 2040 | error_splat_super: |
2035 | up_write(&s->s_umount); | 2041 | up_write(&s->s_umount); |
2036 | deactivate_super(s); | 2042 | deactivate_super(s); |
@@ -2114,6 +2120,8 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags, | |||
2114 | mnt->mnt_sb = s; | 2120 | mnt->mnt_sb = s; |
2115 | mnt->mnt_root = mntroot; | 2121 | mnt->mnt_root = mntroot; |
2116 | 2122 | ||
2123 | security_sb_clone_mnt_opts(data->sb, s); | ||
2124 | |||
2117 | dprintk("<-- nfs4_xdev_get_sb() = 0\n"); | 2125 | dprintk("<-- nfs4_xdev_get_sb() = 0\n"); |
2118 | return 0; | 2126 | return 0; |
2119 | 2127 | ||
@@ -2197,6 +2205,8 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags, | |||
2197 | mnt->mnt_sb = s; | 2205 | mnt->mnt_sb = s; |
2198 | mnt->mnt_root = mntroot; | 2206 | mnt->mnt_root = mntroot; |
2199 | 2207 | ||
2208 | security_sb_clone_mnt_opts(data->sb, s); | ||
2209 | |||
2200 | dprintk("<-- nfs4_referral_get_sb() = 0\n"); | 2210 | dprintk("<-- nfs4_referral_get_sb() = 0\n"); |
2201 | return 0; | 2211 | return 0; |
2202 | 2212 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 1ade11d1ba07..6d8ace3e3259 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -415,7 +415,7 @@ nfs_dirty_request(struct nfs_page *req) | |||
415 | 415 | ||
416 | if (page == NULL || test_bit(PG_NEED_COMMIT, &req->wb_flags)) | 416 | if (page == NULL || test_bit(PG_NEED_COMMIT, &req->wb_flags)) |
417 | return 0; | 417 | return 0; |
418 | return !PageWriteback(req->wb_page); | 418 | return !PageWriteback(page); |
419 | } | 419 | } |
420 | 420 | ||
421 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 421 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index 0b3ffa9840c2..4d4760e687c3 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -419,9 +419,9 @@ static int do_probe_callback(void *data) | |||
419 | out_release_client: | 419 | out_release_client: |
420 | rpc_shutdown_client(client); | 420 | rpc_shutdown_client(client); |
421 | out_err: | 421 | out_err: |
422 | put_nfs4_client(clp); | ||
423 | dprintk("NFSD: warning: no callback path to client %.*s\n", | 422 | dprintk("NFSD: warning: no callback path to client %.*s\n", |
424 | (int)clp->cl_name.len, clp->cl_name.data); | 423 | (int)clp->cl_name.len, clp->cl_name.data); |
424 | put_nfs4_client(clp); | ||
425 | return status; | 425 | return status; |
426 | } | 426 | } |
427 | 427 | ||
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 41f84c92094f..10bfb466e068 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -2788,7 +2788,7 @@ static int ocfs2_merge_rec_right(struct inode *inode, | |||
2788 | BUG_ON(index >= le16_to_cpu(el->l_next_free_rec)); | 2788 | BUG_ON(index >= le16_to_cpu(el->l_next_free_rec)); |
2789 | left_rec = &el->l_recs[index]; | 2789 | left_rec = &el->l_recs[index]; |
2790 | 2790 | ||
2791 | if (index == le16_to_cpu(el->l_next_free_rec - 1) && | 2791 | if (index == le16_to_cpu(el->l_next_free_rec) - 1 && |
2792 | le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count)) { | 2792 | le16_to_cpu(el->l_next_free_rec) == le16_to_cpu(el->l_count)) { |
2793 | /* we meet with a cross extent block merge. */ | 2793 | /* we meet with a cross extent block merge. */ |
2794 | ret = ocfs2_get_right_path(inode, left_path, &right_path); | 2794 | ret = ocfs2_get_right_path(inode, left_path, &right_path); |
@@ -2802,7 +2802,7 @@ static int ocfs2_merge_rec_right(struct inode *inode, | |||
2802 | BUG_ON(next_free <= 0); | 2802 | BUG_ON(next_free <= 0); |
2803 | right_rec = &right_el->l_recs[0]; | 2803 | right_rec = &right_el->l_recs[0]; |
2804 | if (ocfs2_is_empty_extent(right_rec)) { | 2804 | if (ocfs2_is_empty_extent(right_rec)) { |
2805 | BUG_ON(le16_to_cpu(next_free) <= 1); | 2805 | BUG_ON(next_free <= 1); |
2806 | right_rec = &right_el->l_recs[1]; | 2806 | right_rec = &right_el->l_recs[1]; |
2807 | } | 2807 | } |
2808 | 2808 | ||
diff --git a/fs/proc/base.c b/fs/proc/base.c index 808cbdc193d3..c447e0743a3c 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2441,7 +2441,7 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2441 | REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), | 2441 | REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), |
2442 | #ifdef CONFIG_AUDITSYSCALL | 2442 | #ifdef CONFIG_AUDITSYSCALL |
2443 | REG("loginuid", S_IWUSR|S_IRUGO, loginuid), | 2443 | REG("loginuid", S_IWUSR|S_IRUGO, loginuid), |
2444 | REG("sessionid", S_IRUSR, sessionid), | 2444 | REG("sessionid", S_IRUGO, sessionid), |
2445 | #endif | 2445 | #endif |
2446 | #ifdef CONFIG_FAULT_INJECTION | 2446 | #ifdef CONFIG_FAULT_INJECTION |
2447 | REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), | 2447 | REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index a1c3a1fab7f0..8c0e4b92574f 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -419,12 +419,8 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, | |||
419 | */ | 419 | */ |
420 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | 420 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) |
421 | { | 421 | { |
422 | if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) { | 422 | if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) |
423 | printk(KERN_WARNING "sysfs: duplicate filename '%s' " | ||
424 | "can not be created\n", sd->s_name); | ||
425 | WARN_ON(1); | ||
426 | return -EEXIST; | 423 | return -EEXIST; |
427 | } | ||
428 | 424 | ||
429 | sd->s_parent = sysfs_get(acxt->parent_sd); | 425 | sd->s_parent = sysfs_get(acxt->parent_sd); |
430 | 426 | ||