aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/fid.h15
-rw-r--r--fs/9p/v9fs.c57
-rw-r--r--fs/9p/v9fs.h85
-rw-r--r--fs/9p/vfs_addr.c2
-rw-r--r--fs/9p/vfs_dir.c2
-rw-r--r--fs/9p/vfs_file.c11
-rw-r--r--fs/9p/vfs_inode.c50
-rw-r--r--fs/9p/vfs_super.c35
-rw-r--r--fs/befs/endian.h2
-rw-r--r--fs/binfmt_elf.c9
-rw-r--r--fs/cifs/cifspdu.h1
-rw-r--r--fs/cifs/cifssmb.c16
-rw-r--r--fs/cifs/connect.c79
-rw-r--r--fs/cifs/dir.c16
-rw-r--r--fs/cifs/inode.c35
-rw-r--r--fs/compat.c4
-rw-r--r--fs/dlm/lowcomms.c27
-rw-r--r--fs/dlm/netlink.c2
-rw-r--r--fs/dlm/plock.c2
-rw-r--r--fs/dquot.c10
-rw-r--r--fs/ecryptfs/inode.c13
-rw-r--r--fs/ecryptfs/miscdev.c2
-rw-r--r--fs/exec.c14
-rw-r--r--fs/ext3/xattr.c5
-rw-r--r--fs/ext4/balloc.c17
-rw-r--r--fs/ext4/mballoc.c72
-rw-r--r--fs/ext4/super.c80
-rw-r--r--fs/ext4/xattr.c5
-rw-r--r--fs/file.c152
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/fuse/fuse_i.h3
-rw-r--r--fs/fuse/inode.c5
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hppfs/Makefile6
-rw-r--r--fs/hppfs/hppfs.c (renamed from fs/hppfs/hppfs_kern.c)82
-rw-r--r--fs/jbd/commit.c2
-rw-r--r--fs/jbd2/commit.c2
-rw-r--r--fs/jbd2/journal.c4
-rw-r--r--fs/namei.c12
-rw-r--r--fs/nfs/callback.c2
-rw-r--r--fs/nfs/callback_proc.c4
-rw-r--r--fs/nfs/callback_xdr.c40
-rw-r--r--fs/nfs/client.c8
-rw-r--r--fs/nfs/delegation.c4
-rw-r--r--fs/nfs/dir.c18
-rw-r--r--fs/nfs/file.c2
-rw-r--r--fs/nfs/inode.c14
-rw-r--r--fs/nfs/namespace.c11
-rw-r--r--fs/nfs/nfs3proc.c6
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4namespace.c12
-rw-r--r--fs/nfs/nfs4proc.c38
-rw-r--r--fs/nfs/nfs4renewd.c10
-rw-r--r--fs/nfs/nfs4state.c8
-rw-r--r--fs/nfs/nfs4xdr.c100
-rw-r--r--fs/nfs/proc.c8
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/super.c12
-rw-r--r--fs/nfs/write.c2
-rw-r--r--fs/proc/array.c1
-rw-r--r--fs/proc/base.c2
-rw-r--r--fs/ufs/ufs.h1
62 files changed, 804 insertions, 442 deletions
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index 26e07df783b..c3bbd6af996 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -22,6 +22,21 @@
22 22
23#include <linux/list.h> 23#include <linux/list.h>
24 24
25/**
26 * struct v9fs_dentry - 9p private data stored in dentry d_fsdata
27 * @lock: protects the fidlist
28 * @fidlist: list of FIDs currently associated with this dentry
29 *
30 * This structure defines the 9p private data associated with
31 * a particular dentry. In particular, this private data is used
32 * to lookup which 9P FID handle should be used for a particular VFS
33 * operation. FID handles are associated with dentries instead of
34 * inodes in order to more closely map functionality to the Plan 9
35 * expected behavior for FID reclaimation and tracking.
36 *
37 * See Also: Mapping FIDs to Linux VFS model in
38 * Design and Implementation of the Linux 9P File System documentation
39 */
25struct v9fs_dentry { 40struct v9fs_dentry {
26 spinlock_t lock; /* protect fidlist */ 41 spinlock_t lock; /* protect fidlist */
27 struct list_head fidlist; 42 struct list_head fidlist;
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 9b0f0222e8b..047c791427a 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -71,19 +71,19 @@ static match_table_t tokens = {
71 71
72/** 72/**
73 * v9fs_parse_options - parse mount options into session structure 73 * v9fs_parse_options - parse mount options into session structure
74 * @options: options string passed from mount
75 * @v9ses: existing v9fs session information 74 * @v9ses: existing v9fs session information
76 * 75 *
76 * Return 0 upon success, -ERRNO upon failure.
77 */ 77 */
78 78
79static void v9fs_parse_options(struct v9fs_session_info *v9ses) 79static int v9fs_parse_options(struct v9fs_session_info *v9ses)
80{ 80{
81 char *options; 81 char *options;
82 substring_t args[MAX_OPT_ARGS]; 82 substring_t args[MAX_OPT_ARGS];
83 char *p; 83 char *p;
84 int option = 0; 84 int option = 0;
85 char *s, *e; 85 char *s, *e;
86 int ret; 86 int ret = 0;
87 87
88 /* setup defaults */ 88 /* setup defaults */
89 v9ses->afid = ~0; 89 v9ses->afid = ~0;
@@ -91,19 +91,26 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
91 v9ses->cache = 0; 91 v9ses->cache = 0;
92 92
93 if (!v9ses->options) 93 if (!v9ses->options)
94 return; 94 return 0;
95 95
96 options = kstrdup(v9ses->options, GFP_KERNEL); 96 options = kstrdup(v9ses->options, GFP_KERNEL);
97 if (!options) {
98 P9_DPRINTK(P9_DEBUG_ERROR,
99 "failed to allocate copy of option string\n");
100 return -ENOMEM;
101 }
102
97 while ((p = strsep(&options, ",")) != NULL) { 103 while ((p = strsep(&options, ",")) != NULL) {
98 int token; 104 int token;
99 if (!*p) 105 if (!*p)
100 continue; 106 continue;
101 token = match_token(p, tokens, args); 107 token = match_token(p, tokens, args);
102 if (token < Opt_uname) { 108 if (token < Opt_uname) {
103 ret = match_int(&args[0], &option); 109 int r = match_int(&args[0], &option);
104 if (ret < 0) { 110 if (r < 0) {
105 P9_DPRINTK(P9_DEBUG_ERROR, 111 P9_DPRINTK(P9_DEBUG_ERROR,
106 "integer field, but no integer?\n"); 112 "integer field, but no integer?\n");
113 ret = r;
107 continue; 114 continue;
108 } 115 }
109 } 116 }
@@ -125,10 +132,10 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
125 v9ses->afid = option; 132 v9ses->afid = option;
126 break; 133 break;
127 case Opt_uname: 134 case Opt_uname:
128 match_strcpy(v9ses->uname, &args[0]); 135 match_strlcpy(v9ses->uname, &args[0], PATH_MAX);
129 break; 136 break;
130 case Opt_remotename: 137 case Opt_remotename:
131 match_strcpy(v9ses->aname, &args[0]); 138 match_strlcpy(v9ses->aname, &args[0], PATH_MAX);
132 break; 139 break;
133 case Opt_nodevmap: 140 case Opt_nodevmap:
134 v9ses->nodev = 1; 141 v9ses->nodev = 1;
@@ -139,6 +146,13 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
139 146
140 case Opt_access: 147 case Opt_access:
141 s = match_strdup(&args[0]); 148 s = match_strdup(&args[0]);
149 if (!s) {
150 P9_DPRINTK(P9_DEBUG_ERROR,
151 "failed to allocate copy"
152 " of option argument\n");
153 ret = -ENOMEM;
154 break;
155 }
142 v9ses->flags &= ~V9FS_ACCESS_MASK; 156 v9ses->flags &= ~V9FS_ACCESS_MASK;
143 if (strcmp(s, "user") == 0) 157 if (strcmp(s, "user") == 0)
144 v9ses->flags |= V9FS_ACCESS_USER; 158 v9ses->flags |= V9FS_ACCESS_USER;
@@ -158,6 +172,7 @@ static void v9fs_parse_options(struct v9fs_session_info *v9ses)
158 } 172 }
159 } 173 }
160 kfree(options); 174 kfree(options);
175 return ret;
161} 176}
162 177
163/** 178/**
@@ -173,6 +188,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
173{ 188{
174 int retval = -EINVAL; 189 int retval = -EINVAL;
175 struct p9_fid *fid; 190 struct p9_fid *fid;
191 int rc;
176 192
177 v9ses->uname = __getname(); 193 v9ses->uname = __getname();
178 if (!v9ses->uname) 194 if (!v9ses->uname)
@@ -190,8 +206,21 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
190 v9ses->uid = ~0; 206 v9ses->uid = ~0;
191 v9ses->dfltuid = V9FS_DEFUID; 207 v9ses->dfltuid = V9FS_DEFUID;
192 v9ses->dfltgid = V9FS_DEFGID; 208 v9ses->dfltgid = V9FS_DEFGID;
193 v9ses->options = kstrdup(data, GFP_KERNEL); 209 if (data) {
194 v9fs_parse_options(v9ses); 210 v9ses->options = kstrdup(data, GFP_KERNEL);
211 if (!v9ses->options) {
212 P9_DPRINTK(P9_DEBUG_ERROR,
213 "failed to allocate copy of option string\n");
214 retval = -ENOMEM;
215 goto error;
216 }
217 }
218
219 rc = v9fs_parse_options(v9ses);
220 if (rc < 0) {
221 retval = rc;
222 goto error;
223 }
195 224
196 v9ses->clnt = p9_client_create(dev_name, v9ses->options); 225 v9ses->clnt = p9_client_create(dev_name, v9ses->options);
197 226
@@ -233,7 +262,6 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
233 return fid; 262 return fid;
234 263
235error: 264error:
236 v9fs_session_close(v9ses);
237 return ERR_PTR(retval); 265 return ERR_PTR(retval);
238} 266}
239 267
@@ -256,9 +284,12 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
256} 284}
257 285
258/** 286/**
259 * v9fs_session_cancel - mark transport as disconnected 287 * v9fs_session_cancel - terminate a session
260 * and cancel all pending requests. 288 * @v9ses: session to terminate
289 *
290 * mark transport as disconnected and cancel all pending requests.
261 */ 291 */
292
262void v9fs_session_cancel(struct v9fs_session_info *v9ses) { 293void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
263 P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses); 294 P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
264 p9_client_disconnect(v9ses->clnt); 295 p9_client_disconnect(v9ses->clnt);
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index 7d3a1018db5..a7d56719299 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -21,18 +21,69 @@
21 * 21 *
22 */ 22 */
23 23
24/* 24/**
25 * Session structure provides information for an opened session 25 * enum p9_session_flags - option flags for each 9P session
26 * 26 * @V9FS_EXTENDED: whether or not to use 9P2000.u extensions
27 */ 27 * @V9FS_ACCESS_SINGLE: only the mounting user can access the hierarchy
28 * @V9FS_ACCESS_USER: a new attach will be issued for every user (default)
29 * @V9FS_ACCESS_ANY: use a single attach for all users
30 * @V9FS_ACCESS_MASK: bit mask of different ACCESS options
31 *
32 * Session flags reflect options selected by users at mount time
33 */
34enum p9_session_flags {
35 V9FS_EXTENDED = 0x01,
36 V9FS_ACCESS_SINGLE = 0x02,
37 V9FS_ACCESS_USER = 0x04,
38 V9FS_ACCESS_ANY = 0x06,
39 V9FS_ACCESS_MASK = 0x06,
40};
41
42/* possible values of ->cache */
43/**
44 * enum p9_cache_modes - user specified cache preferences
45 * @CACHE_NONE: do not cache data, dentries, or directory contents (default)
46 * @CACHE_LOOSE: cache data, dentries, and directory contents w/no consistency
47 *
48 * eventually support loose, tight, time, session, default always none
49 */
50
51enum p9_cache_modes {
52 CACHE_NONE,
53 CACHE_LOOSE,
54};
55
56/**
57 * struct v9fs_session_info - per-instance session information
58 * @flags: session options of type &p9_session_flags
59 * @nodev: set to 1 to disable device mapping
60 * @debug: debug level
61 * @afid: authentication handle
62 * @cache: cache mode of type &p9_cache_modes
63 * @options: copy of options string given by user
64 * @uname: string user name to mount hierarchy as
65 * @aname: mount specifier for remote hierarchy
66 * @maxdata: maximum data to be sent/recvd per protocol message
67 * @dfltuid: default numeric userid to mount hierarchy as
68 * @dfltgid: default numeric groupid to mount hierarchy as
69 * @uid: if %V9FS_ACCESS_SINGLE, the numeric uid which mounted the hierarchy
70 * @clnt: reference to 9P network client instantiated for this session
71 * @debugfs_dir: reference to debugfs_dir which can be used for add'l debug
72 *
73 * This structure holds state for each session instance established during
74 * a sys_mount() .
75 *
76 * Bugs: there seems to be a lot of state which could be condensed and/or
77 * removed.
78 */
28 79
29struct v9fs_session_info { 80struct v9fs_session_info {
30 /* options */ 81 /* options */
31 unsigned char flags; /* session flags */ 82 unsigned char flags;
32 unsigned char nodev; /* set to 1 if no disable device mapping */ 83 unsigned char nodev;
33 unsigned short debug; /* debug level */ 84 unsigned short debug;
34 unsigned int afid; /* authentication fid */ 85 unsigned int afid;
35 unsigned int cache; /* cache mode */ 86 unsigned int cache;
36 87
37 char *options; /* copy of mount options */ 88 char *options; /* copy of mount options */
38 char *uname; /* user name to mount as */ 89 char *uname; /* user name to mount as */
@@ -45,22 +96,6 @@ struct v9fs_session_info {
45 struct dentry *debugfs_dir; 96 struct dentry *debugfs_dir;
46}; 97};
47 98
48/* session flags */
49enum {
50 V9FS_EXTENDED = 0x01, /* 9P2000.u */
51 V9FS_ACCESS_MASK = 0x06, /* access mask */
52 V9FS_ACCESS_SINGLE = 0x02, /* only one user can access the files */
53 V9FS_ACCESS_USER = 0x04, /* attache per user */
54 V9FS_ACCESS_ANY = 0x06, /* use the same attach for all users */
55};
56
57/* possible values of ->cache */
58/* eventually support loose, tight, time, session, default always none */
59enum {
60 CACHE_NONE, /* default */
61 CACHE_LOOSE, /* no consistency */
62};
63
64extern struct dentry *v9fs_debugfs_root; 99extern struct dentry *v9fs_debugfs_root;
65 100
66struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, 101struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *,
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 6248f0e727a..97d3aed5798 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -43,7 +43,7 @@
43/** 43/**
44 * v9fs_vfs_readpage - read an entire page in from 9P 44 * v9fs_vfs_readpage - read an entire page in from 9P
45 * 45 *
46 * @file: file being read 46 * @filp: file being read
47 * @page: structure to page 47 * @page: structure to page
48 * 48 *
49 */ 49 */
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 0924d4477da..88e3787c6ea 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -60,7 +60,7 @@ static inline int dt_type(struct p9_stat *mistat)
60 60
61/** 61/**
62 * v9fs_dir_readdir - read a directory 62 * v9fs_dir_readdir - read a directory
63 * @filep: opened file structure 63 * @filp: opened file structure
64 * @dirent: directory structure ??? 64 * @dirent: directory structure ???
65 * @filldir: function to populate directory structure ??? 65 * @filldir: function to populate directory structure ???
66 * 66 *
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index a616fff8906..0d55affe37d 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -90,10 +90,11 @@ int v9fs_file_open(struct inode *inode, struct file *file)
90 90
91/** 91/**
92 * v9fs_file_lock - lock a file (or directory) 92 * v9fs_file_lock - lock a file (or directory)
93 * @inode: inode to be opened 93 * @filp: file to be locked
94 * @file: file being opened 94 * @cmd: lock command
95 * @fl: file lock structure
95 * 96 *
96 * XXX - this looks like a local only lock, we should extend into 9P 97 * Bugs: this looks like a local only lock, we should extend into 9P
97 * by using open exclusive 98 * by using open exclusive
98 */ 99 */
99 100
@@ -118,7 +119,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
118 119
119/** 120/**
120 * v9fs_file_read - read from a file 121 * v9fs_file_read - read from a file
121 * @filep: file pointer to read 122 * @filp: file pointer to read
122 * @data: data buffer to read data into 123 * @data: data buffer to read data into
123 * @count: size of buffer 124 * @count: size of buffer
124 * @offset: offset at which to read data 125 * @offset: offset at which to read data
@@ -142,7 +143,7 @@ v9fs_file_read(struct file *filp, char __user * data, size_t count,
142 143
143/** 144/**
144 * v9fs_file_write - write to a file 145 * v9fs_file_write - write to a file
145 * @filep: file pointer to write 146 * @filp: file pointer to write
146 * @data: data buffer to write data from 147 * @data: data buffer to write data from
147 * @count: size of buffer 148 * @count: size of buffer
148 * @offset: offset at which to write data 149 * @offset: offset at which to write data
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 6a28842052e..40fa807bd92 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -129,6 +129,12 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode)
129 return res; 129 return res;
130} 130}
131 131
132/**
133 * v9fs_uflags2omode- convert posix open flags to plan 9 mode bits
134 * @uflags: flags to convert
135 *
136 */
137
132int v9fs_uflags2omode(int uflags) 138int v9fs_uflags2omode(int uflags)
133{ 139{
134 int ret; 140 int ret;
@@ -312,6 +318,14 @@ error:
312} 318}
313*/ 319*/
314 320
321/**
322 * v9fs_inode_from_fid - populate an inode by issuing a attribute request
323 * @v9ses: session information
324 * @fid: fid to issue attribute request for
325 * @sb: superblock on which to create inode
326 *
327 */
328
315static struct inode * 329static struct inode *
316v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, 330v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
317 struct super_block *sb) 331 struct super_block *sb)
@@ -384,9 +398,12 @@ v9fs_open_created(struct inode *inode, struct file *file)
384 398
385/** 399/**
386 * v9fs_create - Create a file 400 * v9fs_create - Create a file
401 * @v9ses: session information
402 * @dir: directory that dentry is being created in
387 * @dentry: dentry that is being created 403 * @dentry: dentry that is being created
388 * @perm: create permissions 404 * @perm: create permissions
389 * @mode: open mode 405 * @mode: open mode
406 * @extension: 9p2000.u extension string to support devices, etc.
390 * 407 *
391 */ 408 */
392static struct p9_fid * 409static struct p9_fid *
@@ -461,7 +478,7 @@ error:
461 478
462/** 479/**
463 * v9fs_vfs_create - VFS hook to create files 480 * v9fs_vfs_create - VFS hook to create files
464 * @inode: directory inode that is being created 481 * @dir: directory inode that is being created
465 * @dentry: dentry that is being deleted 482 * @dentry: dentry that is being deleted
466 * @mode: create permissions 483 * @mode: create permissions
467 * @nd: path information 484 * @nd: path information
@@ -519,7 +536,7 @@ error:
519 536
520/** 537/**
521 * v9fs_vfs_mkdir - VFS mkdir hook to create a directory 538 * v9fs_vfs_mkdir - VFS mkdir hook to create a directory
522 * @inode: inode that is being unlinked 539 * @dir: inode that is being unlinked
523 * @dentry: dentry that is being unlinked 540 * @dentry: dentry that is being unlinked
524 * @mode: mode for new directory 541 * @mode: mode for new directory
525 * 542 *
@@ -703,9 +720,9 @@ done:
703 720
704/** 721/**
705 * v9fs_vfs_getattr - retrieve file metadata 722 * v9fs_vfs_getattr - retrieve file metadata
706 * @mnt - mount information 723 * @mnt: mount information
707 * @dentry - file to get attributes on 724 * @dentry: file to get attributes on
708 * @stat - metadata structure to populate 725 * @stat: metadata structure to populate
709 * 726 *
710 */ 727 */
711 728
@@ -928,7 +945,7 @@ done:
928/** 945/**
929 * v9fs_vfs_readlink - read a symlink's location 946 * v9fs_vfs_readlink - read a symlink's location
930 * @dentry: dentry for symlink 947 * @dentry: dentry for symlink
931 * @buf: buffer to load symlink location into 948 * @buffer: buffer to load symlink location into
932 * @buflen: length of buffer 949 * @buflen: length of buffer
933 * 950 *
934 */ 951 */
@@ -996,10 +1013,12 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
996 * v9fs_vfs_put_link - release a symlink path 1013 * v9fs_vfs_put_link - release a symlink path
997 * @dentry: dentry for symlink 1014 * @dentry: dentry for symlink
998 * @nd: nameidata 1015 * @nd: nameidata
1016 * @p: unused
999 * 1017 *
1000 */ 1018 */
1001 1019
1002static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p) 1020static void
1021v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
1003{ 1022{
1004 char *s = nd_get_link(nd); 1023 char *s = nd_get_link(nd);
1005 1024
@@ -1008,6 +1027,15 @@ static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void
1008 __putname(s); 1027 __putname(s);
1009} 1028}
1010 1029
1030/**
1031 * v9fs_vfs_mkspecial - create a special file
1032 * @dir: inode to create special file in
1033 * @dentry: dentry to create
1034 * @mode: mode to create special file
1035 * @extension: 9p2000.u format extension string representing special file
1036 *
1037 */
1038
1011static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, 1039static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1012 int mode, const char *extension) 1040 int mode, const char *extension)
1013{ 1041{
@@ -1037,7 +1065,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1037 * @dentry: dentry for symlink 1065 * @dentry: dentry for symlink
1038 * @symname: symlink data 1066 * @symname: symlink data
1039 * 1067 *
1040 * See 9P2000.u RFC for more information 1068 * See Also: 9P2000.u RFC for more information
1041 * 1069 *
1042 */ 1070 */
1043 1071
@@ -1058,10 +1086,6 @@ v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
1058 * 1086 *
1059 */ 1087 */
1060 1088
1061/* XXX - lots of code dup'd from symlink and creates,
1062 * figure out a better reuse strategy
1063 */
1064
1065static int 1089static int
1066v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, 1090v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1067 struct dentry *dentry) 1091 struct dentry *dentry)
@@ -1098,7 +1122,7 @@ clunk_fid:
1098 * @dir: inode destination for new link 1122 * @dir: inode destination for new link
1099 * @dentry: dentry for file 1123 * @dentry: dentry for file
1100 * @mode: mode for creation 1124 * @mode: mode for creation
1101 * @dev_t: device associated with special file 1125 * @rdev: device associated with special file
1102 * 1126 *
1103 */ 1127 */
1104 1128
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index a452ac67fc9..bf59c396049 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -75,6 +75,7 @@ static int v9fs_set_super(struct super_block *s, void *data)
75 * v9fs_fill_super - populate superblock with info 75 * v9fs_fill_super - populate superblock with info
76 * @sb: superblock 76 * @sb: superblock
77 * @v9ses: session information 77 * @v9ses: session information
78 * @flags: flags propagated from v9fs_get_sb()
78 * 79 *
79 */ 80 */
80 81
@@ -127,29 +128,26 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
127 fid = v9fs_session_init(v9ses, dev_name, data); 128 fid = v9fs_session_init(v9ses, dev_name, data);
128 if (IS_ERR(fid)) { 129 if (IS_ERR(fid)) {
129 retval = PTR_ERR(fid); 130 retval = PTR_ERR(fid);
130 fid = NULL; 131 goto close_session;
131 kfree(v9ses);
132 v9ses = NULL;
133 goto error;
134 } 132 }
135 133
136 st = p9_client_stat(fid); 134 st = p9_client_stat(fid);
137 if (IS_ERR(st)) { 135 if (IS_ERR(st)) {
138 retval = PTR_ERR(st); 136 retval = PTR_ERR(st);
139 goto error; 137 goto clunk_fid;
140 } 138 }
141 139
142 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 140 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
143 if (IS_ERR(sb)) { 141 if (IS_ERR(sb)) {
144 retval = PTR_ERR(sb); 142 retval = PTR_ERR(sb);
145 goto error; 143 goto free_stat;
146 } 144 }
147 v9fs_fill_super(sb, v9ses, flags); 145 v9fs_fill_super(sb, v9ses, flags);
148 146
149 inode = v9fs_get_inode(sb, S_IFDIR | mode); 147 inode = v9fs_get_inode(sb, S_IFDIR | mode);
150 if (IS_ERR(inode)) { 148 if (IS_ERR(inode)) {
151 retval = PTR_ERR(inode); 149 retval = PTR_ERR(inode);
152 goto error; 150 goto release_sb;
153 } 151 }
154 152
155 inode->i_uid = uid; 153 inode->i_uid = uid;
@@ -158,7 +156,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
158 root = d_alloc_root(inode); 156 root = d_alloc_root(inode);
159 if (!root) { 157 if (!root) {
160 retval = -ENOMEM; 158 retval = -ENOMEM;
161 goto error; 159 goto release_sb;
162 } 160 }
163 161
164 sb->s_root = root; 162 sb->s_root = root;
@@ -169,21 +167,22 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
169 167
170 return simple_set_mnt(mnt, sb); 168 return simple_set_mnt(mnt, sb);
171 169
172error: 170release_sb:
173 kfree(st);
174 if (fid)
175 p9_client_clunk(fid);
176
177 if (v9ses) {
178 v9fs_session_close(v9ses);
179 kfree(v9ses);
180 }
181
182 if (sb) { 171 if (sb) {
183 up_write(&sb->s_umount); 172 up_write(&sb->s_umount);
184 deactivate_super(sb); 173 deactivate_super(sb);
185 } 174 }
186 175
176free_stat:
177 kfree(st);
178
179clunk_fid:
180 p9_client_clunk(fid);
181
182close_session:
183 v9fs_session_close(v9ses);
184 kfree(v9ses);
185
187 return retval; 186 return retval;
188} 187}
189 188
diff --git a/fs/befs/endian.h b/fs/befs/endian.h
index e254a20869f..6cb84d896d0 100644
--- a/fs/befs/endian.h
+++ b/fs/befs/endian.h
@@ -9,7 +9,7 @@
9#ifndef LINUX_BEFS_ENDIAN 9#ifndef LINUX_BEFS_ENDIAN
10#define LINUX_BEFS_ENDIAN 10#define LINUX_BEFS_ENDIAN
11 11
12#include <linux/byteorder/generic.h> 12#include <asm/byteorder.h>
13 13
14static inline u64 14static inline u64
15fs64_to_cpu(const struct super_block *sb, fs64 n) 15fs64_to_cpu(const struct super_block *sb, fs64 n)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index b25707fee2c..0fa95b198e6 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
2036cleanup: 2036cleanup:
2037 kfree(elf);
2038 free_note_info(&info); 2037 free_note_info(&info);
2038 kfree(elf);
2039out:
2039 return has_dumped; 2040 return has_dumped;
2040} 2041}
2041 2042
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index a0d26b540d4..c43bf4b7a55 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -340,6 +340,7 @@
340#define OPEN_NO_RECALL 0x00400000 340#define OPEN_NO_RECALL 0x00400000
341#define OPEN_FREE_SPACE_QUERY 0x00800000 /* should be zero */ 341#define OPEN_FREE_SPACE_QUERY 0x00800000 /* should be zero */
342#define CREATE_OPTIONS_MASK 0x007FFFFF 342#define CREATE_OPTIONS_MASK 0x007FFFFF
343#define CREATE_OPTION_READONLY 0x10000000
343#define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */ 344#define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */
344 345
345/* ImpersonationLevel flags */ 346/* ImpersonationLevel flags */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index cfd9750852b..95fbba4ea7d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1224,11 +1224,8 @@ OldOpenRetry:
1224 else /* BB FIXME BB */ 1224 else /* BB FIXME BB */
1225 pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); 1225 pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/);
1226 1226
1227 /* if ((omode & S_IWUGO) == 0) 1227 if (create_options & CREATE_OPTION_READONLY)
1228 pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ 1228 pSMB->FileAttributes |= cpu_to_le16(ATTR_READONLY);
1229 /* Above line causes problems due to vfs splitting create into two
1230 pieces - need to set mode after file created not while it is
1231 being created */
1232 1229
1233 /* BB FIXME BB */ 1230 /* BB FIXME BB */
1234/* pSMB->CreateOptions = cpu_to_le32(create_options & 1231/* pSMB->CreateOptions = cpu_to_le32(create_options &
@@ -1331,17 +1328,16 @@ openRetry:
1331 pSMB->FileAttributes = cpu_to_le32(ATTR_SYSTEM); 1328 pSMB->FileAttributes = cpu_to_le32(ATTR_SYSTEM);
1332 else 1329 else
1333 pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); 1330 pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL);
1331
1334 /* XP does not handle ATTR_POSIX_SEMANTICS */ 1332 /* XP does not handle ATTR_POSIX_SEMANTICS */
1335 /* but it helps speed up case sensitive checks for other 1333 /* but it helps speed up case sensitive checks for other
1336 servers such as Samba */ 1334 servers such as Samba */
1337 if (tcon->ses->capabilities & CAP_UNIX) 1335 if (tcon->ses->capabilities & CAP_UNIX)
1338 pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS); 1336 pSMB->FileAttributes |= cpu_to_le32(ATTR_POSIX_SEMANTICS);
1339 1337
1340 /* if ((omode & S_IWUGO) == 0) 1338 if (create_options & CREATE_OPTION_READONLY)
1341 pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);*/ 1339 pSMB->FileAttributes |= cpu_to_le32(ATTR_READONLY);
1342 /* Above line causes problems due to vfs splitting create into two 1340
1343 pieces - need to set mode after file created not while it is
1344 being created */
1345 pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL); 1341 pSMB->ShareAccess = cpu_to_le32(FILE_SHARE_ALL);
1346 pSMB->CreateDisposition = cpu_to_le32(openDisposition); 1342 pSMB->CreateDisposition = cpu_to_le32(openDisposition);
1347 pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK); 1343 pSMB->CreateOptions = cpu_to_le32(create_options & CREATE_OPTIONS_MASK);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 791ca5c1a11..f428bf3bf1a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -348,7 +348,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
348 int reconnect; 348 int reconnect;
349 349
350 current->flags |= PF_MEMALLOC; 350 current->flags |= PF_MEMALLOC;
351 server->tsk = current; /* save process info to wake at shutdown */
352 cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); 351 cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current)));
353 write_lock(&GlobalSMBSeslock); 352 write_lock(&GlobalSMBSeslock);
354 atomic_inc(&tcpSesAllocCount); 353 atomic_inc(&tcpSesAllocCount);
@@ -651,10 +650,20 @@ multi_t2_fnd:
651 650
652 spin_lock(&GlobalMid_Lock); 651 spin_lock(&GlobalMid_Lock);
653 server->tcpStatus = CifsExiting; 652 server->tcpStatus = CifsExiting;
654 server->tsk = NULL; 653 spin_unlock(&GlobalMid_Lock);
654
655 /* don't exit until kthread_stop is called */
656 set_current_state(TASK_UNINTERRUPTIBLE);
657 while (!kthread_should_stop()) {
658 schedule();
659 set_current_state(TASK_UNINTERRUPTIBLE);
660 }
661 set_current_state(TASK_RUNNING);
662
655 /* check if we have blocked requests that need to free */ 663 /* check if we have blocked requests that need to free */
656 /* Note that cifs_max_pending is normally 50, but 664 /* Note that cifs_max_pending is normally 50, but
657 can be set at module install time to as little as two */ 665 can be set at module install time to as little as two */
666 spin_lock(&GlobalMid_Lock);
658 if (atomic_read(&server->inFlight) >= cifs_max_pending) 667 if (atomic_read(&server->inFlight) >= cifs_max_pending)
659 atomic_set(&server->inFlight, cifs_max_pending - 1); 668 atomic_set(&server->inFlight, cifs_max_pending - 1);
660 /* We do not want to set the max_pending too low or we 669 /* We do not want to set the max_pending too low or we
@@ -1318,42 +1327,43 @@ cifs_parse_mount_options(char *options, const char *devname,
1318 1327
1319static struct cifsSesInfo * 1328static struct cifsSesInfo *
1320cifs_find_tcp_session(struct in_addr *target_ip_addr, 1329cifs_find_tcp_session(struct in_addr *target_ip_addr,
1321 struct in6_addr *target_ip6_addr, 1330 struct in6_addr *target_ip6_addr,
1322 char *userName, struct TCP_Server_Info **psrvTcp) 1331 char *userName, struct TCP_Server_Info **psrvTcp)
1323{ 1332{
1324 struct list_head *tmp; 1333 struct list_head *tmp;
1325 struct cifsSesInfo *ses; 1334 struct cifsSesInfo *ses;
1335
1326 *psrvTcp = NULL; 1336 *psrvTcp = NULL;
1327 read_lock(&GlobalSMBSeslock);
1328 1337
1338 read_lock(&GlobalSMBSeslock);
1329 list_for_each(tmp, &GlobalSMBSessionList) { 1339 list_for_each(tmp, &GlobalSMBSessionList) {
1330 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); 1340 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
1331 if (ses->server) { 1341 if (!ses->server)
1332 if ((target_ip_addr && 1342 continue;
1333 (ses->server->addr.sockAddr.sin_addr.s_addr 1343
1334 == target_ip_addr->s_addr)) || (target_ip6_addr 1344 if (target_ip_addr &&
1335 && memcmp(&ses->server->addr.sockAddr6.sin6_addr, 1345 ses->server->addr.sockAddr.sin_addr.s_addr != target_ip_addr->s_addr)
1336 target_ip6_addr, sizeof(*target_ip6_addr)))) { 1346 continue;
1337 /* BB lock server and tcp session and increment 1347 else if (target_ip6_addr &&
1338 use count here?? */ 1348 memcmp(&ses->server->addr.sockAddr6.sin6_addr,
1339 1349 target_ip6_addr, sizeof(*target_ip6_addr)))
1340 /* found a match on the TCP session */ 1350 continue;
1341 *psrvTcp = ses->server; 1351 /* BB lock server and tcp session; increment use count here?? */
1342 1352
1343 /* BB check if reconnection needed */ 1353 /* found a match on the TCP session */
1344 if (strncmp 1354 *psrvTcp = ses->server;
1345 (ses->userName, userName, 1355
1346 MAX_USERNAME_SIZE) == 0){ 1356 /* BB check if reconnection needed */
1347 read_unlock(&GlobalSMBSeslock); 1357 if (strncmp(ses->userName, userName, MAX_USERNAME_SIZE) == 0) {
1348 /* Found exact match on both TCP and 1358 read_unlock(&GlobalSMBSeslock);
1349 SMB sessions */ 1359 /* Found exact match on both TCP and
1350 return ses; 1360 SMB sessions */
1351 } 1361 return ses;
1352 }
1353 } 1362 }
1354 /* else tcp and smb sessions need reconnection */ 1363 /* else tcp and smb sessions need reconnection */
1355 } 1364 }
1356 read_unlock(&GlobalSMBSeslock); 1365 read_unlock(&GlobalSMBSeslock);
1366
1357 return NULL; 1367 return NULL;
1358} 1368}
1359 1369
@@ -2186,15 +2196,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2186 srvTcp->tcpStatus = CifsExiting; 2196 srvTcp->tcpStatus = CifsExiting;
2187 spin_unlock(&GlobalMid_Lock); 2197 spin_unlock(&GlobalMid_Lock);
2188 if (srvTcp->tsk) { 2198 if (srvTcp->tsk) {
2189 struct task_struct *tsk;
2190 /* If we could verify that kthread_stop would 2199 /* If we could verify that kthread_stop would
2191 always wake up processes blocked in 2200 always wake up processes blocked in
2192 tcp in recv_mesg then we could remove the 2201 tcp in recv_mesg then we could remove the
2193 send_sig call */ 2202 send_sig call */
2194 force_sig(SIGKILL, srvTcp->tsk); 2203 force_sig(SIGKILL, srvTcp->tsk);
2195 tsk = srvTcp->tsk; 2204 kthread_stop(srvTcp->tsk);
2196 if (tsk)
2197 kthread_stop(tsk);
2198 } 2205 }
2199 } 2206 }
2200 /* If find_unc succeeded then rc == 0 so we can not end */ 2207 /* If find_unc succeeded then rc == 0 so we can not end */
@@ -2210,23 +2217,17 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2210 if ((temp_rc == -ESHUTDOWN) && 2217 if ((temp_rc == -ESHUTDOWN) &&
2211 (pSesInfo->server) && 2218 (pSesInfo->server) &&
2212 (pSesInfo->server->tsk)) { 2219 (pSesInfo->server->tsk)) {
2213 struct task_struct *tsk;
2214 force_sig(SIGKILL, 2220 force_sig(SIGKILL,
2215 pSesInfo->server->tsk); 2221 pSesInfo->server->tsk);
2216 tsk = pSesInfo->server->tsk; 2222 kthread_stop(pSesInfo->server->tsk);
2217 if (tsk)
2218 kthread_stop(tsk);
2219 } 2223 }
2220 } else { 2224 } else {
2221 cFYI(1, ("No session or bad tcon")); 2225 cFYI(1, ("No session or bad tcon"));
2222 if ((pSesInfo->server) && 2226 if ((pSesInfo->server) &&
2223 (pSesInfo->server->tsk)) { 2227 (pSesInfo->server->tsk)) {
2224 struct task_struct *tsk;
2225 force_sig(SIGKILL, 2228 force_sig(SIGKILL,
2226 pSesInfo->server->tsk); 2229 pSesInfo->server->tsk);
2227 tsk = pSesInfo->server->tsk; 2230 kthread_stop(pSesInfo->server->tsk);
2228 if (tsk)
2229 kthread_stop(tsk);
2230 } 2231 }
2231 } 2232 }
2232 sesInfoFree(pSesInfo); 2233 sesInfoFree(pSesInfo);
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 6ed775986be..e4e0078a052 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -119,6 +119,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
119{ 119{
120 int rc = -ENOENT; 120 int rc = -ENOENT;
121 int xid; 121 int xid;
122 int create_options = CREATE_NOT_DIR;
122 int oplock = 0; 123 int oplock = 0;
123 int desiredAccess = GENERIC_READ | GENERIC_WRITE; 124 int desiredAccess = GENERIC_READ | GENERIC_WRITE;
124 __u16 fileHandle; 125 __u16 fileHandle;
@@ -176,9 +177,19 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
176 FreeXid(xid); 177 FreeXid(xid);
177 return -ENOMEM; 178 return -ENOMEM;
178 } 179 }
180
181 mode &= ~current->fs->umask;
182
183 /*
184 * if we're not using unix extensions, see if we need to set
185 * ATTR_READONLY on the create call
186 */
187 if (!pTcon->unix_ext && (mode & S_IWUGO) == 0)
188 create_options |= CREATE_OPTION_READONLY;
189
179 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) 190 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
180 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, 191 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
181 desiredAccess, CREATE_NOT_DIR, 192 desiredAccess, create_options,
182 &fileHandle, &oplock, buf, cifs_sb->local_nls, 193 &fileHandle, &oplock, buf, cifs_sb->local_nls,
183 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 194 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
184 else 195 else
@@ -187,7 +198,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
187 if (rc == -EIO) { 198 if (rc == -EIO) {
188 /* old server, retry the open legacy style */ 199 /* old server, retry the open legacy style */
189 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition, 200 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition,
190 desiredAccess, CREATE_NOT_DIR, 201 desiredAccess, create_options,
191 &fileHandle, &oplock, buf, cifs_sb->local_nls, 202 &fileHandle, &oplock, buf, cifs_sb->local_nls,
192 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 203 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
193 } 204 }
@@ -197,7 +208,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
197 /* If Open reported that we actually created a file 208 /* If Open reported that we actually created a file
198 then we now have to set the mode if possible */ 209 then we now have to set the mode if possible */
199 if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { 210 if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
200 mode &= ~current->fs->umask;
201 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 211 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
202 CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, 212 CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
203 (__u64)current->fsuid, 213 (__u64)current->fsuid,
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 0d9d2e6d7af..fcbdbb6ad7b 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -974,8 +974,8 @@ mkdir_get_info:
974 * failed to get it from the server or was set bogus */ 974 * failed to get it from the server or was set bogus */
975 if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2)) 975 if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2))
976 direntry->d_inode->i_nlink = 2; 976 direntry->d_inode->i_nlink = 2;
977 mode &= ~current->fs->umask;
977 if (pTcon->unix_ext) { 978 if (pTcon->unix_ext) {
978 mode &= ~current->fs->umask;
979 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 979 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
980 CIFSSMBUnixSetPerms(xid, pTcon, full_path, 980 CIFSSMBUnixSetPerms(xid, pTcon, full_path,
981 mode, 981 mode,
@@ -994,9 +994,16 @@ mkdir_get_info:
994 CIFS_MOUNT_MAP_SPECIAL_CHR); 994 CIFS_MOUNT_MAP_SPECIAL_CHR);
995 } 995 }
996 } else { 996 } else {
997 /* BB to be implemented via Windows secrty descriptors 997 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) &&
998 eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, 998 (mode & S_IWUGO) == 0) {
999 -1, -1, local_nls); */ 999 FILE_BASIC_INFO pInfo;
1000 memset(&pInfo, 0, sizeof(pInfo));
1001 pInfo.Attributes = cpu_to_le32(ATTR_READONLY);
1002 CIFSSMBSetTimes(xid, pTcon, full_path,
1003 &pInfo, cifs_sb->local_nls,
1004 cifs_sb->mnt_cifs_flags &
1005 CIFS_MOUNT_MAP_SPECIAL_CHR);
1006 }
1000 if (direntry->d_inode) { 1007 if (direntry->d_inode) {
1001 direntry->d_inode->i_mode = mode; 1008 direntry->d_inode->i_mode = mode;
1002 direntry->d_inode->i_mode |= S_IFDIR; 1009 direntry->d_inode->i_mode |= S_IFDIR;
@@ -1408,18 +1415,19 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1408 __u64 uid = 0xFFFFFFFFFFFFFFFFULL; 1415 __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
1409 __u64 gid = 0xFFFFFFFFFFFFFFFFULL; 1416 __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
1410 struct cifsInodeInfo *cifsInode; 1417 struct cifsInodeInfo *cifsInode;
1418 struct inode *inode = direntry->d_inode;
1411 1419
1412 xid = GetXid(); 1420 xid = GetXid();
1413 1421
1414 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x", 1422 cFYI(1, ("setattr on file %s attrs->iavalid 0x%x",
1415 direntry->d_name.name, attrs->ia_valid)); 1423 direntry->d_name.name, attrs->ia_valid));
1416 1424
1417 cifs_sb = CIFS_SB(direntry->d_inode->i_sb); 1425 cifs_sb = CIFS_SB(inode->i_sb);
1418 pTcon = cifs_sb->tcon; 1426 pTcon = cifs_sb->tcon;
1419 1427
1420 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) { 1428 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
1421 /* check if we have permission to change attrs */ 1429 /* check if we have permission to change attrs */
1422 rc = inode_change_ok(direntry->d_inode, attrs); 1430 rc = inode_change_ok(inode, attrs);
1423 if (rc < 0) { 1431 if (rc < 0) {
1424 FreeXid(xid); 1432 FreeXid(xid);
1425 return rc; 1433 return rc;
@@ -1432,7 +1440,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1432 FreeXid(xid); 1440 FreeXid(xid);
1433 return -ENOMEM; 1441 return -ENOMEM;
1434 } 1442 }
1435 cifsInode = CIFS_I(direntry->d_inode); 1443 cifsInode = CIFS_I(inode);
1436 1444
1437 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) { 1445 if ((attrs->ia_valid & ATTR_MTIME) || (attrs->ia_valid & ATTR_SIZE)) {
1438 /* 1446 /*
@@ -1443,9 +1451,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1443 will be truncated anyway? Also, should we error out here if 1451 will be truncated anyway? Also, should we error out here if
1444 the flush returns error? 1452 the flush returns error?
1445 */ 1453 */
1446 rc = filemap_write_and_wait(direntry->d_inode->i_mapping); 1454 rc = filemap_write_and_wait(inode->i_mapping);
1447 if (rc != 0) { 1455 if (rc != 0) {
1448 CIFS_I(direntry->d_inode)->write_behind_rc = rc; 1456 cifsInode->write_behind_rc = rc;
1449 rc = 0; 1457 rc = 0;
1450 } 1458 }
1451 } 1459 }
@@ -1521,9 +1529,8 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1521 */ 1529 */
1522 1530
1523 if (rc == 0) { 1531 if (rc == 0) {
1524 rc = cifs_vmtruncate(direntry->d_inode, attrs->ia_size); 1532 rc = cifs_vmtruncate(inode, attrs->ia_size);
1525 cifs_truncate_page(direntry->d_inode->i_mapping, 1533 cifs_truncate_page(inode->i_mapping, inode->i_size);
1526 direntry->d_inode->i_size);
1527 } else 1534 } else
1528 goto cifs_setattr_exit; 1535 goto cifs_setattr_exit;
1529 } 1536 }
@@ -1557,7 +1564,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1557 rc = 0; 1564 rc = 0;
1558#ifdef CONFIG_CIFS_EXPERIMENTAL 1565#ifdef CONFIG_CIFS_EXPERIMENTAL
1559 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) 1566 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
1560 rc = mode_to_acl(direntry->d_inode, full_path, mode); 1567 rc = mode_to_acl(inode, full_path, mode);
1561 else if ((mode & S_IWUGO) == 0) { 1568 else if ((mode & S_IWUGO) == 0) {
1562#else 1569#else
1563 if ((mode & S_IWUGO) == 0) { 1570 if ((mode & S_IWUGO) == 0) {
@@ -1665,7 +1672,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1665 /* do not need local check to inode_check_ok since the server does 1672 /* do not need local check to inode_check_ok since the server does
1666 that */ 1673 that */
1667 if (!rc) 1674 if (!rc)
1668 rc = inode_setattr(direntry->d_inode, attrs); 1675 rc = inode_setattr(inode, attrs);
1669cifs_setattr_exit: 1676cifs_setattr_exit:
1670 kfree(full_path); 1677 kfree(full_path);
1671 FreeXid(xid); 1678 FreeXid(xid);
diff --git a/fs/compat.c b/fs/compat.c
index 332a869d2c5..ed43e17a5dc 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
1426out_kfree: 1426out_kfree:
1427 kfree(bprm); 1427 free_bprm(bprm);
1428 1428
1429out_ret: 1429out_ret:
1430 return retval; 1430 return retval;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 7c1e5e5cccd..637018c891e 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;
138static struct workqueue_struct *send_workqueue; 139static struct workqueue_struct *send_workqueue;
139 140
140static DEFINE_IDR(connections_idr); 141static DEFINE_IDR(connections_idr);
141static DECLARE_MUTEX(connections_lock); 142static DEFINE_MUTEX(connections_lock);
142static int max_nodeid; 143static int max_nodeid;
143static struct kmem_cache *con_cache; 144static 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 714593621f4..18bda83cc89 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
98void __exit dlm_netlink_exit(void) 98void 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 d6d6e370f89..78878c5781c 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/dquot.c b/fs/dquot.c
index dfba1623ccc..5ac77da1995 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1491,6 +1491,16 @@ int vfs_quota_off(struct super_block *sb, int type, int remount)
1491 1491
1492 /* We need to serialize quota_off() for device */ 1492 /* We need to serialize quota_off() for device */
1493 mutex_lock(&dqopt->dqonoff_mutex); 1493 mutex_lock(&dqopt->dqonoff_mutex);
1494
1495 /*
1496 * Skip everything if there's nothing to do. We have to do this because
1497 * sometimes we are called when fill_super() failed and calling
1498 * sync_fs() in such cases does no good.
1499 */
1500 if (!sb_any_quota_enabled(sb) && !sb_any_quota_suspended(sb)) {
1501 mutex_unlock(&dqopt->dqonoff_mutex);
1502 return 0;
1503 }
1494 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1504 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1495 toputinode[cnt] = NULL; 1505 toputinode[cnt] = NULL;
1496 if (type != -1 && cnt != type) 1506 if (type != -1 && cnt != type)
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 0a1397335a8..c92cc1c00aa 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -37,17 +37,11 @@ static struct dentry *lock_parent(struct dentry *dentry)
37{ 37{
38 struct dentry *dir; 38 struct dentry *dir;
39 39
40 dir = dget(dentry->d_parent); 40 dir = dget_parent(dentry);
41 mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT); 41 mutex_lock_nested(&(dir->d_inode->i_mutex), I_MUTEX_PARENT);
42 return dir; 42 return dir;
43} 43}
44 44
45static void unlock_parent(struct dentry *dentry)
46{
47 mutex_unlock(&(dentry->d_parent->d_inode->i_mutex));
48 dput(dentry->d_parent);
49}
50
51static void unlock_dir(struct dentry *dir) 45static void unlock_dir(struct dentry *dir)
52{ 46{
53 mutex_unlock(&dir->d_inode->i_mutex); 47 mutex_unlock(&dir->d_inode->i_mutex);
@@ -426,8 +420,9 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
426 int rc = 0; 420 int rc = 0;
427 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); 421 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
428 struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir); 422 struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir);
423 struct dentry *lower_dir_dentry;
429 424
430 lock_parent(lower_dentry); 425 lower_dir_dentry = lock_parent(lower_dentry);
431 rc = vfs_unlink(lower_dir_inode, lower_dentry); 426 rc = vfs_unlink(lower_dir_inode, lower_dentry);
432 if (rc) { 427 if (rc) {
433 printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc); 428 printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
@@ -439,7 +434,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
439 dentry->d_inode->i_ctime = dir->i_ctime; 434 dentry->d_inode->i_ctime = dir->i_ctime;
440 d_drop(dentry); 435 d_drop(dentry);
441out_unlock: 436out_unlock:
442 unlock_parent(lower_dentry); 437 unlock_dir(lower_dir_dentry);
443 return rc; 438 return rc;
444} 439}
445 440
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c
index 788995efd1d..6560da1a58c 100644
--- a/fs/ecryptfs/miscdev.c
+++ b/fs/ecryptfs/miscdev.c
@@ -257,12 +257,14 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count,
257 mutex_lock(&daemon->mux); 257 mutex_lock(&daemon->mux);
258 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) { 258 if (daemon->flags & ECRYPTFS_DAEMON_ZOMBIE) {
259 rc = 0; 259 rc = 0;
260 mutex_unlock(&ecryptfs_daemon_hash_mux);
260 printk(KERN_WARNING "%s: Attempt to read from zombified " 261 printk(KERN_WARNING "%s: Attempt to read from zombified "
261 "daemon\n", __func__); 262 "daemon\n", __func__);
262 goto out_unlock_daemon; 263 goto out_unlock_daemon;
263 } 264 }
264 if (daemon->flags & ECRYPTFS_DAEMON_IN_READ) { 265 if (daemon->flags & ECRYPTFS_DAEMON_IN_READ) {
265 rc = 0; 266 rc = 0;
267 mutex_unlock(&ecryptfs_daemon_hash_mux);
266 goto out_unlock_daemon; 268 goto out_unlock_daemon;
267 } 269 }
268 /* This daemon will not go away so long as this flag is set */ 270 /* This daemon will not go away so long as this flag is set */
diff --git a/fs/exec.c b/fs/exec.c
index aeaa9791d8b..3c2ba7ce11d 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -736,7 +736,7 @@ static int exec_mmap(struct mm_struct *mm)
736 tsk->active_mm = mm; 736 tsk->active_mm = mm;
737 activate_mm(active_mm, mm); 737 activate_mm(active_mm, mm);
738 task_unlock(tsk); 738 task_unlock(tsk);
739 mm_update_next_owner(mm); 739 mm_update_next_owner(old_mm);
740 arch_pick_mmap_layout(mm); 740 arch_pick_mmap_layout(mm);
741 if (old_mm) { 741 if (old_mm) {
742 up_read(&old_mm->mmap_sem); 742 up_read(&old_mm->mmap_sem);
@@ -1251,6 +1251,12 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1251 1251
1252EXPORT_SYMBOL(search_binary_handler); 1252EXPORT_SYMBOL(search_binary_handler);
1253 1253
1254void 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
1332out: 1337out:
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 }
1346out_kfree: 1350out_kfree:
1347 kfree(bprm); 1351 free_bprm(bprm);
1348 1352
1349out_files: 1353out_files:
1350 if (displaced) 1354 if (displaced)
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index d4a4f0e9ff6..175414ac221 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -1000,6 +1000,11 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
1000 i.value = NULL; 1000 i.value = NULL;
1001 error = ext3_xattr_block_set(handle, inode, &i, &bs); 1001 error = ext3_xattr_block_set(handle, inode, &i, &bs);
1002 } else if (error == -ENOSPC) { 1002 } else if (error == -ENOSPC) {
1003 if (EXT3_I(inode)->i_file_acl && !bs.s.base) {
1004 error = ext3_xattr_block_find(inode, &i, &bs);
1005 if (error)
1006 goto cleanup;
1007 }
1003 error = ext3_xattr_block_set(handle, inode, &i, &bs); 1008 error = ext3_xattr_block_set(handle, inode, &i, &bs);
1004 if (error) 1009 if (error)
1005 goto cleanup; 1010 goto cleanup;
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index da994374ec3..30494c5da84 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -287,11 +287,11 @@ read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
287 (int)block_group, (unsigned long long)bitmap_blk); 287 (int)block_group, (unsigned long long)bitmap_blk);
288 return NULL; 288 return NULL;
289 } 289 }
290 if (!ext4_valid_block_bitmap(sb, desc, block_group, bh)) { 290 ext4_valid_block_bitmap(sb, desc, block_group, bh);
291 put_bh(bh); 291 /*
292 return NULL; 292 * file system mounted not to panic on error,
293 } 293 * continue with corrupt bitmap
294 294 */
295 return bh; 295 return bh;
296} 296}
297/* 297/*
@@ -1770,7 +1770,12 @@ allocated:
1770 "Allocating block in system zone - " 1770 "Allocating block in system zone - "
1771 "blocks from %llu, length %lu", 1771 "blocks from %llu, length %lu",
1772 ret_block, num); 1772 ret_block, num);
1773 goto out; 1773 /*
1774 * claim_block marked the blocks we allocated
1775 * as in use. So we may want to selectively
1776 * mark some of the blocks as free
1777 */
1778 goto retry_alloc;
1774 } 1779 }
1775 1780
1776 performed_allocation = 1; 1781 performed_allocation = 1;
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index fbec2ef9379..873ad9b3418 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2639,8 +2639,7 @@ static int ext4_mb_init_per_dev_proc(struct super_block *sb)
2639 struct proc_dir_entry *proc; 2639 struct proc_dir_entry *proc;
2640 char devname[64]; 2640 char devname[64];
2641 2641
2642 snprintf(devname, sizeof(devname) - 1, "%s", 2642 bdevname(sb->s_bdev, devname);
2643 bdevname(sb->s_bdev, devname));
2644 sbi->s_mb_proc = proc_mkdir(devname, proc_root_ext4); 2643 sbi->s_mb_proc = proc_mkdir(devname, proc_root_ext4);
2645 2644
2646 MB_PROC_HANDLER(EXT4_MB_STATS_NAME, stats); 2645 MB_PROC_HANDLER(EXT4_MB_STATS_NAME, stats);
@@ -2674,8 +2673,7 @@ static int ext4_mb_destroy_per_dev_proc(struct super_block *sb)
2674 if (sbi->s_mb_proc == NULL) 2673 if (sbi->s_mb_proc == NULL)
2675 return -EINVAL; 2674 return -EINVAL;
2676 2675
2677 snprintf(devname, sizeof(devname) - 1, "%s", 2676 bdevname(sb->s_bdev, devname);
2678 bdevname(sb->s_bdev, devname));
2679 remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_mb_proc); 2677 remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_mb_proc);
2680 remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_mb_proc); 2678 remove_proc_entry(EXT4_MB_STREAM_REQ, sbi->s_mb_proc);
2681 remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_mb_proc); 2679 remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_mb_proc);
@@ -2738,7 +2736,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2738 struct ext4_sb_info *sbi; 2736 struct ext4_sb_info *sbi;
2739 struct super_block *sb; 2737 struct super_block *sb;
2740 ext4_fsblk_t block; 2738 ext4_fsblk_t block;
2741 int err; 2739 int err, len;
2742 2740
2743 BUG_ON(ac->ac_status != AC_STATUS_FOUND); 2741 BUG_ON(ac->ac_status != AC_STATUS_FOUND);
2744 BUG_ON(ac->ac_b_ex.fe_len <= 0); 2742 BUG_ON(ac->ac_b_ex.fe_len <= 0);
@@ -2772,14 +2770,27 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2772 + ac->ac_b_ex.fe_start 2770 + ac->ac_b_ex.fe_start
2773 + le32_to_cpu(es->s_first_data_block); 2771 + le32_to_cpu(es->s_first_data_block);
2774 2772
2775 if (block == ext4_block_bitmap(sb, gdp) || 2773 len = ac->ac_b_ex.fe_len;
2776 block == ext4_inode_bitmap(sb, gdp) || 2774 if (in_range(ext4_block_bitmap(sb, gdp), block, len) ||
2777 in_range(block, ext4_inode_table(sb, gdp), 2775 in_range(ext4_inode_bitmap(sb, gdp), block, len) ||
2778 EXT4_SB(sb)->s_itb_per_group)) { 2776 in_range(block, ext4_inode_table(sb, gdp),
2779 2777 EXT4_SB(sb)->s_itb_per_group) ||
2778 in_range(block + len - 1, ext4_inode_table(sb, gdp),
2779 EXT4_SB(sb)->s_itb_per_group)) {
2780 ext4_error(sb, __func__, 2780 ext4_error(sb, __func__,
2781 "Allocating block in system zone - block = %llu", 2781 "Allocating block in system zone - block = %llu",
2782 block); 2782 block);
2783 /* File system mounted not to panic on error
2784 * Fix the bitmap and repeat the block allocation
2785 * We leak some of the blocks here.
2786 */
2787 mb_set_bits(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group),
2788 bitmap_bh->b_data, ac->ac_b_ex.fe_start,
2789 ac->ac_b_ex.fe_len);
2790 err = ext4_journal_dirty_metadata(handle, bitmap_bh);
2791 if (!err)
2792 err = -EAGAIN;
2793 goto out_err;
2783 } 2794 }
2784#ifdef AGGRESSIVE_CHECK 2795#ifdef AGGRESSIVE_CHECK
2785 { 2796 {
@@ -2882,12 +2893,11 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
2882 if (size < i_size_read(ac->ac_inode)) 2893 if (size < i_size_read(ac->ac_inode))
2883 size = i_size_read(ac->ac_inode); 2894 size = i_size_read(ac->ac_inode);
2884 2895
2885 /* max available blocks in a free group */ 2896 /* max size of free chunks */
2886 max = EXT4_BLOCKS_PER_GROUP(ac->ac_sb) - 1 - 1 - 2897 max = 2 << bsbits;
2887 EXT4_SB(ac->ac_sb)->s_itb_per_group;
2888 2898
2889#define NRL_CHECK_SIZE(req, size, max,bits) \ 2899#define NRL_CHECK_SIZE(req, size, max, chunk_size) \
2890 (req <= (size) || max <= ((size) >> bits)) 2900 (req <= (size) || max <= (chunk_size))
2891 2901
2892 /* first, try to predict filesize */ 2902 /* first, try to predict filesize */
2893 /* XXX: should this table be tunable? */ 2903 /* XXX: should this table be tunable? */
@@ -2906,16 +2916,16 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
2906 size = 512 * 1024; 2916 size = 512 * 1024;
2907 } else if (size <= 1024 * 1024) { 2917 } else if (size <= 1024 * 1024) {
2908 size = 1024 * 1024; 2918 size = 1024 * 1024;
2909 } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, bsbits)) { 2919 } else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, 2 * 1024)) {
2910 start_off = ((loff_t)ac->ac_o_ex.fe_logical >> 2920 start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
2911 (20 - bsbits)) << 20; 2921 (21 - bsbits)) << 21;
2912 size = 1024 * 1024; 2922 size = 2 * 1024 * 1024;
2913 } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, bsbits)) { 2923 } else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, 4 * 1024)) {
2914 start_off = ((loff_t)ac->ac_o_ex.fe_logical >> 2924 start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
2915 (22 - bsbits)) << 22; 2925 (22 - bsbits)) << 22;
2916 size = 4 * 1024 * 1024; 2926 size = 4 * 1024 * 1024;
2917 } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len, 2927 } else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len,
2918 (8<<20)>>bsbits, max, bsbits)) { 2928 (8<<20)>>bsbits, max, 8 * 1024)) {
2919 start_off = ((loff_t)ac->ac_o_ex.fe_logical >> 2929 start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
2920 (23 - bsbits)) << 23; 2930 (23 - bsbits)) << 23;
2921 size = 8 * 1024 * 1024; 2931 size = 8 * 1024 * 1024;
@@ -4035,7 +4045,6 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
4035 4045
4036 ac->ac_op = EXT4_MB_HISTORY_ALLOC; 4046 ac->ac_op = EXT4_MB_HISTORY_ALLOC;
4037 ext4_mb_normalize_request(ac, ar); 4047 ext4_mb_normalize_request(ac, ar);
4038
4039repeat: 4048repeat:
4040 /* allocate space in core */ 4049 /* allocate space in core */
4041 ext4_mb_regular_allocator(ac); 4050 ext4_mb_regular_allocator(ac);
@@ -4049,10 +4058,21 @@ repeat:
4049 } 4058 }
4050 4059
4051 if (likely(ac->ac_status == AC_STATUS_FOUND)) { 4060 if (likely(ac->ac_status == AC_STATUS_FOUND)) {
4052 ext4_mb_mark_diskspace_used(ac, handle); 4061 *errp = ext4_mb_mark_diskspace_used(ac, handle);
4053 *errp = 0; 4062 if (*errp == -EAGAIN) {
4054 block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex); 4063 ac->ac_b_ex.fe_group = 0;
4055 ar->len = ac->ac_b_ex.fe_len; 4064 ac->ac_b_ex.fe_start = 0;
4065 ac->ac_b_ex.fe_len = 0;
4066 ac->ac_status = AC_STATUS_CONTINUE;
4067 goto repeat;
4068 } else if (*errp) {
4069 ac->ac_b_ex.fe_len = 0;
4070 ar->len = 0;
4071 ext4_mb_show_ac(ac);
4072 } else {
4073 block = ext4_grp_offs_to_block(sb, &ac->ac_b_ex);
4074 ar->len = ac->ac_b_ex.fe_len;
4075 }
4056 } else { 4076 } else {
4057 freed = ext4_mb_discard_preallocations(sb, ac->ac_o_ex.fe_len); 4077 freed = ext4_mb_discard_preallocations(sb, ac->ac_o_ex.fe_len);
4058 if (freed) 4078 if (freed)
@@ -4239,6 +4259,8 @@ do_more:
4239 ext4_error(sb, __func__, 4259 ext4_error(sb, __func__,
4240 "Freeing blocks in system zone - " 4260 "Freeing blocks in system zone - "
4241 "Block = %lu, count = %lu", block, count); 4261 "Block = %lu, count = %lu", block, count);
4262 /* err = 0. ext4_std_error should be a no op */
4263 goto error_return;
4242 } 4264 }
4243 4265
4244 BUFFER_TRACE(bitmap_bh, "getting write access"); 4266 BUFFER_TRACE(bitmap_bh, "getting write access");
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 52dd0679a4e..09d9359c805 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -979,7 +979,7 @@ static int parse_options (char *options, struct super_block *sb,
979 int data_opt = 0; 979 int data_opt = 0;
980 int option; 980 int option;
981#ifdef CONFIG_QUOTA 981#ifdef CONFIG_QUOTA
982 int qtype; 982 int qtype, qfmt;
983 char *qname; 983 char *qname;
984#endif 984#endif
985 985
@@ -1162,9 +1162,11 @@ static int parse_options (char *options, struct super_block *sb,
1162 case Opt_grpjquota: 1162 case Opt_grpjquota:
1163 qtype = GRPQUOTA; 1163 qtype = GRPQUOTA;
1164set_qf_name: 1164set_qf_name:
1165 if (sb_any_quota_enabled(sb)) { 1165 if ((sb_any_quota_enabled(sb) ||
1166 sb_any_quota_suspended(sb)) &&
1167 !sbi->s_qf_names[qtype]) {
1166 printk(KERN_ERR 1168 printk(KERN_ERR
1167 "EXT4-fs: Cannot change journalled " 1169 "EXT4-fs: Cannot change journaled "
1168 "quota options when quota turned on.\n"); 1170 "quota options when quota turned on.\n");
1169 return 0; 1171 return 0;
1170 } 1172 }
@@ -1200,9 +1202,11 @@ set_qf_name:
1200 case Opt_offgrpjquota: 1202 case Opt_offgrpjquota:
1201 qtype = GRPQUOTA; 1203 qtype = GRPQUOTA;
1202clear_qf_name: 1204clear_qf_name:
1203 if (sb_any_quota_enabled(sb)) { 1205 if ((sb_any_quota_enabled(sb) ||
1206 sb_any_quota_suspended(sb)) &&
1207 sbi->s_qf_names[qtype]) {
1204 printk(KERN_ERR "EXT4-fs: Cannot change " 1208 printk(KERN_ERR "EXT4-fs: Cannot change "
1205 "journalled quota options when " 1209 "journaled quota options when "
1206 "quota turned on.\n"); 1210 "quota turned on.\n");
1207 return 0; 1211 return 0;
1208 } 1212 }
@@ -1213,10 +1217,20 @@ clear_qf_name:
1213 sbi->s_qf_names[qtype] = NULL; 1217 sbi->s_qf_names[qtype] = NULL;
1214 break; 1218 break;
1215 case Opt_jqfmt_vfsold: 1219 case Opt_jqfmt_vfsold:
1216 sbi->s_jquota_fmt = QFMT_VFS_OLD; 1220 qfmt = QFMT_VFS_OLD;
1217 break; 1221 goto set_qf_format;
1218 case Opt_jqfmt_vfsv0: 1222 case Opt_jqfmt_vfsv0:
1219 sbi->s_jquota_fmt = QFMT_VFS_V0; 1223 qfmt = QFMT_VFS_V0;
1224set_qf_format:
1225 if ((sb_any_quota_enabled(sb) ||
1226 sb_any_quota_suspended(sb)) &&
1227 sbi->s_jquota_fmt != qfmt) {
1228 printk(KERN_ERR "EXT4-fs: Cannot change "
1229 "journaled quota options when "
1230 "quota turned on.\n");
1231 return 0;
1232 }
1233 sbi->s_jquota_fmt = qfmt;
1220 break; 1234 break;
1221 case Opt_quota: 1235 case Opt_quota:
1222 case Opt_usrquota: 1236 case Opt_usrquota:
@@ -1241,6 +1255,9 @@ clear_qf_name:
1241 case Opt_quota: 1255 case Opt_quota:
1242 case Opt_usrquota: 1256 case Opt_usrquota:
1243 case Opt_grpquota: 1257 case Opt_grpquota:
1258 printk(KERN_ERR
1259 "EXT4-fs: quota options not supported.\n");
1260 break;
1244 case Opt_usrjquota: 1261 case Opt_usrjquota:
1245 case Opt_grpjquota: 1262 case Opt_grpjquota:
1246 case Opt_offusrjquota: 1263 case Opt_offusrjquota:
@@ -1248,7 +1265,7 @@ clear_qf_name:
1248 case Opt_jqfmt_vfsold: 1265 case Opt_jqfmt_vfsold:
1249 case Opt_jqfmt_vfsv0: 1266 case Opt_jqfmt_vfsv0:
1250 printk(KERN_ERR 1267 printk(KERN_ERR
1251 "EXT4-fs: journalled quota options not " 1268 "EXT4-fs: journaled quota options not "
1252 "supported.\n"); 1269 "supported.\n");
1253 break; 1270 break;
1254 case Opt_noquota: 1271 case Opt_noquota:
@@ -1333,14 +1350,14 @@ clear_qf_name:
1333 } 1350 }
1334 1351
1335 if (!sbi->s_jquota_fmt) { 1352 if (!sbi->s_jquota_fmt) {
1336 printk(KERN_ERR "EXT4-fs: journalled quota format " 1353 printk(KERN_ERR "EXT4-fs: journaled quota format "
1337 "not specified.\n"); 1354 "not specified.\n");
1338 return 0; 1355 return 0;
1339 } 1356 }
1340 } else { 1357 } else {
1341 if (sbi->s_jquota_fmt) { 1358 if (sbi->s_jquota_fmt) {
1342 printk(KERN_ERR "EXT4-fs: journalled quota format " 1359 printk(KERN_ERR "EXT4-fs: journaled quota format "
1343 "specified with no journalling " 1360 "specified with no journaling "
1344 "enabled.\n"); 1361 "enabled.\n");
1345 return 0; 1362 return 0;
1346 } 1363 }
@@ -1581,7 +1598,7 @@ static void ext4_orphan_cleanup (struct super_block * sb,
1581 int ret = ext4_quota_on_mount(sb, i); 1598 int ret = ext4_quota_on_mount(sb, i);
1582 if (ret < 0) 1599 if (ret < 0)
1583 printk(KERN_ERR 1600 printk(KERN_ERR
1584 "EXT4-fs: Cannot turn on journalled " 1601 "EXT4-fs: Cannot turn on journaled "
1585 "quota: error %d\n", ret); 1602 "quota: error %d\n", ret);
1586 } 1603 }
1587 } 1604 }
@@ -3106,7 +3123,7 @@ static int ext4_release_dquot(struct dquot *dquot)
3106 3123
3107static int ext4_mark_dquot_dirty(struct dquot *dquot) 3124static int ext4_mark_dquot_dirty(struct dquot *dquot)
3108{ 3125{
3109 /* Are we journalling quotas? */ 3126 /* Are we journaling quotas? */
3110 if (EXT4_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] || 3127 if (EXT4_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] ||
3111 EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { 3128 EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) {
3112 dquot_mark_dquot_dirty(dquot); 3129 dquot_mark_dquot_dirty(dquot);
@@ -3153,23 +3170,42 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3153 3170
3154 if (!test_opt(sb, QUOTA)) 3171 if (!test_opt(sb, QUOTA))
3155 return -EINVAL; 3172 return -EINVAL;
3156 /* Not journalling quota? */ 3173 /* When remounting, no checks are needed and in fact, path is NULL */
3157 if ((!EXT4_SB(sb)->s_qf_names[USRQUOTA] && 3174 if (remount)
3158 !EXT4_SB(sb)->s_qf_names[GRPQUOTA]) || remount)
3159 return vfs_quota_on(sb, type, format_id, path, remount); 3175 return vfs_quota_on(sb, type, format_id, path, remount);
3176
3160 err = path_lookup(path, LOOKUP_FOLLOW, &nd); 3177 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
3161 if (err) 3178 if (err)
3162 return err; 3179 return err;
3180
3163 /* Quotafile not on the same filesystem? */ 3181 /* Quotafile not on the same filesystem? */
3164 if (nd.path.mnt->mnt_sb != sb) { 3182 if (nd.path.mnt->mnt_sb != sb) {
3165 path_put(&nd.path); 3183 path_put(&nd.path);
3166 return -EXDEV; 3184 return -EXDEV;
3167 } 3185 }
3168 /* Quotafile not of fs root? */ 3186 /* Journaling quota? */
3169 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) 3187 if (EXT4_SB(sb)->s_qf_names[type]) {
3170 printk(KERN_WARNING 3188 /* Quotafile not of fs root? */
3171 "EXT4-fs: Quota file not on filesystem root. " 3189 if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
3172 "Journalled quota will not work.\n"); 3190 printk(KERN_WARNING
3191 "EXT4-fs: Quota file not on filesystem root. "
3192 "Journaled quota will not work.\n");
3193 }
3194
3195 /*
3196 * When we journal data on quota file, we have to flush journal to see
3197 * all updates to the file when we bypass pagecache...
3198 */
3199 if (ext4_should_journal_data(nd.path.dentry->d_inode)) {
3200 /*
3201 * We don't need to lock updates but journal_flush() could
3202 * otherwise be livelocked...
3203 */
3204 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
3205 jbd2_journal_flush(EXT4_SB(sb)->s_journal);
3206 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
3207 }
3208
3173 path_put(&nd.path); 3209 path_put(&nd.path);
3174 return vfs_quota_on(sb, type, format_id, path, remount); 3210 return vfs_quota_on(sb, type, format_id, path, remount);
3175} 3211}
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 3fbc2c6c3d0..ff08633f398 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1009,6 +1009,11 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
1009 i.value = NULL; 1009 i.value = NULL;
1010 error = ext4_xattr_block_set(handle, inode, &i, &bs); 1010 error = ext4_xattr_block_set(handle, inode, &i, &bs);
1011 } else if (error == -ENOSPC) { 1011 } else if (error == -ENOSPC) {
1012 if (EXT4_I(inode)->i_file_acl && !bs.s.base) {
1013 error = ext4_xattr_block_find(inode, &i, &bs);
1014 if (error)
1015 goto cleanup;
1016 }
1012 error = ext4_xattr_block_set(handle, inode, &i, &bs); 1017 error = ext4_xattr_block_set(handle, inode, &i, &bs);
1013 if (error) 1018 if (error)
1014 goto cleanup; 1019 goto cleanup;
diff --git a/fs/file.c b/fs/file.c
index 4c6f0ea12c4..7b3887e054d 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -26,6 +26,8 @@ struct fdtable_defer {
26}; 26};
27 27
28int sysctl_nr_open __read_mostly = 1024*1024; 28int sysctl_nr_open __read_mostly = 1024*1024;
29int sysctl_nr_open_min = BITS_PER_LONG;
30int 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
264static 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 */
283struct 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
391out_release:
392 kmem_cache_free(files_cachep, newf);
393out:
394 return NULL;
395}
396
264static void __devinit fdtable_defer_list_init(int cpu) 397static 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
414struct 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/fuse/file.c b/fs/fuse/file.c
index f28cf8b46f8..8092f0d9fd1 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -804,6 +804,8 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
804 if (offset == PAGE_CACHE_SIZE) 804 if (offset == PAGE_CACHE_SIZE)
805 offset = 0; 805 offset = 0;
806 806
807 if (!fc->big_writes)
808 break;
807 } while (iov_iter_count(ii) && count < fc->max_write && 809 } while (iov_iter_count(ii) && count < fc->max_write &&
808 req->num_pages < FUSE_MAX_PAGES_PER_REQ && offset == 0); 810 req->num_pages < FUSE_MAX_PAGES_PER_REQ && offset == 0);
809 811
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index dadffa21a20..bae948657c4 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -404,6 +404,9 @@ struct fuse_conn {
404 /** Is bmap not implemented by fs? */ 404 /** Is bmap not implemented by fs? */
405 unsigned no_bmap : 1; 405 unsigned no_bmap : 1;
406 406
407 /** Do multi-page cached writes */
408 unsigned big_writes : 1;
409
407 /** The number of requests waiting for completion */ 410 /** The number of requests waiting for completion */
408 atomic_t num_waiting; 411 atomic_t num_waiting;
409 412
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 79b61587383..fb77e096213 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -576,6 +576,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
576 fc->no_lock = 1; 576 fc->no_lock = 1;
577 if (arg->flags & FUSE_ATOMIC_O_TRUNC) 577 if (arg->flags & FUSE_ATOMIC_O_TRUNC)
578 fc->atomic_o_trunc = 1; 578 fc->atomic_o_trunc = 1;
579 if (arg->flags & FUSE_BIG_WRITES)
580 fc->big_writes = 1;
579 } else { 581 } else {
580 ra_pages = fc->max_read / PAGE_CACHE_SIZE; 582 ra_pages = fc->max_read / PAGE_CACHE_SIZE;
581 fc->no_lock = 1; 583 fc->no_lock = 1;
@@ -599,7 +601,8 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
599 arg->major = FUSE_KERNEL_VERSION; 601 arg->major = FUSE_KERNEL_VERSION;
600 arg->minor = FUSE_KERNEL_MINOR_VERSION; 602 arg->minor = FUSE_KERNEL_MINOR_VERSION;
601 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; 603 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
602 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC; 604 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC |
605 FUSE_BIG_WRITES;
603 req->in.h.opcode = FUSE_INIT; 606 req->in.h.opcode = FUSE_INIT;
604 req->in.numargs = 1; 607 req->in.numargs = 1;
605 req->in.args[0].size = sizeof(*arg); 608 req->in.args[0].size = sizeof(*arg);
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index d53b2af91c2..67e1c8b467c 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -65,6 +65,8 @@ static int hfsplus_releasepage(struct page *page, gfp_t mask)
65 BUG(); 65 BUG();
66 return 0; 66 return 0;
67 } 67 }
68 if (!tree)
69 return 0;
68 if (tree->node_size >= PAGE_CACHE_SIZE) { 70 if (tree->node_size >= PAGE_CACHE_SIZE) {
69 nidx = page->index >> (tree->node_size_shift - PAGE_CACHE_SHIFT); 71 nidx = page->index >> (tree->node_size_shift - PAGE_CACHE_SHIFT);
70 spin_lock(&tree->hash_lock); 72 spin_lock(&tree->hash_lock);
diff --git a/fs/hppfs/Makefile b/fs/hppfs/Makefile
index 6890433f759..8a1f5034436 100644
--- a/fs/hppfs/Makefile
+++ b/fs/hppfs/Makefile
@@ -1,9 +1,9 @@
1# 1#
2# Copyright (C) 2002, 2003 Jeff Dike (jdike@karaya.com) 2# Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6hppfs-objs := hppfs_kern.o 6hppfs-objs := hppfs.o
7 7
8obj-y = 8obj-y =
9obj-$(CONFIG_HPPFS) += hppfs.o 9obj-$(CONFIG_HPPFS) += $(hppfs-objs)
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs.c
index 8601d8ef3b5..65077aa90f0 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs.c
@@ -33,7 +33,7 @@ struct hppfs_private {
33}; 33};
34 34
35struct hppfs_inode_info { 35struct hppfs_inode_info {
36 struct dentry *proc_dentry; 36 struct dentry *proc_dentry;
37 struct inode vfs_inode; 37 struct inode vfs_inode;
38}; 38};
39 39
@@ -52,7 +52,7 @@ static int is_pid(struct dentry *dentry)
52 int i; 52 int i;
53 53
54 sb = dentry->d_sb; 54 sb = dentry->d_sb;
55 if ((sb->s_op != &hppfs_sbops) || (dentry->d_parent != sb->s_root)) 55 if (dentry->d_parent != sb->s_root)
56 return 0; 56 return 0;
57 57
58 for (i = 0; i < dentry->d_name.len; i++) { 58 for (i = 0; i < dentry->d_name.len; i++) {
@@ -136,7 +136,7 @@ static int file_removed(struct dentry *dentry, const char *file)
136} 136}
137 137
138static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, 138static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
139 struct nameidata *nd) 139 struct nameidata *nd)
140{ 140{
141 struct dentry *proc_dentry, *new, *parent; 141 struct dentry *proc_dentry, *new, *parent;
142 struct inode *inode; 142 struct inode *inode;
@@ -254,6 +254,8 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
254 int err; 254 int err;
255 255
256 if (hppfs->contents != NULL) { 256 if (hppfs->contents != NULL) {
257 int rem;
258
257 if (*ppos >= hppfs->len) 259 if (*ppos >= hppfs->len)
258 return 0; 260 return 0;
259 261
@@ -267,8 +269,10 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
267 269
268 if (off + count > hppfs->len) 270 if (off + count > hppfs->len)
269 count = hppfs->len - off; 271 count = hppfs->len - off;
270 copy_to_user(buf, &data->contents[off], count); 272 rem = copy_to_user(buf, &data->contents[off], count);
271 *ppos += count; 273 *ppos += count - rem;
274 if (rem > 0)
275 return -EFAULT;
272 } else if (hppfs->host_fd != -1) { 276 } else if (hppfs->host_fd != -1) {
273 err = os_seek_file(hppfs->host_fd, *ppos); 277 err = os_seek_file(hppfs->host_fd, *ppos);
274 if (err) { 278 if (err) {
@@ -285,21 +289,15 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
285 return count; 289 return count;
286} 290}
287 291
288static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len, 292static ssize_t hppfs_write(struct file *file, const char __user *buf,
289 loff_t *ppos) 293 size_t len, loff_t *ppos)
290{ 294{
291 struct hppfs_private *data = file->private_data; 295 struct hppfs_private *data = file->private_data;
292 struct file *proc_file = data->proc_file; 296 struct file *proc_file = data->proc_file;
293 ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); 297 ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
294 int err;
295 298
296 write = proc_file->f_path.dentry->d_inode->i_fop->write; 299 write = proc_file->f_path.dentry->d_inode->i_fop->write;
297 300 return (*write)(proc_file, buf, len, ppos);
298 proc_file->f_pos = file->f_pos;
299 err = (*write)(proc_file, buf, len, &proc_file->f_pos);
300 file->f_pos = proc_file->f_pos;
301
302 return err;
303} 301}
304 302
305static int open_host_sock(char *host_file, int *filter_out) 303static int open_host_sock(char *host_file, int *filter_out)
@@ -357,7 +355,7 @@ static struct hppfs_data *hppfs_get_data(int fd, int filter,
357 355
358 if (filter) { 356 if (filter) {
359 while ((n = read_proc(proc_file, data->contents, 357 while ((n = read_proc(proc_file, data->contents,
360 sizeof(data->contents), NULL, 0)) > 0) 358 sizeof(data->contents), NULL, 0)) > 0)
361 os_write_file(fd, data->contents, n); 359 os_write_file(fd, data->contents, n);
362 err = os_shutdown_socket(fd, 0, 1); 360 err = os_shutdown_socket(fd, 0, 1);
363 if (err) { 361 if (err) {
@@ -429,8 +427,8 @@ static int file_mode(int fmode)
429static int hppfs_open(struct inode *inode, struct file *file) 427static int hppfs_open(struct inode *inode, struct file *file)
430{ 428{
431 struct hppfs_private *data; 429 struct hppfs_private *data;
432 struct dentry *proc_dentry;
433 struct vfsmount *proc_mnt; 430 struct vfsmount *proc_mnt;
431 struct dentry *proc_dentry;
434 char *host_file; 432 char *host_file;
435 int err, fd, type, filter; 433 int err, fd, type, filter;
436 434
@@ -492,8 +490,8 @@ static int hppfs_open(struct inode *inode, struct file *file)
492static int hppfs_dir_open(struct inode *inode, struct file *file) 490static int hppfs_dir_open(struct inode *inode, struct file *file)
493{ 491{
494 struct hppfs_private *data; 492 struct hppfs_private *data;
495 struct dentry *proc_dentry;
496 struct vfsmount *proc_mnt; 493 struct vfsmount *proc_mnt;
494 struct dentry *proc_dentry;
497 int err; 495 int err;
498 496
499 err = -ENOMEM; 497 err = -ENOMEM;
@@ -620,6 +618,9 @@ static struct inode *hppfs_alloc_inode(struct super_block *sb)
620 618
621void hppfs_delete_inode(struct inode *ino) 619void hppfs_delete_inode(struct inode *ino)
622{ 620{
621 dput(HPPFS_I(ino)->proc_dentry);
622 mntput(ino->i_sb->s_fs_info);
623
623 clear_inode(ino); 624 clear_inode(ino);
624} 625}
625 626
@@ -628,69 +629,46 @@ static void hppfs_destroy_inode(struct inode *inode)
628 kfree(HPPFS_I(inode)); 629 kfree(HPPFS_I(inode));
629} 630}
630 631
631static void hppfs_put_super(struct super_block *sb)
632{
633 mntput(sb->s_fs_info);
634}
635
636static const struct super_operations hppfs_sbops = { 632static const struct super_operations hppfs_sbops = {
637 .alloc_inode = hppfs_alloc_inode, 633 .alloc_inode = hppfs_alloc_inode,
638 .destroy_inode = hppfs_destroy_inode, 634 .destroy_inode = hppfs_destroy_inode,
639 .delete_inode = hppfs_delete_inode, 635 .delete_inode = hppfs_delete_inode,
640 .statfs = hppfs_statfs, 636 .statfs = hppfs_statfs,
641 .put_super = hppfs_put_super,
642}; 637};
643 638
644static int hppfs_readlink(struct dentry *dentry, char __user *buffer, 639static int hppfs_readlink(struct dentry *dentry, char __user *buffer,
645 int buflen) 640 int buflen)
646{ 641{
647 struct file *proc_file;
648 struct dentry *proc_dentry; 642 struct dentry *proc_dentry;
649 struct vfsmount *proc_mnt;
650 int ret;
651 643
652 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 644 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
653 proc_mnt = dentry->d_sb->s_fs_info; 645 return proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer,
654 646 buflen);
655 proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt), O_RDONLY);
656 if (IS_ERR(proc_file))
657 return PTR_ERR(proc_file);
658
659 ret = proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, buflen);
660
661 fput(proc_file);
662
663 return ret;
664} 647}
665 648
666static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) 649static void *hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
667{ 650{
668 struct file *proc_file;
669 struct dentry *proc_dentry; 651 struct dentry *proc_dentry;
670 struct vfsmount *proc_mnt;
671 void *ret;
672 652
673 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 653 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
674 proc_mnt = dentry->d_sb->s_fs_info;
675
676 proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt), O_RDONLY);
677 if (IS_ERR(proc_file))
678 return proc_file;
679
680 ret = proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
681 654
682 fput(proc_file); 655 return proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
656}
683 657
684 return ret; 658int hppfs_permission(struct inode *inode, int mask, struct nameidata *nd)
659{
660 return generic_permission(inode, mask, NULL);
685} 661}
686 662
687static const struct inode_operations hppfs_dir_iops = { 663static const struct inode_operations hppfs_dir_iops = {
688 .lookup = hppfs_lookup, 664 .lookup = hppfs_lookup,
665 .permission = hppfs_permission,
689}; 666};
690 667
691static const struct inode_operations hppfs_link_iops = { 668static const struct inode_operations hppfs_link_iops = {
692 .readlink = hppfs_readlink, 669 .readlink = hppfs_readlink,
693 .follow_link = hppfs_follow_link, 670 .follow_link = hppfs_follow_link,
671 .permission = hppfs_permission,
694}; 672};
695 673
696static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) 674static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
@@ -712,7 +690,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
712 inode->i_fop = &hppfs_file_fops; 690 inode->i_fop = &hppfs_file_fops;
713 } 691 }
714 692
715 HPPFS_I(inode)->proc_dentry = dentry; 693 HPPFS_I(inode)->proc_dentry = dget(dentry);
716 694
717 inode->i_uid = proc_ino->i_uid; 695 inode->i_uid = proc_ino->i_uid;
718 inode->i_gid = proc_ino->i_gid; 696 inode->i_gid = proc_ino->i_gid;
@@ -725,7 +703,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
725 inode->i_size = proc_ino->i_size; 703 inode->i_size = proc_ino->i_size;
726 inode->i_blocks = proc_ino->i_blocks; 704 inode->i_blocks = proc_ino->i_blocks;
727 705
728 return 0; 706 return inode;
729} 707}
730 708
731static int hppfs_fill_super(struct super_block *sb, void *d, int silent) 709static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index cd931ef1f00..5a8ca61498c 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -470,7 +470,9 @@ void journal_commit_transaction(journal_t *journal)
470 * transaction! Now comes the tricky part: we need to write out 470 * transaction! Now comes the tricky part: we need to write out
471 * metadata. Loop over the transaction's entire buffer list: 471 * metadata. Loop over the transaction's entire buffer list:
472 */ 472 */
473 spin_lock(&journal->j_state_lock);
473 commit_transaction->t_state = T_COMMIT; 474 commit_transaction->t_state = T_COMMIT;
475 spin_unlock(&journal->j_state_lock);
474 476
475 J_ASSERT(commit_transaction->t_nr_buffers <= 477 J_ASSERT(commit_transaction->t_nr_buffers <=
476 commit_transaction->t_outstanding_credits); 478 commit_transaction->t_outstanding_credits);
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index e0139786f71..4d99685fdce 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -560,7 +560,9 @@ void jbd2_journal_commit_transaction(journal_t *journal)
560 * transaction! Now comes the tricky part: we need to write out 560 * transaction! Now comes the tricky part: we need to write out
561 * metadata. Loop over the transaction's entire buffer list: 561 * metadata. Loop over the transaction's entire buffer list:
562 */ 562 */
563 spin_lock(&journal->j_state_lock);
563 commit_transaction->t_state = T_COMMIT; 564 commit_transaction->t_state = T_COMMIT;
565 spin_unlock(&journal->j_state_lock);
564 566
565 stats.u.run.rs_logging = jiffies; 567 stats.u.run.rs_logging = jiffies;
566 stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing, 568 stats.u.run.rs_flushing = jbd2_time_diff(stats.u.run.rs_flushing,
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 53632e3e845..2e24567c4a7 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -901,7 +901,7 @@ static void jbd2_stats_proc_init(journal_t *journal)
901{ 901{
902 char name[BDEVNAME_SIZE]; 902 char name[BDEVNAME_SIZE];
903 903
904 snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name)); 904 bdevname(journal->j_dev, name);
905 journal->j_proc_entry = proc_mkdir(name, proc_jbd2_stats); 905 journal->j_proc_entry = proc_mkdir(name, proc_jbd2_stats);
906 if (journal->j_proc_entry) { 906 if (journal->j_proc_entry) {
907 proc_create_data("history", S_IRUGO, journal->j_proc_entry, 907 proc_create_data("history", S_IRUGO, journal->j_proc_entry,
@@ -915,7 +915,7 @@ static void jbd2_stats_proc_exit(journal_t *journal)
915{ 915{
916 char name[BDEVNAME_SIZE]; 916 char name[BDEVNAME_SIZE];
917 917
918 snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name)); 918 bdevname(journal->j_dev, name);
919 remove_proc_entry("info", journal->j_proc_entry); 919 remove_proc_entry("info", journal->j_proc_entry);
920 remove_proc_entry("history", journal->j_proc_entry); 920 remove_proc_entry("history", journal->j_proc_entry);
921 remove_proc_entry(name, proc_jbd2_stats); 921 remove_proc_entry(name, proc_jbd2_stats);
diff --git a/fs/namei.c b/fs/namei.c
index 32fd9655485..c7e43536c49 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;
2015enoent: 2019eexist:
2016 dput(dentry); 2020 dput(dentry);
2017 dentry = ERR_PTR(-ENOENT); 2021 dentry = ERR_PTR(-EEXIST);
2018fail: 2022fail:
2019 return dentry; 2023 return dentry;
2020} 2024}
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 5606ae3d72d..c1e7c830062 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 15f7785048d..f7e83e23cf9 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -57,7 +57,7 @@ out_iput:
57out_putclient: 57out_putclient:
58 nfs_put_client(clp); 58 nfs_put_client(clp);
59out: 59out:
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);
100out: 100out:
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 13619d24f02..dd0ef34b584 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);
181out: 181out:
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);
202out: 202out:
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)));
351out: 351out:
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 */
402static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp) 402static __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 89ac5bb0401..f2a092ca69b 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 00a5e4405e1..cc563cfa694 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 f288b3ecab4..58d43daec08 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;
814out_zap_parent: 814out_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 3536b01164f..d84a3d8f32a 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 5cb3345eb69..596c5d8e86f 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 af4d0f1e402..2f285ef7639 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);
145out: 144out:
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,
243free_page: 242free_page:
244 free_page((unsigned long)page); 243 free_page((unsigned long)page);
245out: 244out:
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 549dbce714a..c3523ad03ed 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 bd1b9d663fb..ea790645fda 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
207extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); 207extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *);
208extern void nfs4_put_state_owner(struct nfs4_state_owner *); 208extern void nfs4_put_state_owner(struct nfs4_state_owner *);
209extern void nfs4_drop_state_owner(struct nfs4_state_owner *);
210extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); 209extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *);
211extern void nfs4_put_open_state(struct nfs4_state *); 210extern void nfs4_put_open_state(struct nfs4_state *);
212extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); 211extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t);
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 5f9ba41ed5b..b112857301f 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,
204out: 204out:
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);
254out: 254out:
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 dbc09271af0..1293e0acd82 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
3362static void nfs4_lock_done(struct rpc_task *task, void *calldata) 3360static 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 }
3383out: 3381out:
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
3387static void nfs4_lock_release(void *calldata) 3385static 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
3408static const struct rpc_call_ops nfs4_lock_ops = { 3406static 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__);
3531out_unlock: 3529out_unlock:
3532 up_read(&clp->cl_sem); 3530 up_read(&clp->cl_sem);
3533out: 3531out:
@@ -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 5e2e4af1a0e..3305acbbe2a 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);
103out: 103out:
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 46eb624e4f1..856a8934f61 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
285void 285static void
286nfs4_drop_state_owner(struct nfs4_state_owner *sp) 286nfs4_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 5a2d64927b3..b916297d233 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
1837out: 1837out:
@@ -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 }
2620out: 2620out:
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;
2623out_eio: 2623out_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);
3069xdr_error: 3069xdr_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);
3102xdr_error: 3102xdr_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);
3127xdr_error: 3127xdr_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;
3195xdr_error: 3195xdr_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);
3228xdr_error: 3228xdr_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);
3420xdr_error: 3420xdr_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 5ccf7faee19..03599bfe81c 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 16f57e0af99..40d17987d0e 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 7226a506f3c..2a4a024a4e7 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
2038error_splat_root:
2039 dput(mntroot);
2034error_splat_super: 2040error_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 1ade11d1ba0..6d8ace3e325 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/proc/array.c b/fs/proc/array.c
index dca997a93bf..9e3b8c33c24 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -298,6 +298,7 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p)
298 render_cap_t(m, "CapInh:\t", &p->cap_inheritable); 298 render_cap_t(m, "CapInh:\t", &p->cap_inheritable);
299 render_cap_t(m, "CapPrm:\t", &p->cap_permitted); 299 render_cap_t(m, "CapPrm:\t", &p->cap_permitted);
300 render_cap_t(m, "CapEff:\t", &p->cap_effective); 300 render_cap_t(m, "CapEff:\t", &p->cap_effective);
301 render_cap_t(m, "CapBnd:\t", &p->cap_bset);
301} 302}
302 303
303static inline void task_context_switch_counts(struct seq_file *m, 304static inline void task_context_switch_counts(struct seq_file *m,
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 808cbdc193d..c447e0743a3 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/ufs/ufs.h b/fs/ufs/ufs.h
index 244a1aaa940..11c035168ea 100644
--- a/fs/ufs/ufs.h
+++ b/fs/ufs/ufs.h
@@ -107,7 +107,6 @@ extern struct inode * ufs_new_inode (struct inode *, int);
107 107
108/* inode.c */ 108/* inode.c */
109extern struct inode *ufs_iget(struct super_block *, unsigned long); 109extern struct inode *ufs_iget(struct super_block *, unsigned long);
110extern void ufs_put_inode (struct inode *);
111extern int ufs_write_inode (struct inode *, int); 110extern int ufs_write_inode (struct inode *, int);
112extern int ufs_sync_inode (struct inode *); 111extern int ufs_sync_inode (struct inode *);
113extern void ufs_delete_inode (struct inode *); 112extern void ufs_delete_inode (struct inode *);