diff options
author | David S. Miller <davem@davemloft.net> | 2008-05-15 03:34:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-15 03:34:44 -0400 |
commit | 63fe46da9c380b3f2bbdf3765044649517cc717c (patch) | |
tree | 9478c1aca1d692b408955aea20c9cd9a37e589c0 /fs | |
parent | 99dd1a2b8347ac2ae802300b7862f6f7bcf17139 (diff) | |
parent | 066b2118976e6e7cc50eed39e2747c75343a23c4 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/wireless/iwlwifi/iwl-4965-rs.c
drivers/net/wireless/rt2x00/rt61pci.c
Diffstat (limited to 'fs')
63 files changed, 904 insertions, 646 deletions
diff --git a/fs/9p/fid.h b/fs/9p/fid.h index 26e07df783b9..c3bbd6af996d 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 | */ | ||
25 | struct v9fs_dentry { | 40 | struct 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 9b0f0222e8bb..047c791427aa 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 | ||
79 | static void v9fs_parse_options(struct v9fs_session_info *v9ses) | 79 | static 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 | ||
235 | error: | 264 | error: |
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 | |||
262 | void v9fs_session_cancel(struct v9fs_session_info *v9ses) { | 293 | void 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 7d3a1018db52..a7d567192998 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 | */ | ||
34 | enum 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 | |||
51 | enum 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 | ||
29 | struct v9fs_session_info { | 80 | struct 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 */ | ||
49 | enum { | ||
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 */ | ||
59 | enum { | ||
60 | CACHE_NONE, /* default */ | ||
61 | CACHE_LOOSE, /* no consistency */ | ||
62 | }; | ||
63 | |||
64 | extern struct dentry *v9fs_debugfs_root; | 99 | extern struct dentry *v9fs_debugfs_root; |
65 | 100 | ||
66 | struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, | 101 | struct 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 6248f0e727a3..97d3aed57983 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 0924d4477da3..88e3787c6ea9 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 a616fff8906d..0d55affe37d4 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 6a28842052ea..40fa807bd929 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 | |||
132 | int v9fs_uflags2omode(int uflags) | 138 | int 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 | |||
315 | static struct inode * | 329 | static struct inode * |
316 | v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, | 330 | v9fs_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 | */ |
392 | static struct p9_fid * | 409 | static 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 | ||
1002 | static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p) | 1020 | static void |
1021 | v9fs_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 | |||
1011 | static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | 1039 | static 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 | |||
1065 | static int | 1089 | static int |
1066 | v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, | 1090 | v9fs_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 a452ac67fc94..bf59c3960494 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 | ||
172 | error: | 170 | release_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 | ||
176 | free_stat: | ||
177 | kfree(st); | ||
178 | |||
179 | clunk_fid: | ||
180 | p9_client_clunk(fid); | ||
181 | |||
182 | close_session: | ||
183 | v9fs_session_close(v9ses); | ||
184 | kfree(v9ses); | ||
185 | |||
187 | return retval; | 186 | return retval; |
188 | } | 187 | } |
189 | 188 | ||
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index d5bd497ab9cb..223b1917093e 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -48,7 +48,7 @@ struct affs_ext_key { | |||
48 | * affs fs inode data in memory | 48 | * affs fs inode data in memory |
49 | */ | 49 | */ |
50 | struct affs_inode_info { | 50 | struct affs_inode_info { |
51 | u32 i_opencnt; | 51 | atomic_t i_opencnt; |
52 | struct semaphore i_link_lock; /* Protects internal inode access. */ | 52 | struct semaphore i_link_lock; /* Protects internal inode access. */ |
53 | struct semaphore i_ext_lock; /* Protects internal inode access. */ | 53 | struct semaphore i_ext_lock; /* Protects internal inode access. */ |
54 | #define i_hash_lock i_ext_lock | 54 | #define i_hash_lock i_ext_lock |
@@ -170,8 +170,6 @@ extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
170 | extern unsigned long affs_parent_ino(struct inode *dir); | 170 | extern unsigned long affs_parent_ino(struct inode *dir); |
171 | extern struct inode *affs_new_inode(struct inode *dir); | 171 | extern struct inode *affs_new_inode(struct inode *dir); |
172 | extern int affs_notify_change(struct dentry *dentry, struct iattr *attr); | 172 | extern int affs_notify_change(struct dentry *dentry, struct iattr *attr); |
173 | extern void affs_put_inode(struct inode *inode); | ||
174 | extern void affs_drop_inode(struct inode *inode); | ||
175 | extern void affs_delete_inode(struct inode *inode); | 173 | extern void affs_delete_inode(struct inode *inode); |
176 | extern void affs_clear_inode(struct inode *inode); | 174 | extern void affs_clear_inode(struct inode *inode); |
177 | extern struct inode *affs_iget(struct super_block *sb, | 175 | extern struct inode *affs_iget(struct super_block *sb, |
diff --git a/fs/affs/file.c b/fs/affs/file.c index 1a4f092f24ef..6eac7bdeec94 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -48,8 +48,9 @@ affs_file_open(struct inode *inode, struct file *filp) | |||
48 | { | 48 | { |
49 | if (atomic_read(&filp->f_count) != 1) | 49 | if (atomic_read(&filp->f_count) != 1) |
50 | return 0; | 50 | return 0; |
51 | pr_debug("AFFS: open(%d)\n", AFFS_I(inode)->i_opencnt); | 51 | pr_debug("AFFS: open(%lu,%d)\n", |
52 | AFFS_I(inode)->i_opencnt++; | 52 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); |
53 | atomic_inc(&AFFS_I(inode)->i_opencnt); | ||
53 | return 0; | 54 | return 0; |
54 | } | 55 | } |
55 | 56 | ||
@@ -58,10 +59,16 @@ affs_file_release(struct inode *inode, struct file *filp) | |||
58 | { | 59 | { |
59 | if (atomic_read(&filp->f_count) != 0) | 60 | if (atomic_read(&filp->f_count) != 0) |
60 | return 0; | 61 | return 0; |
61 | pr_debug("AFFS: release(%d)\n", AFFS_I(inode)->i_opencnt); | 62 | pr_debug("AFFS: release(%lu, %d)\n", |
62 | AFFS_I(inode)->i_opencnt--; | 63 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); |
63 | if (!AFFS_I(inode)->i_opencnt) | 64 | |
65 | if (atomic_dec_and_test(&AFFS_I(inode)->i_opencnt)) { | ||
66 | mutex_lock(&inode->i_mutex); | ||
67 | if (inode->i_size != AFFS_I(inode)->mmu_private) | ||
68 | affs_truncate(inode); | ||
64 | affs_free_prealloc(inode); | 69 | affs_free_prealloc(inode); |
70 | mutex_unlock(&inode->i_mutex); | ||
71 | } | ||
65 | 72 | ||
66 | return 0; | 73 | return 0; |
67 | } | 74 | } |
@@ -180,7 +187,7 @@ affs_get_extblock(struct inode *inode, u32 ext) | |||
180 | /* inline the simplest case: same extended block as last time */ | 187 | /* inline the simplest case: same extended block as last time */ |
181 | struct buffer_head *bh = AFFS_I(inode)->i_ext_bh; | 188 | struct buffer_head *bh = AFFS_I(inode)->i_ext_bh; |
182 | if (ext == AFFS_I(inode)->i_ext_last) | 189 | if (ext == AFFS_I(inode)->i_ext_last) |
183 | atomic_inc(&bh->b_count); | 190 | get_bh(bh); |
184 | else | 191 | else |
185 | /* we have to do more (not inlined) */ | 192 | /* we have to do more (not inlined) */ |
186 | bh = affs_get_extblock_slow(inode, ext); | 193 | bh = affs_get_extblock_slow(inode, ext); |
@@ -306,7 +313,7 @@ store_ext: | |||
306 | affs_brelse(AFFS_I(inode)->i_ext_bh); | 313 | affs_brelse(AFFS_I(inode)->i_ext_bh); |
307 | AFFS_I(inode)->i_ext_last = ext; | 314 | AFFS_I(inode)->i_ext_last = ext; |
308 | AFFS_I(inode)->i_ext_bh = bh; | 315 | AFFS_I(inode)->i_ext_bh = bh; |
309 | atomic_inc(&bh->b_count); | 316 | get_bh(bh); |
310 | 317 | ||
311 | return bh; | 318 | return bh; |
312 | 319 | ||
@@ -324,7 +331,6 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul | |||
324 | 331 | ||
325 | pr_debug("AFFS: get_block(%u, %lu)\n", (u32)inode->i_ino, (unsigned long)block); | 332 | pr_debug("AFFS: get_block(%u, %lu)\n", (u32)inode->i_ino, (unsigned long)block); |
326 | 333 | ||
327 | |||
328 | BUG_ON(block > (sector_t)0x7fffffffUL); | 334 | BUG_ON(block > (sector_t)0x7fffffffUL); |
329 | 335 | ||
330 | if (block >= AFFS_I(inode)->i_blkcnt) { | 336 | if (block >= AFFS_I(inode)->i_blkcnt) { |
@@ -827,6 +833,8 @@ affs_truncate(struct inode *inode) | |||
827 | res = mapping->a_ops->write_begin(NULL, mapping, size, 0, 0, &page, &fsdata); | 833 | res = mapping->a_ops->write_begin(NULL, mapping, size, 0, 0, &page, &fsdata); |
828 | if (!res) | 834 | if (!res) |
829 | res = mapping->a_ops->write_end(NULL, mapping, size, 0, 0, page, fsdata); | 835 | res = mapping->a_ops->write_end(NULL, mapping, size, 0, 0, page, fsdata); |
836 | else | ||
837 | inode->i_size = AFFS_I(inode)->mmu_private; | ||
830 | mark_inode_dirty(inode); | 838 | mark_inode_dirty(inode); |
831 | return; | 839 | return; |
832 | } else if (inode->i_size == AFFS_I(inode)->mmu_private) | 840 | } else if (inode->i_size == AFFS_I(inode)->mmu_private) |
@@ -862,6 +870,7 @@ affs_truncate(struct inode *inode) | |||
862 | blk++; | 870 | blk++; |
863 | } else | 871 | } else |
864 | AFFS_HEAD(ext_bh)->first_data = 0; | 872 | AFFS_HEAD(ext_bh)->first_data = 0; |
873 | AFFS_HEAD(ext_bh)->block_count = cpu_to_be32(i); | ||
865 | size = AFFS_SB(sb)->s_hashsize; | 874 | size = AFFS_SB(sb)->s_hashsize; |
866 | if (size > blkcnt - blk + i) | 875 | if (size > blkcnt - blk + i) |
867 | size = blkcnt - blk + i; | 876 | size = blkcnt - blk + i; |
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 27fe6cbe43ae..a13b334a3910 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
@@ -58,7 +58,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
58 | AFFS_I(inode)->i_extcnt = 1; | 58 | AFFS_I(inode)->i_extcnt = 1; |
59 | AFFS_I(inode)->i_ext_last = ~1; | 59 | AFFS_I(inode)->i_ext_last = ~1; |
60 | AFFS_I(inode)->i_protect = prot; | 60 | AFFS_I(inode)->i_protect = prot; |
61 | AFFS_I(inode)->i_opencnt = 0; | 61 | atomic_set(&AFFS_I(inode)->i_opencnt, 0); |
62 | AFFS_I(inode)->i_blkcnt = 0; | 62 | AFFS_I(inode)->i_blkcnt = 0; |
63 | AFFS_I(inode)->i_lc = NULL; | 63 | AFFS_I(inode)->i_lc = NULL; |
64 | AFFS_I(inode)->i_lc_size = 0; | 64 | AFFS_I(inode)->i_lc_size = 0; |
@@ -108,8 +108,6 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) | |||
108 | inode->i_mode |= S_IFDIR; | 108 | inode->i_mode |= S_IFDIR; |
109 | } else | 109 | } else |
110 | inode->i_mode = S_IRUGO | S_IXUGO | S_IWUSR | S_IFDIR; | 110 | inode->i_mode = S_IRUGO | S_IXUGO | S_IWUSR | S_IFDIR; |
111 | if (tail->link_chain) | ||
112 | inode->i_nlink = 2; | ||
113 | /* Maybe it should be controlled by mount parameter? */ | 111 | /* Maybe it should be controlled by mount parameter? */ |
114 | //inode->i_mode |= S_ISVTX; | 112 | //inode->i_mode |= S_ISVTX; |
115 | inode->i_op = &affs_dir_inode_operations; | 113 | inode->i_op = &affs_dir_inode_operations; |
@@ -245,31 +243,12 @@ out: | |||
245 | } | 243 | } |
246 | 244 | ||
247 | void | 245 | void |
248 | affs_put_inode(struct inode *inode) | ||
249 | { | ||
250 | pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); | ||
251 | affs_free_prealloc(inode); | ||
252 | } | ||
253 | |||
254 | void | ||
255 | affs_drop_inode(struct inode *inode) | ||
256 | { | ||
257 | mutex_lock(&inode->i_mutex); | ||
258 | if (inode->i_size != AFFS_I(inode)->mmu_private) | ||
259 | affs_truncate(inode); | ||
260 | mutex_unlock(&inode->i_mutex); | ||
261 | |||
262 | generic_drop_inode(inode); | ||
263 | } | ||
264 | |||
265 | void | ||
266 | affs_delete_inode(struct inode *inode) | 246 | affs_delete_inode(struct inode *inode) |
267 | { | 247 | { |
268 | pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); | 248 | pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); |
269 | truncate_inode_pages(&inode->i_data, 0); | 249 | truncate_inode_pages(&inode->i_data, 0); |
270 | inode->i_size = 0; | 250 | inode->i_size = 0; |
271 | if (S_ISREG(inode->i_mode)) | 251 | affs_truncate(inode); |
272 | affs_truncate(inode); | ||
273 | clear_inode(inode); | 252 | clear_inode(inode); |
274 | affs_free_block(inode->i_sb, inode->i_ino); | 253 | affs_free_block(inode->i_sb, inode->i_ino); |
275 | } | 254 | } |
@@ -277,9 +256,12 @@ affs_delete_inode(struct inode *inode) | |||
277 | void | 256 | void |
278 | affs_clear_inode(struct inode *inode) | 257 | affs_clear_inode(struct inode *inode) |
279 | { | 258 | { |
280 | unsigned long cache_page = (unsigned long) AFFS_I(inode)->i_lc; | 259 | unsigned long cache_page; |
281 | 260 | ||
282 | pr_debug("AFFS: clear_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); | 261 | pr_debug("AFFS: clear_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); |
262 | |||
263 | affs_free_prealloc(inode); | ||
264 | cache_page = (unsigned long)AFFS_I(inode)->i_lc; | ||
283 | if (cache_page) { | 265 | if (cache_page) { |
284 | pr_debug("AFFS: freeing ext cache\n"); | 266 | pr_debug("AFFS: freeing ext cache\n"); |
285 | AFFS_I(inode)->i_lc = NULL; | 267 | AFFS_I(inode)->i_lc = NULL; |
@@ -316,7 +298,7 @@ affs_new_inode(struct inode *dir) | |||
316 | inode->i_ino = block; | 298 | inode->i_ino = block; |
317 | inode->i_nlink = 1; | 299 | inode->i_nlink = 1; |
318 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; | 300 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; |
319 | AFFS_I(inode)->i_opencnt = 0; | 301 | atomic_set(&AFFS_I(inode)->i_opencnt, 0); |
320 | AFFS_I(inode)->i_blkcnt = 0; | 302 | AFFS_I(inode)->i_blkcnt = 0; |
321 | AFFS_I(inode)->i_lc = NULL; | 303 | AFFS_I(inode)->i_lc = NULL; |
322 | AFFS_I(inode)->i_lc_size = 0; | 304 | AFFS_I(inode)->i_lc_size = 0; |
@@ -369,12 +351,12 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3 | |||
369 | switch (type) { | 351 | switch (type) { |
370 | case ST_LINKFILE: | 352 | case ST_LINKFILE: |
371 | case ST_LINKDIR: | 353 | case ST_LINKDIR: |
372 | inode_bh = bh; | ||
373 | retval = -ENOSPC; | 354 | retval = -ENOSPC; |
374 | block = affs_alloc_block(dir, dir->i_ino); | 355 | block = affs_alloc_block(dir, dir->i_ino); |
375 | if (!block) | 356 | if (!block) |
376 | goto err; | 357 | goto err; |
377 | retval = -EIO; | 358 | retval = -EIO; |
359 | inode_bh = bh; | ||
378 | bh = affs_getzeroblk(sb, block); | 360 | bh = affs_getzeroblk(sb, block); |
379 | if (!bh) | 361 | if (!bh) |
380 | goto err; | 362 | goto err; |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index 2218f1ee71ce..cfcf1b6cf82b 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -234,7 +234,8 @@ affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
234 | int | 234 | int |
235 | affs_unlink(struct inode *dir, struct dentry *dentry) | 235 | affs_unlink(struct inode *dir, struct dentry *dentry) |
236 | { | 236 | { |
237 | pr_debug("AFFS: unlink(dir=%d, \"%.*s\")\n", (u32)dir->i_ino, | 237 | pr_debug("AFFS: unlink(dir=%d, %lu \"%.*s\")\n", (u32)dir->i_ino, |
238 | dentry->d_inode->i_ino, | ||
238 | (int)dentry->d_name.len, dentry->d_name.name); | 239 | (int)dentry->d_name.len, dentry->d_name.name); |
239 | 240 | ||
240 | return affs_remove_header(dentry); | 241 | return affs_remove_header(dentry); |
@@ -302,7 +303,8 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
302 | int | 303 | int |
303 | affs_rmdir(struct inode *dir, struct dentry *dentry) | 304 | affs_rmdir(struct inode *dir, struct dentry *dentry) |
304 | { | 305 | { |
305 | pr_debug("AFFS: rmdir(dir=%u, \"%.*s\")\n", (u32)dir->i_ino, | 306 | pr_debug("AFFS: rmdir(dir=%u, %lu \"%.*s\")\n", (u32)dir->i_ino, |
307 | dentry->d_inode->i_ino, | ||
306 | (int)dentry->d_name.len, dentry->d_name.name); | 308 | (int)dentry->d_name.len, dentry->d_name.name); |
307 | 309 | ||
308 | return affs_remove_header(dentry); | 310 | return affs_remove_header(dentry); |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 01d25d532541..d214837d5e42 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -71,12 +71,18 @@ static struct kmem_cache * affs_inode_cachep; | |||
71 | 71 | ||
72 | static struct inode *affs_alloc_inode(struct super_block *sb) | 72 | static struct inode *affs_alloc_inode(struct super_block *sb) |
73 | { | 73 | { |
74 | struct affs_inode_info *ei; | 74 | struct affs_inode_info *i; |
75 | ei = (struct affs_inode_info *)kmem_cache_alloc(affs_inode_cachep, GFP_KERNEL); | 75 | |
76 | if (!ei) | 76 | i = kmem_cache_alloc(affs_inode_cachep, GFP_KERNEL); |
77 | if (!i) | ||
77 | return NULL; | 78 | return NULL; |
78 | ei->vfs_inode.i_version = 1; | 79 | |
79 | return &ei->vfs_inode; | 80 | i->vfs_inode.i_version = 1; |
81 | i->i_lc = NULL; | ||
82 | i->i_ext_bh = NULL; | ||
83 | i->i_pa_cnt = 0; | ||
84 | |||
85 | return &i->vfs_inode; | ||
80 | } | 86 | } |
81 | 87 | ||
82 | static void affs_destroy_inode(struct inode *inode) | 88 | static void affs_destroy_inode(struct inode *inode) |
@@ -114,8 +120,6 @@ static const struct super_operations affs_sops = { | |||
114 | .alloc_inode = affs_alloc_inode, | 120 | .alloc_inode = affs_alloc_inode, |
115 | .destroy_inode = affs_destroy_inode, | 121 | .destroy_inode = affs_destroy_inode, |
116 | .write_inode = affs_write_inode, | 122 | .write_inode = affs_write_inode, |
117 | .put_inode = affs_put_inode, | ||
118 | .drop_inode = affs_drop_inode, | ||
119 | .delete_inode = affs_delete_inode, | 123 | .delete_inode = affs_delete_inode, |
120 | .clear_inode = affs_clear_inode, | 124 | .clear_inode = affs_clear_inode, |
121 | .put_super = affs_put_super, | 125 | .put_super = affs_put_super, |
@@ -158,7 +158,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs) | |||
158 | 158 | ||
159 | bio_init(bio); | 159 | bio_init(bio); |
160 | if (likely(nr_iovecs)) { | 160 | if (likely(nr_iovecs)) { |
161 | unsigned long idx = 0; /* shut up gcc */ | 161 | unsigned long uninitialized_var(idx); |
162 | 162 | ||
163 | bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs); | 163 | bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs); |
164 | if (unlikely(!bvl)) { | 164 | if (unlikely(!bvl)) { |
@@ -963,6 +963,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err) | |||
963 | * @data: pointer to buffer to copy | 963 | * @data: pointer to buffer to copy |
964 | * @len: length in bytes | 964 | * @len: length in bytes |
965 | * @gfp_mask: allocation flags for bio and page allocation | 965 | * @gfp_mask: allocation flags for bio and page allocation |
966 | * @reading: data direction is READ | ||
966 | * | 967 | * |
967 | * copy the kernel address into a bio suitable for io to a block | 968 | * copy the kernel address into a bio suitable for io to a block |
968 | * device. Returns an error pointer in case of error. | 969 | * device. Returns an error pointer in case of error. |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 05c9da6181c3..8355e918fddf 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,3 +1,6 @@ | |||
1 | Version 1.53 | ||
2 | ------------ | ||
3 | |||
1 | Version 1.52 | 4 | Version 1.52 |
2 | ------------ | 5 | ------------ |
3 | Fix oops on second mount to server when null auth is used. | 6 | Fix oops on second mount to server when null auth is used. |
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index bcda2c6b6a04..cb52cbbe45ff 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -460,8 +460,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
460 | unsigned char *sequence_end; | 460 | unsigned char *sequence_end; |
461 | unsigned long *oid = NULL; | 461 | unsigned long *oid = NULL; |
462 | unsigned int cls, con, tag, oidlen, rc; | 462 | unsigned int cls, con, tag, oidlen, rc; |
463 | int use_ntlmssp = FALSE; | 463 | bool use_ntlmssp = false; |
464 | int use_kerberos = FALSE; | 464 | bool use_kerberos = false; |
465 | 465 | ||
466 | *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/ | 466 | *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/ |
467 | 467 | ||
@@ -561,15 +561,15 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
561 | if (compare_oid(oid, oidlen, | 561 | if (compare_oid(oid, oidlen, |
562 | MSKRB5_OID, | 562 | MSKRB5_OID, |
563 | MSKRB5_OID_LEN)) | 563 | MSKRB5_OID_LEN)) |
564 | use_kerberos = TRUE; | 564 | use_kerberos = true; |
565 | else if (compare_oid(oid, oidlen, | 565 | else if (compare_oid(oid, oidlen, |
566 | KRB5_OID, | 566 | KRB5_OID, |
567 | KRB5_OID_LEN)) | 567 | KRB5_OID_LEN)) |
568 | use_kerberos = TRUE; | 568 | use_kerberos = true; |
569 | else if (compare_oid(oid, oidlen, | 569 | else if (compare_oid(oid, oidlen, |
570 | NTLMSSP_OID, | 570 | NTLMSSP_OID, |
571 | NTLMSSP_OID_LEN)) | 571 | NTLMSSP_OID_LEN)) |
572 | use_ntlmssp = TRUE; | 572 | use_ntlmssp = true; |
573 | 573 | ||
574 | kfree(oid); | 574 | kfree(oid); |
575 | } | 575 | } |
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index 95024c066d89..f6fdecf6598c 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
@@ -93,15 +93,11 @@ static char *cifs_get_share_name(const char *node_name) | |||
93 | /* find sharename end */ | 93 | /* find sharename end */ |
94 | pSep++; | 94 | pSep++; |
95 | pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC)); | 95 | pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC)); |
96 | if (!pSep) { | 96 | if (pSep) { |
97 | cERROR(1, ("%s:2 cant find share name in node name: %s", | 97 | /* trim path up to sharename end |
98 | __func__, node_name)); | 98 | * now we have share name in UNC */ |
99 | kfree(UNC); | 99 | *pSep = 0; |
100 | return NULL; | ||
101 | } | 100 | } |
102 | /* trim path up to sharename end | ||
103 | * * now we have share name in UNC */ | ||
104 | *pSep = 0; | ||
105 | 101 | ||
106 | return UNC; | 102 | return UNC; |
107 | } | 103 | } |
@@ -188,7 +184,7 @@ static char *compose_mount_options(const char *sb_mountdata, | |||
188 | tkn_e = strchr(tkn_e+1, '\\'); | 184 | tkn_e = strchr(tkn_e+1, '\\'); |
189 | if (tkn_e) { | 185 | if (tkn_e) { |
190 | strcat(mountdata, ",prefixpath="); | 186 | strcat(mountdata, ",prefixpath="); |
191 | strcat(mountdata, tkn_e); | 187 | strcat(mountdata, tkn_e+1); |
192 | } | 188 | } |
193 | } | 189 | } |
194 | 190 | ||
@@ -244,7 +240,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) | |||
244 | return NULL; | 240 | return NULL; |
245 | 241 | ||
246 | if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { | 242 | if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { |
247 | /* we should use full path name to correct working with DFS */ | 243 | int i; |
244 | /* we should use full path name for correct working with DFS */ | ||
248 | l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) + | 245 | l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) + |
249 | strnlen(search_path, MAX_PATHCONF) + 1; | 246 | strnlen(search_path, MAX_PATHCONF) + 1; |
250 | tmp_path = kmalloc(l_max_len, GFP_KERNEL); | 247 | tmp_path = kmalloc(l_max_len, GFP_KERNEL); |
@@ -253,8 +250,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) | |||
253 | return NULL; | 250 | return NULL; |
254 | } | 251 | } |
255 | strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); | 252 | strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); |
256 | strcat(tmp_path, search_path); | ||
257 | tmp_path[l_max_len-1] = 0; | 253 | tmp_path[l_max_len-1] = 0; |
254 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | ||
255 | for (i = 0; i < l_max_len; i++) { | ||
256 | if (tmp_path[i] == '\\') | ||
257 | tmp_path[i] = '/'; | ||
258 | } | ||
259 | strncat(tmp_path, search_path, l_max_len - strlen(tmp_path)); | ||
260 | |||
258 | full_path = tmp_path; | 261 | full_path = tmp_path; |
259 | kfree(search_path); | 262 | kfree(search_path); |
260 | } else { | 263 | } else { |
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index e99d4faf5f02..34902cff5400 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -559,7 +559,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, | |||
559 | const char *path, const __u16 *pfid) | 559 | const char *path, const __u16 *pfid) |
560 | { | 560 | { |
561 | struct cifsFileInfo *open_file = NULL; | 561 | struct cifsFileInfo *open_file = NULL; |
562 | int unlock_file = FALSE; | 562 | bool unlock_file = false; |
563 | int xid; | 563 | int xid; |
564 | int rc = -EIO; | 564 | int rc = -EIO; |
565 | __u16 fid; | 565 | __u16 fid; |
@@ -586,10 +586,10 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, | |||
586 | cifs_sb = CIFS_SB(sb); | 586 | cifs_sb = CIFS_SB(sb); |
587 | 587 | ||
588 | if (open_file) { | 588 | if (open_file) { |
589 | unlock_file = TRUE; | 589 | unlock_file = true; |
590 | fid = open_file->netfid; | 590 | fid = open_file->netfid; |
591 | } else if (pfid == NULL) { | 591 | } else if (pfid == NULL) { |
592 | int oplock = FALSE; | 592 | int oplock = 0; |
593 | /* open file */ | 593 | /* open file */ |
594 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, | 594 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, |
595 | READ_CONTROL, 0, &fid, &oplock, NULL, | 595 | READ_CONTROL, 0, &fid, &oplock, NULL, |
@@ -604,7 +604,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, | |||
604 | 604 | ||
605 | rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); | 605 | rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); |
606 | cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen)); | 606 | cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen)); |
607 | if (unlock_file == TRUE) /* find_readable_file increments ref count */ | 607 | if (unlock_file == true) /* find_readable_file increments ref count */ |
608 | atomic_dec(&open_file->wrtPending); | 608 | atomic_dec(&open_file->wrtPending); |
609 | else if (pfid == NULL) /* if opened above we have to close the handle */ | 609 | else if (pfid == NULL) /* if opened above we have to close the handle */ |
610 | CIFSSMBClose(xid, cifs_sb->tcon, fid); | 610 | CIFSSMBClose(xid, cifs_sb->tcon, fid); |
@@ -619,7 +619,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
619 | struct inode *inode, const char *path) | 619 | struct inode *inode, const char *path) |
620 | { | 620 | { |
621 | struct cifsFileInfo *open_file; | 621 | struct cifsFileInfo *open_file; |
622 | int unlock_file = FALSE; | 622 | bool unlock_file = false; |
623 | int xid; | 623 | int xid; |
624 | int rc = -EIO; | 624 | int rc = -EIO; |
625 | __u16 fid; | 625 | __u16 fid; |
@@ -640,10 +640,10 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
640 | 640 | ||
641 | open_file = find_readable_file(CIFS_I(inode)); | 641 | open_file = find_readable_file(CIFS_I(inode)); |
642 | if (open_file) { | 642 | if (open_file) { |
643 | unlock_file = TRUE; | 643 | unlock_file = true; |
644 | fid = open_file->netfid; | 644 | fid = open_file->netfid; |
645 | } else { | 645 | } else { |
646 | int oplock = FALSE; | 646 | int oplock = 0; |
647 | /* open file */ | 647 | /* open file */ |
648 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, | 648 | rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, |
649 | WRITE_DAC, 0, &fid, &oplock, NULL, | 649 | WRITE_DAC, 0, &fid, &oplock, NULL, |
@@ -658,7 +658,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
658 | 658 | ||
659 | rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); | 659 | rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); |
660 | cFYI(DBG2, ("SetCIFSACL rc = %d", rc)); | 660 | cFYI(DBG2, ("SetCIFSACL rc = %d", rc)); |
661 | if (unlock_file == TRUE) | 661 | if (unlock_file) |
662 | atomic_dec(&open_file->wrtPending); | 662 | atomic_dec(&open_file->wrtPending); |
663 | else | 663 | else |
664 | CIFSSMBClose(xid, cifs_sb->tcon, fid); | 664 | CIFSSMBClose(xid, cifs_sb->tcon, fid); |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 39c2cbdface7..427a7c695896 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -222,50 +222,50 @@ static int | |||
222 | cifs_statfs(struct dentry *dentry, struct kstatfs *buf) | 222 | cifs_statfs(struct dentry *dentry, struct kstatfs *buf) |
223 | { | 223 | { |
224 | struct super_block *sb = dentry->d_sb; | 224 | struct super_block *sb = dentry->d_sb; |
225 | int xid; | 225 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
226 | struct cifsTconInfo *tcon = cifs_sb->tcon; | ||
226 | int rc = -EOPNOTSUPP; | 227 | int rc = -EOPNOTSUPP; |
227 | struct cifs_sb_info *cifs_sb; | 228 | int xid; |
228 | struct cifsTconInfo *pTcon; | ||
229 | 229 | ||
230 | xid = GetXid(); | 230 | xid = GetXid(); |
231 | 231 | ||
232 | cifs_sb = CIFS_SB(sb); | ||
233 | pTcon = cifs_sb->tcon; | ||
234 | |||
235 | buf->f_type = CIFS_MAGIC_NUMBER; | 232 | buf->f_type = CIFS_MAGIC_NUMBER; |
236 | 233 | ||
237 | /* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */ | 234 | /* |
238 | buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would | 235 | * PATH_MAX may be too long - it would presumably be total path, |
239 | presumably be total path, but note | 236 | * but note that some servers (includinng Samba 3) have a shorter |
240 | that some servers (includinng Samba 3) | 237 | * maximum path. |
241 | have a shorter maximum path */ | 238 | * |
239 | * Instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO. | ||
240 | */ | ||
241 | buf->f_namelen = PATH_MAX; | ||
242 | buf->f_files = 0; /* undefined */ | 242 | buf->f_files = 0; /* undefined */ |
243 | buf->f_ffree = 0; /* unlimited */ | 243 | buf->f_ffree = 0; /* unlimited */ |
244 | 244 | ||
245 | /* BB we could add a second check for a QFS Unix capability bit */ | 245 | /* |
246 | /* BB FIXME check CIFS_POSIX_EXTENSIONS Unix cap first FIXME BB */ | 246 | * We could add a second check for a QFS Unix capability bit |
247 | if ((pTcon->ses->capabilities & CAP_UNIX) && (CIFS_POSIX_EXTENSIONS & | 247 | */ |
248 | le64_to_cpu(pTcon->fsUnixInfo.Capability))) | 248 | if ((tcon->ses->capabilities & CAP_UNIX) && |
249 | rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf); | 249 | (CIFS_POSIX_EXTENSIONS & le64_to_cpu(tcon->fsUnixInfo.Capability))) |
250 | 250 | rc = CIFSSMBQFSPosixInfo(xid, tcon, buf); | |
251 | /* Only need to call the old QFSInfo if failed | 251 | |
252 | on newer one */ | 252 | /* |
253 | if (rc) | 253 | * Only need to call the old QFSInfo if failed on newer one, |
254 | if (pTcon->ses->capabilities & CAP_NT_SMBS) | 254 | * e.g. by OS/2. |
255 | rc = CIFSSMBQFSInfo(xid, pTcon, buf); /* not supported by OS2 */ | 255 | **/ |
256 | 256 | if (rc && (tcon->ses->capabilities & CAP_NT_SMBS)) | |
257 | /* Some old Windows servers also do not support level 103, retry with | 257 | rc = CIFSSMBQFSInfo(xid, tcon, buf); |
258 | older level one if old server failed the previous call or we | 258 | |
259 | bypassed it because we detected that this was an older LANMAN sess */ | 259 | /* |
260 | * Some old Windows servers also do not support level 103, retry with | ||
261 | * older level one if old server failed the previous call or we | ||
262 | * bypassed it because we detected that this was an older LANMAN sess | ||
263 | */ | ||
260 | if (rc) | 264 | if (rc) |
261 | rc = SMBOldQFSInfo(xid, pTcon, buf); | 265 | rc = SMBOldQFSInfo(xid, tcon, buf); |
262 | /* int f_type; | 266 | |
263 | __fsid_t f_fsid; | ||
264 | int f_namelen; */ | ||
265 | /* BB get from info in tcon struct at mount time call to QFSAttrInfo */ | ||
266 | FreeXid(xid); | 267 | FreeXid(xid); |
267 | return 0; /* always return success? what if volume is no | 268 | return 0; |
268 | longer available? */ | ||
269 | } | 269 | } |
270 | 270 | ||
271 | static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd) | 271 | static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd) |
@@ -306,8 +306,8 @@ cifs_alloc_inode(struct super_block *sb) | |||
306 | /* Until the file is open and we have gotten oplock | 306 | /* Until the file is open and we have gotten oplock |
307 | info back from the server, can not assume caching of | 307 | info back from the server, can not assume caching of |
308 | file data or metadata */ | 308 | file data or metadata */ |
309 | cifs_inode->clientCanCacheRead = FALSE; | 309 | cifs_inode->clientCanCacheRead = false; |
310 | cifs_inode->clientCanCacheAll = FALSE; | 310 | cifs_inode->clientCanCacheAll = false; |
311 | cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ | 311 | cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ |
312 | 312 | ||
313 | /* Can not set i_flags here - they get immediately overwritten | 313 | /* Can not set i_flags here - they get immediately overwritten |
@@ -940,7 +940,7 @@ static int cifs_oplock_thread(void *dummyarg) | |||
940 | rc = CIFSSMBLock(0, pTcon, netfid, | 940 | rc = CIFSSMBLock(0, pTcon, netfid, |
941 | 0 /* len */ , 0 /* offset */, 0, | 941 | 0 /* len */ , 0 /* offset */, 0, |
942 | 0, LOCKING_ANDX_OPLOCK_RELEASE, | 942 | 0, LOCKING_ANDX_OPLOCK_RELEASE, |
943 | 0 /* wait flag */); | 943 | false /* wait flag */); |
944 | cFYI(1, ("Oplock release rc = %d", rc)); | 944 | cFYI(1, ("Oplock release rc = %d", rc)); |
945 | } | 945 | } |
946 | } else | 946 | } else |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index e1dd9f32e1d7..cd1301a09b3b 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -24,14 +24,6 @@ | |||
24 | 24 | ||
25 | #define ROOT_I 2 | 25 | #define ROOT_I 2 |
26 | 26 | ||
27 | #ifndef FALSE | ||
28 | #define FALSE 0 | ||
29 | #endif | ||
30 | |||
31 | #ifndef TRUE | ||
32 | #define TRUE 1 | ||
33 | #endif | ||
34 | |||
35 | extern struct file_system_type cifs_fs_type; | 27 | extern struct file_system_type cifs_fs_type; |
36 | extern const struct address_space_operations cifs_addr_ops; | 28 | extern const struct address_space_operations cifs_addr_ops; |
37 | extern const struct address_space_operations cifs_addr_ops_smallbuf; | 29 | extern const struct address_space_operations cifs_addr_ops_smallbuf; |
@@ -110,5 +102,5 @@ extern int cifs_ioctl(struct inode *inode, struct file *filep, | |||
110 | extern const struct export_operations cifs_export_ops; | 102 | extern const struct export_operations cifs_export_ops; |
111 | #endif /* EXPERIMENTAL */ | 103 | #endif /* EXPERIMENTAL */ |
112 | 104 | ||
113 | #define CIFS_VERSION "1.52" | 105 | #define CIFS_VERSION "1.53" |
114 | #endif /* _CIFSFS_H */ | 106 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 69a2e1942542..b7d9f698e63e 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -57,14 +57,6 @@ | |||
57 | 57 | ||
58 | #include "cifspdu.h" | 58 | #include "cifspdu.h" |
59 | 59 | ||
60 | #ifndef FALSE | ||
61 | #define FALSE 0 | ||
62 | #endif | ||
63 | |||
64 | #ifndef TRUE | ||
65 | #define TRUE 1 | ||
66 | #endif | ||
67 | |||
68 | #ifndef XATTR_DOS_ATTRIB | 60 | #ifndef XATTR_DOS_ATTRIB |
69 | #define XATTR_DOS_ATTRIB "user.DOSATTRIB" | 61 | #define XATTR_DOS_ATTRIB "user.DOSATTRIB" |
70 | #endif | 62 | #endif |
@@ -147,7 +139,7 @@ struct TCP_Server_Info { | |||
147 | enum protocolEnum protocolType; | 139 | enum protocolEnum protocolType; |
148 | char versionMajor; | 140 | char versionMajor; |
149 | char versionMinor; | 141 | char versionMinor; |
150 | unsigned svlocal:1; /* local server or remote */ | 142 | bool svlocal:1; /* local server or remote */ |
151 | atomic_t socketUseCount; /* number of open cifs sessions on socket */ | 143 | atomic_t socketUseCount; /* number of open cifs sessions on socket */ |
152 | atomic_t inFlight; /* number of requests on the wire to server */ | 144 | atomic_t inFlight; /* number of requests on the wire to server */ |
153 | #ifdef CONFIG_CIFS_STATS2 | 145 | #ifdef CONFIG_CIFS_STATS2 |
@@ -286,10 +278,10 @@ struct cifsTconInfo { | |||
286 | FILE_SYSTEM_DEVICE_INFO fsDevInfo; | 278 | FILE_SYSTEM_DEVICE_INFO fsDevInfo; |
287 | FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */ | 279 | FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */ |
288 | FILE_SYSTEM_UNIX_INFO fsUnixInfo; | 280 | FILE_SYSTEM_UNIX_INFO fsUnixInfo; |
289 | unsigned ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */ | 281 | bool ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */ |
290 | unsigned retry:1; | 282 | bool retry:1; |
291 | unsigned nocase:1; | 283 | bool nocase:1; |
292 | unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol | 284 | bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol |
293 | for this mount even if server would support */ | 285 | for this mount even if server would support */ |
294 | /* BB add field for back pointer to sb struct(s)? */ | 286 | /* BB add field for back pointer to sb struct(s)? */ |
295 | }; | 287 | }; |
@@ -317,10 +309,10 @@ struct cifs_search_info { | |||
317 | char *srch_entries_start; | 309 | char *srch_entries_start; |
318 | char *presume_name; | 310 | char *presume_name; |
319 | unsigned int resume_name_len; | 311 | unsigned int resume_name_len; |
320 | unsigned endOfSearch:1; | 312 | bool endOfSearch:1; |
321 | unsigned emptyDir:1; | 313 | bool emptyDir:1; |
322 | unsigned unicode:1; | 314 | bool unicode:1; |
323 | unsigned smallBuf:1; /* so we know which buf_release function to call */ | 315 | bool smallBuf:1; /* so we know which buf_release function to call */ |
324 | }; | 316 | }; |
325 | 317 | ||
326 | struct cifsFileInfo { | 318 | struct cifsFileInfo { |
@@ -335,9 +327,9 @@ struct cifsFileInfo { | |||
335 | struct inode *pInode; /* needed for oplock break */ | 327 | struct inode *pInode; /* needed for oplock break */ |
336 | struct mutex lock_mutex; | 328 | struct mutex lock_mutex; |
337 | struct list_head llist; /* list of byte range locks we have. */ | 329 | struct list_head llist; /* list of byte range locks we have. */ |
338 | unsigned closePend:1; /* file is marked to close */ | 330 | bool closePend:1; /* file is marked to close */ |
339 | unsigned invalidHandle:1; /* file closed via session abend */ | 331 | bool invalidHandle:1; /* file closed via session abend */ |
340 | unsigned messageMode:1; /* for pipes: message vs byte mode */ | 332 | bool messageMode:1; /* for pipes: message vs byte mode */ |
341 | atomic_t wrtPending; /* handle in use - defer close */ | 333 | atomic_t wrtPending; /* handle in use - defer close */ |
342 | struct semaphore fh_sem; /* prevents reopen race after dead ses*/ | 334 | struct semaphore fh_sem; /* prevents reopen race after dead ses*/ |
343 | char *search_resume_name; /* BB removeme BB */ | 335 | char *search_resume_name; /* BB removeme BB */ |
@@ -356,9 +348,9 @@ struct cifsInodeInfo { | |||
356 | __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ | 348 | __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ |
357 | atomic_t inUse; /* num concurrent users (local openers cifs) of file*/ | 349 | atomic_t inUse; /* num concurrent users (local openers cifs) of file*/ |
358 | unsigned long time; /* jiffies of last update/check of inode */ | 350 | unsigned long time; /* jiffies of last update/check of inode */ |
359 | unsigned clientCanCacheRead:1; /* read oplock */ | 351 | bool clientCanCacheRead:1; /* read oplock */ |
360 | unsigned clientCanCacheAll:1; /* read and writebehind oplock */ | 352 | bool clientCanCacheAll:1; /* read and writebehind oplock */ |
361 | unsigned oplockPending:1; | 353 | bool oplockPending:1; |
362 | struct inode vfs_inode; | 354 | struct inode vfs_inode; |
363 | }; | 355 | }; |
364 | 356 | ||
@@ -426,9 +418,9 @@ struct mid_q_entry { | |||
426 | struct smb_hdr *resp_buf; /* response buffer */ | 418 | struct smb_hdr *resp_buf; /* response buffer */ |
427 | int midState; /* wish this were enum but can not pass to wait_event */ | 419 | int midState; /* wish this were enum but can not pass to wait_event */ |
428 | __u8 command; /* smb command code */ | 420 | __u8 command; /* smb command code */ |
429 | unsigned largeBuf:1; /* if valid response, is pointer to large buf */ | 421 | bool largeBuf:1; /* if valid response, is pointer to large buf */ |
430 | unsigned multiRsp:1; /* multiple trans2 responses for one request */ | 422 | bool multiRsp:1; /* multiple trans2 responses for one request */ |
431 | unsigned multiEnd:1; /* both received */ | 423 | bool multiEnd:1; /* both received */ |
432 | }; | 424 | }; |
433 | 425 | ||
434 | struct oplock_q_entry { | 426 | struct oplock_q_entry { |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 9f49c2f3582c..c43bf4b7a556 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 */ |
@@ -2050,7 +2051,7 @@ typedef struct { | |||
2050 | to 0xFFFF00 */ | 2051 | to 0xFFFF00 */ |
2051 | #define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080 | 2052 | #define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080 |
2052 | #define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x00000100 /* can do SPNEGO crypt */ | 2053 | #define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x00000100 /* can do SPNEGO crypt */ |
2053 | #define CIFS_UNIX_TRANPSORT_ENCRYPTION_MANDATORY_CAP 0x00000200 /* must do */ | 2054 | #define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP 0x00000200 /* must do */ |
2054 | #define CIFS_UNIX_PROXY_CAP 0x00000400 /* Proxy cap: 0xACE ioctl and | 2055 | #define CIFS_UNIX_PROXY_CAP 0x00000400 /* Proxy cap: 0xACE ioctl and |
2055 | QFS PROXY call */ | 2056 | QFS PROXY call */ |
2056 | #ifdef CONFIG_CIFS_POSIX | 2057 | #ifdef CONFIG_CIFS_POSIX |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 50f9fdae19b3..d481f6c5a2be 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -59,8 +59,9 @@ extern int SendReceiveBlockingLock(const unsigned int xid, | |||
59 | struct smb_hdr *out_buf, | 59 | struct smb_hdr *out_buf, |
60 | int *bytes_returned); | 60 | int *bytes_returned); |
61 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); | 61 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); |
62 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); | 62 | extern bool is_valid_oplock_break(struct smb_hdr *smb, |
63 | extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); | 63 | struct TCP_Server_Info *); |
64 | extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); | ||
64 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); | 65 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); |
65 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 66 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
66 | extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *); | 67 | extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *); |
@@ -69,7 +70,7 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr); | |||
69 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); | 70 | extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); |
70 | extern int decode_negTokenInit(unsigned char *security_blob, int length, | 71 | extern int decode_negTokenInit(unsigned char *security_blob, int length, |
71 | enum securityEnum *secType); | 72 | enum securityEnum *secType); |
72 | extern int cifs_inet_pton(int, char *source, void *dst); | 73 | extern int cifs_inet_pton(const int, const char *source, void *dst); |
73 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); | 74 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); |
74 | extern void header_assemble(struct smb_hdr *, char /* command */ , | 75 | extern void header_assemble(struct smb_hdr *, char /* command */ , |
75 | const struct cifsTconInfo *, int /* length of | 76 | const struct cifsTconInfo *, int /* length of |
@@ -187,12 +188,12 @@ extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon, | |||
187 | #endif /* possibly unneeded function */ | 188 | #endif /* possibly unneeded function */ |
188 | extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, | 189 | extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, |
189 | const char *fileName, __u64 size, | 190 | const char *fileName, __u64 size, |
190 | int setAllocationSizeFlag, | 191 | bool setAllocationSizeFlag, |
191 | const struct nls_table *nls_codepage, | 192 | const struct nls_table *nls_codepage, |
192 | int remap_special_chars); | 193 | int remap_special_chars); |
193 | extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, | 194 | extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, |
194 | __u64 size, __u16 fileHandle, __u32 opener_pid, | 195 | __u64 size, __u16 fileHandle, __u32 opener_pid, |
195 | int AllocSizeFlag); | 196 | bool AllocSizeFlag); |
196 | extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon, | 197 | extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon, |
197 | char *full_path, __u64 mode, __u64 uid, | 198 | char *full_path, __u64 mode, __u64 uid, |
198 | __u64 gid, dev_t dev, | 199 | __u64 gid, dev_t dev, |
@@ -291,11 +292,11 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
291 | const __u16 netfid, const __u64 len, | 292 | const __u16 netfid, const __u64 len, |
292 | const __u64 offset, const __u32 numUnlock, | 293 | const __u64 offset, const __u32 numUnlock, |
293 | const __u32 numLock, const __u8 lockType, | 294 | const __u32 numLock, const __u8 lockType, |
294 | const int waitFlag); | 295 | const bool waitFlag); |
295 | extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | 296 | extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, |
296 | const __u16 smb_file_id, const int get_flag, | 297 | const __u16 smb_file_id, const int get_flag, |
297 | const __u64 len, struct file_lock *, | 298 | const __u64 len, struct file_lock *, |
298 | const __u16 lock_type, const int waitFlag); | 299 | const __u16 lock_type, const bool waitFlag); |
299 | extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); | 300 | extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); |
300 | extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); | 301 | extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); |
301 | 302 | ||
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 4728fa982a4e..95fbba4ea7d4 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -95,7 +95,7 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon) | |||
95 | list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { | 95 | list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { |
96 | open_file = list_entry(tmp, struct cifsFileInfo, tlist); | 96 | open_file = list_entry(tmp, struct cifsFileInfo, tlist); |
97 | if (open_file) | 97 | if (open_file) |
98 | open_file->invalidHandle = TRUE; | 98 | open_file->invalidHandle = true; |
99 | } | 99 | } |
100 | write_unlock(&GlobalSMBSeslock); | 100 | write_unlock(&GlobalSMBSeslock); |
101 | /* BB Add call to invalidate_inodes(sb) for all superblocks mounted | 101 | /* BB Add call to invalidate_inodes(sb) for all superblocks mounted |
@@ -141,7 +141,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
141 | if (tcon->ses->server->tcpStatus == | 141 | if (tcon->ses->server->tcpStatus == |
142 | CifsNeedReconnect) { | 142 | CifsNeedReconnect) { |
143 | /* on "soft" mounts we wait once */ | 143 | /* on "soft" mounts we wait once */ |
144 | if ((tcon->retry == FALSE) || | 144 | if (!tcon->retry || |
145 | (tcon->ses->status == CifsExiting)) { | 145 | (tcon->ses->status == CifsExiting)) { |
146 | cFYI(1, ("gave up waiting on " | 146 | cFYI(1, ("gave up waiting on " |
147 | "reconnect in smb_init")); | 147 | "reconnect in smb_init")); |
@@ -289,7 +289,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
289 | if (tcon->ses->server->tcpStatus == | 289 | if (tcon->ses->server->tcpStatus == |
290 | CifsNeedReconnect) { | 290 | CifsNeedReconnect) { |
291 | /* on "soft" mounts we wait once */ | 291 | /* on "soft" mounts we wait once */ |
292 | if ((tcon->retry == FALSE) || | 292 | if (!tcon->retry || |
293 | (tcon->ses->status == CifsExiting)) { | 293 | (tcon->ses->status == CifsExiting)) { |
294 | cFYI(1, ("gave up waiting on " | 294 | cFYI(1, ("gave up waiting on " |
295 | "reconnect in smb_init")); | 295 | "reconnect in smb_init")); |
@@ -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); |
@@ -1686,7 +1682,7 @@ int | |||
1686 | CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | 1682 | CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, |
1687 | const __u16 smb_file_id, const __u64 len, | 1683 | const __u16 smb_file_id, const __u64 len, |
1688 | const __u64 offset, const __u32 numUnlock, | 1684 | const __u64 offset, const __u32 numUnlock, |
1689 | const __u32 numLock, const __u8 lockType, const int waitFlag) | 1685 | const __u32 numLock, const __u8 lockType, const bool waitFlag) |
1690 | { | 1686 | { |
1691 | int rc = 0; | 1687 | int rc = 0; |
1692 | LOCK_REQ *pSMB = NULL; | 1688 | LOCK_REQ *pSMB = NULL; |
@@ -1695,7 +1691,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
1695 | int timeout = 0; | 1691 | int timeout = 0; |
1696 | __u16 count; | 1692 | __u16 count; |
1697 | 1693 | ||
1698 | cFYI(1, ("CIFSSMBLock timeout %d numLock %d", waitFlag, numLock)); | 1694 | cFYI(1, ("CIFSSMBLock timeout %d numLock %d", (int)waitFlag, numLock)); |
1699 | rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB); | 1695 | rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB); |
1700 | 1696 | ||
1701 | if (rc) | 1697 | if (rc) |
@@ -1706,7 +1702,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
1706 | if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { | 1702 | if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { |
1707 | timeout = CIFS_ASYNC_OP; /* no response expected */ | 1703 | timeout = CIFS_ASYNC_OP; /* no response expected */ |
1708 | pSMB->Timeout = 0; | 1704 | pSMB->Timeout = 0; |
1709 | } else if (waitFlag == TRUE) { | 1705 | } else if (waitFlag) { |
1710 | timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */ | 1706 | timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */ |
1711 | pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ | 1707 | pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ |
1712 | } else { | 1708 | } else { |
@@ -1756,7 +1752,7 @@ int | |||
1756 | CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, | 1752 | CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, |
1757 | const __u16 smb_file_id, const int get_flag, const __u64 len, | 1753 | const __u16 smb_file_id, const int get_flag, const __u64 len, |
1758 | struct file_lock *pLockData, const __u16 lock_type, | 1754 | struct file_lock *pLockData, const __u16 lock_type, |
1759 | const int waitFlag) | 1755 | const bool waitFlag) |
1760 | { | 1756 | { |
1761 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 1757 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
1762 | struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; | 1758 | struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; |
@@ -3581,9 +3577,9 @@ findFirstRetry: | |||
3581 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); | 3577 | rc = validate_t2((struct smb_t2_rsp *)pSMBr); |
3582 | if (rc == 0) { | 3578 | if (rc == 0) { |
3583 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) | 3579 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) |
3584 | psrch_inf->unicode = TRUE; | 3580 | psrch_inf->unicode = true; |
3585 | else | 3581 | else |
3586 | psrch_inf->unicode = FALSE; | 3582 | psrch_inf->unicode = false; |
3587 | 3583 | ||
3588 | psrch_inf->ntwrk_buf_start = (char *)pSMBr; | 3584 | psrch_inf->ntwrk_buf_start = (char *)pSMBr; |
3589 | psrch_inf->smallBuf = 0; | 3585 | psrch_inf->smallBuf = 0; |
@@ -3594,9 +3590,9 @@ findFirstRetry: | |||
3594 | le16_to_cpu(pSMBr->t2.ParameterOffset)); | 3590 | le16_to_cpu(pSMBr->t2.ParameterOffset)); |
3595 | 3591 | ||
3596 | if (parms->EndofSearch) | 3592 | if (parms->EndofSearch) |
3597 | psrch_inf->endOfSearch = TRUE; | 3593 | psrch_inf->endOfSearch = true; |
3598 | else | 3594 | else |
3599 | psrch_inf->endOfSearch = FALSE; | 3595 | psrch_inf->endOfSearch = false; |
3600 | 3596 | ||
3601 | psrch_inf->entries_in_buffer = | 3597 | psrch_inf->entries_in_buffer = |
3602 | le16_to_cpu(parms->SearchCount); | 3598 | le16_to_cpu(parms->SearchCount); |
@@ -3624,7 +3620,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3624 | 3620 | ||
3625 | cFYI(1, ("In FindNext")); | 3621 | cFYI(1, ("In FindNext")); |
3626 | 3622 | ||
3627 | if (psrch_inf->endOfSearch == TRUE) | 3623 | if (psrch_inf->endOfSearch) |
3628 | return -ENOENT; | 3624 | return -ENOENT; |
3629 | 3625 | ||
3630 | rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, | 3626 | rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, |
@@ -3682,7 +3678,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3682 | cifs_stats_inc(&tcon->num_fnext); | 3678 | cifs_stats_inc(&tcon->num_fnext); |
3683 | if (rc) { | 3679 | if (rc) { |
3684 | if (rc == -EBADF) { | 3680 | if (rc == -EBADF) { |
3685 | psrch_inf->endOfSearch = TRUE; | 3681 | psrch_inf->endOfSearch = true; |
3686 | rc = 0; /* search probably was closed at end of search*/ | 3682 | rc = 0; /* search probably was closed at end of search*/ |
3687 | } else | 3683 | } else |
3688 | cFYI(1, ("FindNext returned = %d", rc)); | 3684 | cFYI(1, ("FindNext returned = %d", rc)); |
@@ -3692,9 +3688,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3692 | if (rc == 0) { | 3688 | if (rc == 0) { |
3693 | /* BB fixme add lock for file (srch_info) struct here */ | 3689 | /* BB fixme add lock for file (srch_info) struct here */ |
3694 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) | 3690 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) |
3695 | psrch_inf->unicode = TRUE; | 3691 | psrch_inf->unicode = true; |
3696 | else | 3692 | else |
3697 | psrch_inf->unicode = FALSE; | 3693 | psrch_inf->unicode = false; |
3698 | response_data = (char *) &pSMBr->hdr.Protocol + | 3694 | response_data = (char *) &pSMBr->hdr.Protocol + |
3699 | le16_to_cpu(pSMBr->t2.ParameterOffset); | 3695 | le16_to_cpu(pSMBr->t2.ParameterOffset); |
3700 | parms = (T2_FNEXT_RSP_PARMS *)response_data; | 3696 | parms = (T2_FNEXT_RSP_PARMS *)response_data; |
@@ -3709,9 +3705,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
3709 | psrch_inf->ntwrk_buf_start = (char *)pSMB; | 3705 | psrch_inf->ntwrk_buf_start = (char *)pSMB; |
3710 | psrch_inf->smallBuf = 0; | 3706 | psrch_inf->smallBuf = 0; |
3711 | if (parms->EndofSearch) | 3707 | if (parms->EndofSearch) |
3712 | psrch_inf->endOfSearch = TRUE; | 3708 | psrch_inf->endOfSearch = true; |
3713 | else | 3709 | else |
3714 | psrch_inf->endOfSearch = FALSE; | 3710 | psrch_inf->endOfSearch = false; |
3715 | psrch_inf->entries_in_buffer = | 3711 | psrch_inf->entries_in_buffer = |
3716 | le16_to_cpu(parms->SearchCount); | 3712 | le16_to_cpu(parms->SearchCount); |
3717 | psrch_inf->index_of_last_entry += | 3713 | psrch_inf->index_of_last_entry += |
@@ -4586,7 +4582,7 @@ QFSPosixRetry: | |||
4586 | 4582 | ||
4587 | int | 4583 | int |
4588 | CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, | 4584 | CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, |
4589 | __u64 size, int SetAllocation, | 4585 | __u64 size, bool SetAllocation, |
4590 | const struct nls_table *nls_codepage, int remap) | 4586 | const struct nls_table *nls_codepage, int remap) |
4591 | { | 4587 | { |
4592 | struct smb_com_transaction2_spi_req *pSMB = NULL; | 4588 | struct smb_com_transaction2_spi_req *pSMB = NULL; |
@@ -4675,7 +4671,7 @@ SetEOFRetry: | |||
4675 | 4671 | ||
4676 | int | 4672 | int |
4677 | CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, | 4673 | CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, |
4678 | __u16 fid, __u32 pid_of_opener, int SetAllocation) | 4674 | __u16 fid, __u32 pid_of_opener, bool SetAllocation) |
4679 | { | 4675 | { |
4680 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | 4676 | struct smb_com_transaction2_sfi_req *pSMB = NULL; |
4681 | char *data_offset; | 4677 | char *data_offset; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e17106730168..f428bf3bf1a9 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -49,8 +49,6 @@ | |||
49 | #define CIFS_PORT 445 | 49 | #define CIFS_PORT 445 |
50 | #define RFC1001_PORT 139 | 50 | #define RFC1001_PORT 139 |
51 | 51 | ||
52 | static DECLARE_COMPLETION(cifsd_complete); | ||
53 | |||
54 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, | 52 | extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, |
55 | unsigned char *p24); | 53 | unsigned char *p24); |
56 | 54 | ||
@@ -71,23 +69,23 @@ struct smb_vol { | |||
71 | mode_t file_mode; | 69 | mode_t file_mode; |
72 | mode_t dir_mode; | 70 | mode_t dir_mode; |
73 | unsigned secFlg; | 71 | unsigned secFlg; |
74 | unsigned rw:1; | 72 | bool rw:1; |
75 | unsigned retry:1; | 73 | bool retry:1; |
76 | unsigned intr:1; | 74 | bool intr:1; |
77 | unsigned setuids:1; | 75 | bool setuids:1; |
78 | unsigned override_uid:1; | 76 | bool override_uid:1; |
79 | unsigned override_gid:1; | 77 | bool override_gid:1; |
80 | unsigned noperm:1; | 78 | bool noperm:1; |
81 | unsigned no_psx_acl:1; /* set if posix acl support should be disabled */ | 79 | bool no_psx_acl:1; /* set if posix acl support should be disabled */ |
82 | unsigned cifs_acl:1; | 80 | bool cifs_acl:1; |
83 | unsigned no_xattr:1; /* set if xattr (EA) support should be disabled*/ | 81 | bool no_xattr:1; /* set if xattr (EA) support should be disabled*/ |
84 | unsigned server_ino:1; /* use inode numbers from server ie UniqueId */ | 82 | bool server_ino:1; /* use inode numbers from server ie UniqueId */ |
85 | unsigned direct_io:1; | 83 | bool direct_io:1; |
86 | unsigned remap:1; /* set to remap seven reserved chars in filenames */ | 84 | bool remap:1; /* set to remap seven reserved chars in filenames */ |
87 | unsigned posix_paths:1; /* unset to not ask for posix pathnames. */ | 85 | bool posix_paths:1; /* unset to not ask for posix pathnames. */ |
88 | unsigned no_linux_ext:1; | 86 | bool no_linux_ext:1; |
89 | unsigned sfu_emul:1; | 87 | bool sfu_emul:1; |
90 | unsigned nullauth:1; /* attempt to authenticate with null user */ | 88 | bool nullauth:1; /* attempt to authenticate with null user */ |
91 | unsigned nocase; /* request case insensitive filenames */ | 89 | unsigned nocase; /* request case insensitive filenames */ |
92 | unsigned nobrl; /* disable sending byte range locks to srv */ | 90 | unsigned nobrl; /* disable sending byte range locks to srv */ |
93 | unsigned int rsize; | 91 | unsigned int rsize; |
@@ -345,18 +343,16 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
345 | struct task_struct *task_to_wake = NULL; | 343 | struct task_struct *task_to_wake = NULL; |
346 | struct mid_q_entry *mid_entry; | 344 | struct mid_q_entry *mid_entry; |
347 | char temp; | 345 | char temp; |
348 | int isLargeBuf = FALSE; | 346 | bool isLargeBuf = false; |
349 | int isMultiRsp; | 347 | bool isMultiRsp; |
350 | int reconnect; | 348 | int reconnect; |
351 | 349 | ||
352 | current->flags |= PF_MEMALLOC; | 350 | current->flags |= PF_MEMALLOC; |
353 | server->tsk = current; /* save process info to wake at shutdown */ | ||
354 | cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); | 351 | cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); |
355 | write_lock(&GlobalSMBSeslock); | 352 | write_lock(&GlobalSMBSeslock); |
356 | atomic_inc(&tcpSesAllocCount); | 353 | atomic_inc(&tcpSesAllocCount); |
357 | length = tcpSesAllocCount.counter; | 354 | length = tcpSesAllocCount.counter; |
358 | write_unlock(&GlobalSMBSeslock); | 355 | write_unlock(&GlobalSMBSeslock); |
359 | complete(&cifsd_complete); | ||
360 | if (length > 1) | 356 | if (length > 1) |
361 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv, | 357 | mempool_resize(cifs_req_poolp, length + cifs_min_rcv, |
362 | GFP_KERNEL); | 358 | GFP_KERNEL); |
@@ -390,8 +386,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
390 | } else /* if existing small buf clear beginning */ | 386 | } else /* if existing small buf clear beginning */ |
391 | memset(smallbuf, 0, sizeof(struct smb_hdr)); | 387 | memset(smallbuf, 0, sizeof(struct smb_hdr)); |
392 | 388 | ||
393 | isLargeBuf = FALSE; | 389 | isLargeBuf = false; |
394 | isMultiRsp = FALSE; | 390 | isMultiRsp = false; |
395 | smb_buffer = smallbuf; | 391 | smb_buffer = smallbuf; |
396 | iov.iov_base = smb_buffer; | 392 | iov.iov_base = smb_buffer; |
397 | iov.iov_len = 4; | 393 | iov.iov_len = 4; |
@@ -517,7 +513,7 @@ incomplete_rcv: | |||
517 | reconnect = 0; | 513 | reconnect = 0; |
518 | 514 | ||
519 | if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE - 4) { | 515 | if (pdu_length > MAX_CIFS_SMALL_BUFFER_SIZE - 4) { |
520 | isLargeBuf = TRUE; | 516 | isLargeBuf = true; |
521 | memcpy(bigbuf, smallbuf, 4); | 517 | memcpy(bigbuf, smallbuf, 4); |
522 | smb_buffer = bigbuf; | 518 | smb_buffer = bigbuf; |
523 | } | 519 | } |
@@ -582,16 +578,18 @@ incomplete_rcv: | |||
582 | (mid_entry->command == smb_buffer->Command)) { | 578 | (mid_entry->command == smb_buffer->Command)) { |
583 | if (check2ndT2(smb_buffer,server->maxBuf) > 0) { | 579 | if (check2ndT2(smb_buffer,server->maxBuf) > 0) { |
584 | /* We have a multipart transact2 resp */ | 580 | /* We have a multipart transact2 resp */ |
585 | isMultiRsp = TRUE; | 581 | isMultiRsp = true; |
586 | if (mid_entry->resp_buf) { | 582 | if (mid_entry->resp_buf) { |
587 | /* merge response - fix up 1st*/ | 583 | /* merge response - fix up 1st*/ |
588 | if (coalesce_t2(smb_buffer, | 584 | if (coalesce_t2(smb_buffer, |
589 | mid_entry->resp_buf)) { | 585 | mid_entry->resp_buf)) { |
590 | mid_entry->multiRsp = 1; | 586 | mid_entry->multiRsp = |
587 | true; | ||
591 | break; | 588 | break; |
592 | } else { | 589 | } else { |
593 | /* all parts received */ | 590 | /* all parts received */ |
594 | mid_entry->multiEnd = 1; | 591 | mid_entry->multiEnd = |
592 | true; | ||
595 | goto multi_t2_fnd; | 593 | goto multi_t2_fnd; |
596 | } | 594 | } |
597 | } else { | 595 | } else { |
@@ -603,17 +601,15 @@ incomplete_rcv: | |||
603 | /* Have first buffer */ | 601 | /* Have first buffer */ |
604 | mid_entry->resp_buf = | 602 | mid_entry->resp_buf = |
605 | smb_buffer; | 603 | smb_buffer; |
606 | mid_entry->largeBuf = 1; | 604 | mid_entry->largeBuf = |
605 | true; | ||
607 | bigbuf = NULL; | 606 | bigbuf = NULL; |
608 | } | 607 | } |
609 | } | 608 | } |
610 | break; | 609 | break; |
611 | } | 610 | } |
612 | mid_entry->resp_buf = smb_buffer; | 611 | mid_entry->resp_buf = smb_buffer; |
613 | if (isLargeBuf) | 612 | mid_entry->largeBuf = isLargeBuf; |
614 | mid_entry->largeBuf = 1; | ||
615 | else | ||
616 | mid_entry->largeBuf = 0; | ||
617 | multi_t2_fnd: | 613 | multi_t2_fnd: |
618 | task_to_wake = mid_entry->tsk; | 614 | task_to_wake = mid_entry->tsk; |
619 | mid_entry->midState = MID_RESPONSE_RECEIVED; | 615 | mid_entry->midState = MID_RESPONSE_RECEIVED; |
@@ -638,8 +634,8 @@ multi_t2_fnd: | |||
638 | smallbuf = NULL; | 634 | smallbuf = NULL; |
639 | } | 635 | } |
640 | wake_up_process(task_to_wake); | 636 | wake_up_process(task_to_wake); |
641 | } else if ((is_valid_oplock_break(smb_buffer, server) == FALSE) | 637 | } else if (!is_valid_oplock_break(smb_buffer, server) && |
642 | && (isMultiRsp == FALSE)) { | 638 | !isMultiRsp) { |
643 | cERROR(1, ("No task to wake, unknown frame received! " | 639 | cERROR(1, ("No task to wake, unknown frame received! " |
644 | "NumMids %d", midCount.counter)); | 640 | "NumMids %d", midCount.counter)); |
645 | cifs_dump_mem("Received Data is: ", (char *)smb_buffer, | 641 | cifs_dump_mem("Received Data is: ", (char *)smb_buffer, |
@@ -654,10 +650,20 @@ multi_t2_fnd: | |||
654 | 650 | ||
655 | spin_lock(&GlobalMid_Lock); | 651 | spin_lock(&GlobalMid_Lock); |
656 | server->tcpStatus = CifsExiting; | 652 | server->tcpStatus = CifsExiting; |
657 | 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 | |||
658 | /* check if we have blocked requests that need to free */ | 663 | /* check if we have blocked requests that need to free */ |
659 | /* Note that cifs_max_pending is normally 50, but | 664 | /* Note that cifs_max_pending is normally 50, but |
660 | 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); | ||
661 | if (atomic_read(&server->inFlight) >= cifs_max_pending) | 667 | if (atomic_read(&server->inFlight) >= cifs_max_pending) |
662 | atomic_set(&server->inFlight, cifs_max_pending - 1); | 668 | atomic_set(&server->inFlight, cifs_max_pending - 1); |
663 | /* 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 |
@@ -825,7 +831,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
825 | vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP); | 831 | vol->file_mode = (S_IRWXUGO | S_ISGID) & (~S_IXGRP); |
826 | 832 | ||
827 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ | 833 | /* vol->retry default is 0 (i.e. "soft" limited retry not hard retry) */ |
828 | vol->rw = TRUE; | 834 | vol->rw = true; |
829 | /* default is always to request posix paths. */ | 835 | /* default is always to request posix paths. */ |
830 | vol->posix_paths = 1; | 836 | vol->posix_paths = 1; |
831 | 837 | ||
@@ -1181,7 +1187,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1181 | } else if (strnicmp(data, "guest", 5) == 0) { | 1187 | } else if (strnicmp(data, "guest", 5) == 0) { |
1182 | /* ignore */ | 1188 | /* ignore */ |
1183 | } else if (strnicmp(data, "rw", 2) == 0) { | 1189 | } else if (strnicmp(data, "rw", 2) == 0) { |
1184 | vol->rw = TRUE; | 1190 | vol->rw = true; |
1185 | } else if ((strnicmp(data, "suid", 4) == 0) || | 1191 | } else if ((strnicmp(data, "suid", 4) == 0) || |
1186 | (strnicmp(data, "nosuid", 6) == 0) || | 1192 | (strnicmp(data, "nosuid", 6) == 0) || |
1187 | (strnicmp(data, "exec", 4) == 0) || | 1193 | (strnicmp(data, "exec", 4) == 0) || |
@@ -1197,7 +1203,7 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1197 | is ok to just ignore them */ | 1203 | is ok to just ignore them */ |
1198 | continue; | 1204 | continue; |
1199 | } else if (strnicmp(data, "ro", 2) == 0) { | 1205 | } else if (strnicmp(data, "ro", 2) == 0) { |
1200 | vol->rw = FALSE; | 1206 | vol->rw = false; |
1201 | } else if (strnicmp(data, "hard", 4) == 0) { | 1207 | } else if (strnicmp(data, "hard", 4) == 0) { |
1202 | vol->retry = 1; | 1208 | vol->retry = 1; |
1203 | } else if (strnicmp(data, "soft", 4) == 0) { | 1209 | } else if (strnicmp(data, "soft", 4) == 0) { |
@@ -1305,6 +1311,9 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1305 | "begin with // or \\\\ \n"); | 1311 | "begin with // or \\\\ \n"); |
1306 | return 1; | 1312 | return 1; |
1307 | } | 1313 | } |
1314 | value = strpbrk(vol->UNC+2, "/\\"); | ||
1315 | if (value) | ||
1316 | *value = '\\'; | ||
1308 | } else { | 1317 | } else { |
1309 | printk(KERN_WARNING "CIFS: UNC name too long\n"); | 1318 | printk(KERN_WARNING "CIFS: UNC name too long\n"); |
1310 | return 1; | 1319 | return 1; |
@@ -1318,42 +1327,43 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1318 | 1327 | ||
1319 | static struct cifsSesInfo * | 1328 | static struct cifsSesInfo * |
1320 | cifs_find_tcp_session(struct in_addr *target_ip_addr, | 1329 | cifs_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 | ||
@@ -1362,45 +1372,43 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName) | |||
1362 | { | 1372 | { |
1363 | struct list_head *tmp; | 1373 | struct list_head *tmp; |
1364 | struct cifsTconInfo *tcon; | 1374 | struct cifsTconInfo *tcon; |
1375 | __be32 old_ip; | ||
1365 | 1376 | ||
1366 | read_lock(&GlobalSMBSeslock); | 1377 | read_lock(&GlobalSMBSeslock); |
1378 | |||
1367 | list_for_each(tmp, &GlobalTreeConnectionList) { | 1379 | list_for_each(tmp, &GlobalTreeConnectionList) { |
1368 | cFYI(1, ("Next tcon")); | 1380 | cFYI(1, ("Next tcon")); |
1369 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); | 1381 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); |
1370 | if (tcon->ses) { | 1382 | if (!tcon->ses || !tcon->ses->server) |
1371 | if (tcon->ses->server) { | 1383 | continue; |
1372 | cFYI(1, | 1384 | |
1373 | ("old ip addr: %x == new ip %x ?", | 1385 | old_ip = tcon->ses->server->addr.sockAddr.sin_addr.s_addr; |
1374 | tcon->ses->server->addr.sockAddr.sin_addr. | 1386 | cFYI(1, ("old ip addr: %x == new ip %x ?", |
1375 | s_addr, new_target_ip_addr)); | 1387 | old_ip, new_target_ip_addr)); |
1376 | if (tcon->ses->server->addr.sockAddr.sin_addr. | 1388 | |
1377 | s_addr == new_target_ip_addr) { | 1389 | if (old_ip != new_target_ip_addr) |
1378 | /* BB lock tcon, server and tcp session and increment use count here? */ | 1390 | continue; |
1379 | /* found a match on the TCP session */ | 1391 | |
1380 | /* BB check if reconnection needed */ | 1392 | /* BB lock tcon, server, tcp session and increment use count? */ |
1381 | cFYI(1, | 1393 | /* found a match on the TCP session */ |
1382 | ("IP match, old UNC: %s new: %s", | 1394 | /* BB check if reconnection needed */ |
1383 | tcon->treeName, uncName)); | 1395 | cFYI(1, ("IP match, old UNC: %s new: %s", |
1384 | if (strncmp | 1396 | tcon->treeName, uncName)); |
1385 | (tcon->treeName, uncName, | 1397 | |
1386 | MAX_TREE_SIZE) == 0) { | 1398 | if (strncmp(tcon->treeName, uncName, MAX_TREE_SIZE)) |
1387 | cFYI(1, | 1399 | continue; |
1388 | ("and old usr: %s new: %s", | 1400 | |
1389 | tcon->treeName, uncName)); | 1401 | cFYI(1, ("and old usr: %s new: %s", |
1390 | if (strncmp | 1402 | tcon->treeName, uncName)); |
1391 | (tcon->ses->userName, | 1403 | |
1392 | userName, | 1404 | if (strncmp(tcon->ses->userName, userName, MAX_USERNAME_SIZE)) |
1393 | MAX_USERNAME_SIZE) == 0) { | 1405 | continue; |
1394 | read_unlock(&GlobalSMBSeslock); | 1406 | |
1395 | /* matched smb session | 1407 | /* matched smb session (user name) */ |
1396 | (user name */ | 1408 | read_unlock(&GlobalSMBSeslock); |
1397 | return tcon; | 1409 | return tcon; |
1398 | } | ||
1399 | } | ||
1400 | } | ||
1401 | } | ||
1402 | } | ||
1403 | } | 1410 | } |
1411 | |||
1404 | read_unlock(&GlobalSMBSeslock); | 1412 | read_unlock(&GlobalSMBSeslock); |
1405 | return NULL; | 1413 | return NULL; |
1406 | } | 1414 | } |
@@ -1982,7 +1990,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1982 | kfree(srvTcp->hostname); | 1990 | kfree(srvTcp->hostname); |
1983 | goto out; | 1991 | goto out; |
1984 | } | 1992 | } |
1985 | wait_for_completion(&cifsd_complete); | ||
1986 | rc = 0; | 1993 | rc = 0; |
1987 | memcpy(srvTcp->workstation_RFC1001_name, | 1994 | memcpy(srvTcp->workstation_RFC1001_name, |
1988 | volume_info.source_rfc1001_name, 16); | 1995 | volume_info.source_rfc1001_name, 16); |
@@ -2189,15 +2196,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2189 | srvTcp->tcpStatus = CifsExiting; | 2196 | srvTcp->tcpStatus = CifsExiting; |
2190 | spin_unlock(&GlobalMid_Lock); | 2197 | spin_unlock(&GlobalMid_Lock); |
2191 | if (srvTcp->tsk) { | 2198 | if (srvTcp->tsk) { |
2192 | struct task_struct *tsk; | ||
2193 | /* If we could verify that kthread_stop would | 2199 | /* If we could verify that kthread_stop would |
2194 | always wake up processes blocked in | 2200 | always wake up processes blocked in |
2195 | tcp in recv_mesg then we could remove the | 2201 | tcp in recv_mesg then we could remove the |
2196 | send_sig call */ | 2202 | send_sig call */ |
2197 | force_sig(SIGKILL, srvTcp->tsk); | 2203 | force_sig(SIGKILL, srvTcp->tsk); |
2198 | tsk = srvTcp->tsk; | 2204 | kthread_stop(srvTcp->tsk); |
2199 | if (tsk) | ||
2200 | kthread_stop(tsk); | ||
2201 | } | 2205 | } |
2202 | } | 2206 | } |
2203 | /* 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 */ |
@@ -2213,23 +2217,17 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2213 | if ((temp_rc == -ESHUTDOWN) && | 2217 | if ((temp_rc == -ESHUTDOWN) && |
2214 | (pSesInfo->server) && | 2218 | (pSesInfo->server) && |
2215 | (pSesInfo->server->tsk)) { | 2219 | (pSesInfo->server->tsk)) { |
2216 | struct task_struct *tsk; | ||
2217 | force_sig(SIGKILL, | 2220 | force_sig(SIGKILL, |
2218 | pSesInfo->server->tsk); | 2221 | pSesInfo->server->tsk); |
2219 | tsk = pSesInfo->server->tsk; | 2222 | kthread_stop(pSesInfo->server->tsk); |
2220 | if (tsk) | ||
2221 | kthread_stop(tsk); | ||
2222 | } | 2223 | } |
2223 | } else { | 2224 | } else { |
2224 | cFYI(1, ("No session or bad tcon")); | 2225 | cFYI(1, ("No session or bad tcon")); |
2225 | if ((pSesInfo->server) && | 2226 | if ((pSesInfo->server) && |
2226 | (pSesInfo->server->tsk)) { | 2227 | (pSesInfo->server->tsk)) { |
2227 | struct task_struct *tsk; | ||
2228 | force_sig(SIGKILL, | 2228 | force_sig(SIGKILL, |
2229 | pSesInfo->server->tsk); | 2229 | pSesInfo->server->tsk); |
2230 | tsk = pSesInfo->server->tsk; | 2230 | kthread_stop(pSesInfo->server->tsk); |
2231 | if (tsk) | ||
2232 | kthread_stop(tsk); | ||
2233 | } | 2231 | } |
2234 | } | 2232 | } |
2235 | sesInfoFree(pSesInfo); | 2233 | sesInfoFree(pSesInfo); |
@@ -2602,7 +2600,7 @@ sesssetup_nomem: /* do not return an error on nomem for the info strings, | |||
2602 | 2600 | ||
2603 | static int | 2601 | static int |
2604 | CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | 2602 | CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, |
2605 | struct cifsSesInfo *ses, int *pNTLMv2_flag, | 2603 | struct cifsSesInfo *ses, bool *pNTLMv2_flag, |
2606 | const struct nls_table *nls_codepage) | 2604 | const struct nls_table *nls_codepage) |
2607 | { | 2605 | { |
2608 | struct smb_hdr *smb_buffer; | 2606 | struct smb_hdr *smb_buffer; |
@@ -2625,7 +2623,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2625 | if (ses == NULL) | 2623 | if (ses == NULL) |
2626 | return -EINVAL; | 2624 | return -EINVAL; |
2627 | domain = ses->domainName; | 2625 | domain = ses->domainName; |
2628 | *pNTLMv2_flag = FALSE; | 2626 | *pNTLMv2_flag = false; |
2629 | smb_buffer = cifs_buf_get(); | 2627 | smb_buffer = cifs_buf_get(); |
2630 | if (smb_buffer == NULL) { | 2628 | if (smb_buffer == NULL) { |
2631 | return -ENOMEM; | 2629 | return -ENOMEM; |
@@ -2778,7 +2776,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2778 | CIFS_CRYPTO_KEY_SIZE); | 2776 | CIFS_CRYPTO_KEY_SIZE); |
2779 | if (SecurityBlob2->NegotiateFlags & | 2777 | if (SecurityBlob2->NegotiateFlags & |
2780 | cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) | 2778 | cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) |
2781 | *pNTLMv2_flag = TRUE; | 2779 | *pNTLMv2_flag = true; |
2782 | 2780 | ||
2783 | if ((SecurityBlob2->NegotiateFlags & | 2781 | if ((SecurityBlob2->NegotiateFlags & |
2784 | cpu_to_le32(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) | 2782 | cpu_to_le32(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)) |
@@ -2939,7 +2937,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2939 | } | 2937 | } |
2940 | static int | 2938 | static int |
2941 | CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | 2939 | CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, |
2942 | char *ntlm_session_key, int ntlmv2_flag, | 2940 | char *ntlm_session_key, bool ntlmv2_flag, |
2943 | const struct nls_table *nls_codepage) | 2941 | const struct nls_table *nls_codepage) |
2944 | { | 2942 | { |
2945 | struct smb_hdr *smb_buffer; | 2943 | struct smb_hdr *smb_buffer; |
@@ -3556,8 +3554,6 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) | |||
3556 | cifs_sb->prepath = NULL; | 3554 | cifs_sb->prepath = NULL; |
3557 | kfree(tmp); | 3555 | kfree(tmp); |
3558 | if (ses) | 3556 | if (ses) |
3559 | schedule_timeout_interruptible(msecs_to_jiffies(500)); | ||
3560 | if (ses) | ||
3561 | sesInfoFree(ses); | 3557 | sesInfoFree(ses); |
3562 | 3558 | ||
3563 | FreeXid(xid); | 3559 | FreeXid(xid); |
@@ -3569,7 +3565,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, | |||
3569 | { | 3565 | { |
3570 | int rc = 0; | 3566 | int rc = 0; |
3571 | char ntlm_session_key[CIFS_SESS_KEY_SIZE]; | 3567 | char ntlm_session_key[CIFS_SESS_KEY_SIZE]; |
3572 | int ntlmv2_flag = FALSE; | 3568 | bool ntlmv2_flag = false; |
3573 | int first_time = 0; | 3569 | int first_time = 0; |
3574 | 3570 | ||
3575 | /* what if server changes its buffer size after dropping the session? */ | 3571 | /* what if server changes its buffer size after dropping the session? */ |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 0f5c62ba4038..e4e0078a0526 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; |
@@ -130,7 +131,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
130 | struct cifsFileInfo *pCifsFile = NULL; | 131 | struct cifsFileInfo *pCifsFile = NULL; |
131 | struct cifsInodeInfo *pCifsInode; | 132 | struct cifsInodeInfo *pCifsInode; |
132 | int disposition = FILE_OVERWRITE_IF; | 133 | int disposition = FILE_OVERWRITE_IF; |
133 | int write_only = FALSE; | 134 | bool write_only = false; |
134 | 135 | ||
135 | xid = GetXid(); | 136 | xid = GetXid(); |
136 | 137 | ||
@@ -152,7 +153,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
152 | if (oflags & FMODE_WRITE) { | 153 | if (oflags & FMODE_WRITE) { |
153 | desiredAccess |= GENERIC_WRITE; | 154 | desiredAccess |= GENERIC_WRITE; |
154 | if (!(oflags & FMODE_READ)) | 155 | if (!(oflags & FMODE_READ)) |
155 | write_only = TRUE; | 156 | write_only = true; |
156 | } | 157 | } |
157 | 158 | ||
158 | if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) | 159 | if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) |
@@ -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, |
@@ -254,7 +264,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
254 | d_instantiate(direntry, newinode); | 264 | d_instantiate(direntry, newinode); |
255 | } | 265 | } |
256 | if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || | 266 | if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || |
257 | ((nd->flags & LOOKUP_OPEN) == FALSE)) { | 267 | (!(nd->flags & LOOKUP_OPEN))) { |
258 | /* mknod case - do not leave file open */ | 268 | /* mknod case - do not leave file open */ |
259 | CIFSSMBClose(xid, pTcon, fileHandle); | 269 | CIFSSMBClose(xid, pTcon, fileHandle); |
260 | } else if (newinode) { | 270 | } else if (newinode) { |
@@ -266,8 +276,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
266 | pCifsFile->netfid = fileHandle; | 276 | pCifsFile->netfid = fileHandle; |
267 | pCifsFile->pid = current->tgid; | 277 | pCifsFile->pid = current->tgid; |
268 | pCifsFile->pInode = newinode; | 278 | pCifsFile->pInode = newinode; |
269 | pCifsFile->invalidHandle = FALSE; | 279 | pCifsFile->invalidHandle = false; |
270 | pCifsFile->closePend = FALSE; | 280 | pCifsFile->closePend = false; |
271 | init_MUTEX(&pCifsFile->fh_sem); | 281 | init_MUTEX(&pCifsFile->fh_sem); |
272 | mutex_init(&pCifsFile->lock_mutex); | 282 | mutex_init(&pCifsFile->lock_mutex); |
273 | INIT_LIST_HEAD(&pCifsFile->llist); | 283 | INIT_LIST_HEAD(&pCifsFile->llist); |
@@ -280,7 +290,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
280 | pCifsInode = CIFS_I(newinode); | 290 | pCifsInode = CIFS_I(newinode); |
281 | if (pCifsInode) { | 291 | if (pCifsInode) { |
282 | /* if readable file instance put first in list*/ | 292 | /* if readable file instance put first in list*/ |
283 | if (write_only == TRUE) { | 293 | if (write_only) { |
284 | list_add_tail(&pCifsFile->flist, | 294 | list_add_tail(&pCifsFile->flist, |
285 | &pCifsInode->openFileList); | 295 | &pCifsInode->openFileList); |
286 | } else { | 296 | } else { |
@@ -288,12 +298,12 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
288 | &pCifsInode->openFileList); | 298 | &pCifsInode->openFileList); |
289 | } | 299 | } |
290 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 300 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
291 | pCifsInode->clientCanCacheAll = TRUE; | 301 | pCifsInode->clientCanCacheAll = true; |
292 | pCifsInode->clientCanCacheRead = TRUE; | 302 | pCifsInode->clientCanCacheRead = true; |
293 | cFYI(1, ("Exclusive Oplock inode %p", | 303 | cFYI(1, ("Exclusive Oplock inode %p", |
294 | newinode)); | 304 | newinode)); |
295 | } else if ((oplock & 0xF) == OPLOCK_READ) | 305 | } else if ((oplock & 0xF) == OPLOCK_READ) |
296 | pCifsInode->clientCanCacheRead = TRUE; | 306 | pCifsInode->clientCanCacheRead = true; |
297 | } | 307 | } |
298 | write_unlock(&GlobalSMBSeslock); | 308 | write_unlock(&GlobalSMBSeslock); |
299 | } | 309 | } |
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index 7cc86c418182..939e256f8497 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -55,6 +55,32 @@ struct key_type key_type_dns_resolver = { | |||
55 | .match = user_match, | 55 | .match = user_match, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | /* Checks if supplied name is IP address | ||
59 | * returns: | ||
60 | * 1 - name is IP | ||
61 | * 0 - name is not IP | ||
62 | */ | ||
63 | static int is_ip(const char *name) | ||
64 | { | ||
65 | int rc; | ||
66 | struct sockaddr_in sin_server; | ||
67 | struct sockaddr_in6 sin_server6; | ||
68 | |||
69 | rc = cifs_inet_pton(AF_INET, name, | ||
70 | &sin_server.sin_addr.s_addr); | ||
71 | |||
72 | if (rc <= 0) { | ||
73 | /* not ipv4 address, try ipv6 */ | ||
74 | rc = cifs_inet_pton(AF_INET6, name, | ||
75 | &sin_server6.sin6_addr.in6_u); | ||
76 | if (rc > 0) | ||
77 | return 1; | ||
78 | } else { | ||
79 | return 1; | ||
80 | } | ||
81 | /* we failed translating address */ | ||
82 | return 0; | ||
83 | } | ||
58 | 84 | ||
59 | /* Resolves server name to ip address. | 85 | /* Resolves server name to ip address. |
60 | * input: | 86 | * input: |
@@ -67,8 +93,9 @@ int | |||
67 | dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) | 93 | dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) |
68 | { | 94 | { |
69 | int rc = -EAGAIN; | 95 | int rc = -EAGAIN; |
70 | struct key *rkey; | 96 | struct key *rkey = ERR_PTR(-EAGAIN); |
71 | char *name; | 97 | char *name; |
98 | char *data = NULL; | ||
72 | int len; | 99 | int len; |
73 | 100 | ||
74 | if (!ip_addr || !unc) | 101 | if (!ip_addr || !unc) |
@@ -97,26 +124,41 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) | |||
97 | memcpy(name, unc+2, len); | 124 | memcpy(name, unc+2, len); |
98 | name[len] = 0; | 125 | name[len] = 0; |
99 | 126 | ||
127 | if (is_ip(name)) { | ||
128 | cFYI(1, ("%s: it is IP, skipping dns upcall: %s", | ||
129 | __func__, name)); | ||
130 | data = name; | ||
131 | goto skip_upcall; | ||
132 | } | ||
133 | |||
100 | rkey = request_key(&key_type_dns_resolver, name, ""); | 134 | rkey = request_key(&key_type_dns_resolver, name, ""); |
101 | if (!IS_ERR(rkey)) { | 135 | if (!IS_ERR(rkey)) { |
102 | len = strlen(rkey->payload.data); | 136 | data = rkey->payload.data; |
103 | *ip_addr = kmalloc(len+1, GFP_KERNEL); | 137 | cFYI(1, ("%s: resolved: %s to %s", __func__, |
104 | if (*ip_addr) { | ||
105 | memcpy(*ip_addr, rkey->payload.data, len); | ||
106 | (*ip_addr)[len] = '\0'; | ||
107 | cFYI(1, ("%s: resolved: %s to %s", __func__, | ||
108 | rkey->description, | 138 | rkey->description, |
109 | *ip_addr | 139 | *ip_addr |
110 | )); | 140 | )); |
141 | } else { | ||
142 | cERROR(1, ("%s: unable to resolve: %s", __func__, name)); | ||
143 | goto out; | ||
144 | } | ||
145 | |||
146 | skip_upcall: | ||
147 | if (data) { | ||
148 | len = strlen(data); | ||
149 | *ip_addr = kmalloc(len+1, GFP_KERNEL); | ||
150 | if (*ip_addr) { | ||
151 | memcpy(*ip_addr, data, len); | ||
152 | (*ip_addr)[len] = '\0'; | ||
111 | rc = 0; | 153 | rc = 0; |
112 | } else { | 154 | } else { |
113 | rc = -ENOMEM; | 155 | rc = -ENOMEM; |
114 | } | 156 | } |
115 | key_put(rkey); | 157 | if (!IS_ERR(rkey)) |
116 | } else { | 158 | key_put(rkey); |
117 | cERROR(1, ("%s: unable to resolve: %s", __func__, name)); | ||
118 | } | 159 | } |
119 | 160 | ||
161 | out: | ||
120 | kfree(name); | 162 | kfree(name); |
121 | return rc; | 163 | return rc; |
122 | } | 164 | } |
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c index 7d1d5aa4c430..5a57581eb4b2 100644 --- a/fs/cifs/fcntl.c +++ b/fs/cifs/fcntl.c | |||
@@ -68,7 +68,7 @@ int cifs_dir_notify(struct file *file, unsigned long arg) | |||
68 | { | 68 | { |
69 | int xid; | 69 | int xid; |
70 | int rc = -EINVAL; | 70 | int rc = -EINVAL; |
71 | int oplock = FALSE; | 71 | int oplock = 0; |
72 | struct cifs_sb_info *cifs_sb; | 72 | struct cifs_sb_info *cifs_sb; |
73 | struct cifsTconInfo *pTcon; | 73 | struct cifsTconInfo *pTcon; |
74 | char *full_path = NULL; | 74 | char *full_path = NULL; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 40b690073fc1..31a0a33b9d95 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -51,8 +51,8 @@ static inline struct cifsFileInfo *cifs_init_private( | |||
51 | INIT_LIST_HEAD(&private_data->llist); | 51 | INIT_LIST_HEAD(&private_data->llist); |
52 | private_data->pfile = file; /* needed for writepage */ | 52 | private_data->pfile = file; /* needed for writepage */ |
53 | private_data->pInode = inode; | 53 | private_data->pInode = inode; |
54 | private_data->invalidHandle = FALSE; | 54 | private_data->invalidHandle = false; |
55 | private_data->closePend = FALSE; | 55 | private_data->closePend = false; |
56 | /* we have to track num writers to the inode, since writepages | 56 | /* we have to track num writers to the inode, since writepages |
57 | does not tell us which handle the write is for so there can | 57 | does not tell us which handle the write is for so there can |
58 | be a close (overlapping with write) of the filehandle that | 58 | be a close (overlapping with write) of the filehandle that |
@@ -148,12 +148,12 @@ client_can_cache: | |||
148 | full_path, buf, inode->i_sb, xid, NULL); | 148 | full_path, buf, inode->i_sb, xid, NULL); |
149 | 149 | ||
150 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 150 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
151 | pCifsInode->clientCanCacheAll = TRUE; | 151 | pCifsInode->clientCanCacheAll = true; |
152 | pCifsInode->clientCanCacheRead = TRUE; | 152 | pCifsInode->clientCanCacheRead = true; |
153 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 153 | cFYI(1, ("Exclusive Oplock granted on inode %p", |
154 | file->f_path.dentry->d_inode)); | 154 | file->f_path.dentry->d_inode)); |
155 | } else if ((*oplock & 0xF) == OPLOCK_READ) | 155 | } else if ((*oplock & 0xF) == OPLOCK_READ) |
156 | pCifsInode->clientCanCacheRead = TRUE; | 156 | pCifsInode->clientCanCacheRead = true; |
157 | 157 | ||
158 | return rc; | 158 | return rc; |
159 | } | 159 | } |
@@ -247,7 +247,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
247 | if (oplockEnabled) | 247 | if (oplockEnabled) |
248 | oplock = REQ_OPLOCK; | 248 | oplock = REQ_OPLOCK; |
249 | else | 249 | else |
250 | oplock = FALSE; | 250 | oplock = 0; |
251 | 251 | ||
252 | /* BB pass O_SYNC flag through on file attributes .. BB */ | 252 | /* BB pass O_SYNC flag through on file attributes .. BB */ |
253 | 253 | ||
@@ -339,7 +339,7 @@ static int cifs_relock_file(struct cifsFileInfo *cifsFile) | |||
339 | return rc; | 339 | return rc; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int cifs_reopen_file(struct file *file, int can_flush) | 342 | static int cifs_reopen_file(struct file *file, bool can_flush) |
343 | { | 343 | { |
344 | int rc = -EACCES; | 344 | int rc = -EACCES; |
345 | int xid, oplock; | 345 | int xid, oplock; |
@@ -360,7 +360,7 @@ static int cifs_reopen_file(struct file *file, int can_flush) | |||
360 | 360 | ||
361 | xid = GetXid(); | 361 | xid = GetXid(); |
362 | down(&pCifsFile->fh_sem); | 362 | down(&pCifsFile->fh_sem); |
363 | if (pCifsFile->invalidHandle == FALSE) { | 363 | if (!pCifsFile->invalidHandle) { |
364 | up(&pCifsFile->fh_sem); | 364 | up(&pCifsFile->fh_sem); |
365 | FreeXid(xid); | 365 | FreeXid(xid); |
366 | return 0; | 366 | return 0; |
@@ -404,7 +404,7 @@ reopen_error_exit: | |||
404 | if (oplockEnabled) | 404 | if (oplockEnabled) |
405 | oplock = REQ_OPLOCK; | 405 | oplock = REQ_OPLOCK; |
406 | else | 406 | else |
407 | oplock = FALSE; | 407 | oplock = 0; |
408 | 408 | ||
409 | /* Can not refresh inode by passing in file_info buf to be returned | 409 | /* Can not refresh inode by passing in file_info buf to be returned |
410 | by SMBOpen and then calling get_inode_info with returned buf | 410 | by SMBOpen and then calling get_inode_info with returned buf |
@@ -422,7 +422,7 @@ reopen_error_exit: | |||
422 | cFYI(1, ("oplock: %d", oplock)); | 422 | cFYI(1, ("oplock: %d", oplock)); |
423 | } else { | 423 | } else { |
424 | pCifsFile->netfid = netfid; | 424 | pCifsFile->netfid = netfid; |
425 | pCifsFile->invalidHandle = FALSE; | 425 | pCifsFile->invalidHandle = false; |
426 | up(&pCifsFile->fh_sem); | 426 | up(&pCifsFile->fh_sem); |
427 | pCifsInode = CIFS_I(inode); | 427 | pCifsInode = CIFS_I(inode); |
428 | if (pCifsInode) { | 428 | if (pCifsInode) { |
@@ -432,8 +432,8 @@ reopen_error_exit: | |||
432 | CIFS_I(inode)->write_behind_rc = rc; | 432 | CIFS_I(inode)->write_behind_rc = rc; |
433 | /* temporarily disable caching while we | 433 | /* temporarily disable caching while we |
434 | go to server to get inode info */ | 434 | go to server to get inode info */ |
435 | pCifsInode->clientCanCacheAll = FALSE; | 435 | pCifsInode->clientCanCacheAll = false; |
436 | pCifsInode->clientCanCacheRead = FALSE; | 436 | pCifsInode->clientCanCacheRead = false; |
437 | if (pTcon->unix_ext) | 437 | if (pTcon->unix_ext) |
438 | rc = cifs_get_inode_info_unix(&inode, | 438 | rc = cifs_get_inode_info_unix(&inode, |
439 | full_path, inode->i_sb, xid); | 439 | full_path, inode->i_sb, xid); |
@@ -448,16 +448,16 @@ reopen_error_exit: | |||
448 | we can not go to the server to get the new inod | 448 | we can not go to the server to get the new inod |
449 | info */ | 449 | info */ |
450 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 450 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
451 | pCifsInode->clientCanCacheAll = TRUE; | 451 | pCifsInode->clientCanCacheAll = true; |
452 | pCifsInode->clientCanCacheRead = TRUE; | 452 | pCifsInode->clientCanCacheRead = true; |
453 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 453 | cFYI(1, ("Exclusive Oplock granted on inode %p", |
454 | file->f_path.dentry->d_inode)); | 454 | file->f_path.dentry->d_inode)); |
455 | } else if ((oplock & 0xF) == OPLOCK_READ) { | 455 | } else if ((oplock & 0xF) == OPLOCK_READ) { |
456 | pCifsInode->clientCanCacheRead = TRUE; | 456 | pCifsInode->clientCanCacheRead = true; |
457 | pCifsInode->clientCanCacheAll = FALSE; | 457 | pCifsInode->clientCanCacheAll = false; |
458 | } else { | 458 | } else { |
459 | pCifsInode->clientCanCacheRead = FALSE; | 459 | pCifsInode->clientCanCacheRead = false; |
460 | pCifsInode->clientCanCacheAll = FALSE; | 460 | pCifsInode->clientCanCacheAll = false; |
461 | } | 461 | } |
462 | cifs_relock_file(pCifsFile); | 462 | cifs_relock_file(pCifsFile); |
463 | } | 463 | } |
@@ -484,7 +484,7 @@ int cifs_close(struct inode *inode, struct file *file) | |||
484 | if (pSMBFile) { | 484 | if (pSMBFile) { |
485 | struct cifsLockInfo *li, *tmp; | 485 | struct cifsLockInfo *li, *tmp; |
486 | 486 | ||
487 | pSMBFile->closePend = TRUE; | 487 | pSMBFile->closePend = true; |
488 | if (pTcon) { | 488 | if (pTcon) { |
489 | /* no sense reconnecting to close a file that is | 489 | /* no sense reconnecting to close a file that is |
490 | already closed */ | 490 | already closed */ |
@@ -553,8 +553,8 @@ int cifs_close(struct inode *inode, struct file *file) | |||
553 | cFYI(1, ("closing last open instance for inode %p", inode)); | 553 | cFYI(1, ("closing last open instance for inode %p", inode)); |
554 | /* if the file is not open we do not know if we can cache info | 554 | /* if the file is not open we do not know if we can cache info |
555 | on this inode, much less write behind and read ahead */ | 555 | on this inode, much less write behind and read ahead */ |
556 | CIFS_I(inode)->clientCanCacheRead = FALSE; | 556 | CIFS_I(inode)->clientCanCacheRead = false; |
557 | CIFS_I(inode)->clientCanCacheAll = FALSE; | 557 | CIFS_I(inode)->clientCanCacheAll = false; |
558 | } | 558 | } |
559 | read_unlock(&GlobalSMBSeslock); | 559 | read_unlock(&GlobalSMBSeslock); |
560 | if ((rc == 0) && CIFS_I(inode)->write_behind_rc) | 560 | if ((rc == 0) && CIFS_I(inode)->write_behind_rc) |
@@ -583,9 +583,9 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
583 | pTcon = cifs_sb->tcon; | 583 | pTcon = cifs_sb->tcon; |
584 | 584 | ||
585 | cFYI(1, ("Freeing private data in close dir")); | 585 | cFYI(1, ("Freeing private data in close dir")); |
586 | if ((pCFileStruct->srch_inf.endOfSearch == FALSE) && | 586 | if (!pCFileStruct->srch_inf.endOfSearch && |
587 | (pCFileStruct->invalidHandle == FALSE)) { | 587 | !pCFileStruct->invalidHandle) { |
588 | pCFileStruct->invalidHandle = TRUE; | 588 | pCFileStruct->invalidHandle = true; |
589 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); | 589 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); |
590 | cFYI(1, ("Closing uncompleted readdir with rc %d", | 590 | cFYI(1, ("Closing uncompleted readdir with rc %d", |
591 | rc)); | 591 | rc)); |
@@ -637,12 +637,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
637 | __u32 numLock = 0; | 637 | __u32 numLock = 0; |
638 | __u32 numUnlock = 0; | 638 | __u32 numUnlock = 0; |
639 | __u64 length; | 639 | __u64 length; |
640 | int wait_flag = FALSE; | 640 | bool wait_flag = false; |
641 | struct cifs_sb_info *cifs_sb; | 641 | struct cifs_sb_info *cifs_sb; |
642 | struct cifsTconInfo *pTcon; | 642 | struct cifsTconInfo *pTcon; |
643 | __u16 netfid; | 643 | __u16 netfid; |
644 | __u8 lockType = LOCKING_ANDX_LARGE_FILES; | 644 | __u8 lockType = LOCKING_ANDX_LARGE_FILES; |
645 | int posix_locking; | 645 | bool posix_locking; |
646 | 646 | ||
647 | length = 1 + pfLock->fl_end - pfLock->fl_start; | 647 | length = 1 + pfLock->fl_end - pfLock->fl_start; |
648 | rc = -EACCES; | 648 | rc = -EACCES; |
@@ -659,7 +659,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
659 | cFYI(1, ("Flock")); | 659 | cFYI(1, ("Flock")); |
660 | if (pfLock->fl_flags & FL_SLEEP) { | 660 | if (pfLock->fl_flags & FL_SLEEP) { |
661 | cFYI(1, ("Blocking lock")); | 661 | cFYI(1, ("Blocking lock")); |
662 | wait_flag = TRUE; | 662 | wait_flag = true; |
663 | } | 663 | } |
664 | if (pfLock->fl_flags & FL_ACCESS) | 664 | if (pfLock->fl_flags & FL_ACCESS) |
665 | cFYI(1, ("Process suspended by mandatory locking - " | 665 | cFYI(1, ("Process suspended by mandatory locking - " |
@@ -794,7 +794,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
794 | stored_rc = CIFSSMBLock(xid, pTcon, | 794 | stored_rc = CIFSSMBLock(xid, pTcon, |
795 | netfid, | 795 | netfid, |
796 | li->length, li->offset, | 796 | li->length, li->offset, |
797 | 1, 0, li->type, FALSE); | 797 | 1, 0, li->type, false); |
798 | if (stored_rc) | 798 | if (stored_rc) |
799 | rc = stored_rc; | 799 | rc = stored_rc; |
800 | 800 | ||
@@ -866,7 +866,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
866 | filemap_fdatawait from here so tell | 866 | filemap_fdatawait from here so tell |
867 | reopen_file not to flush data to server | 867 | reopen_file not to flush data to server |
868 | now */ | 868 | now */ |
869 | rc = cifs_reopen_file(file, FALSE); | 869 | rc = cifs_reopen_file(file, false); |
870 | if (rc != 0) | 870 | if (rc != 0) |
871 | break; | 871 | break; |
872 | } | 872 | } |
@@ -966,7 +966,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
966 | filemap_fdatawait from here so tell | 966 | filemap_fdatawait from here so tell |
967 | reopen_file not to flush data to | 967 | reopen_file not to flush data to |
968 | server now */ | 968 | server now */ |
969 | rc = cifs_reopen_file(file, FALSE); | 969 | rc = cifs_reopen_file(file, false); |
970 | if (rc != 0) | 970 | if (rc != 0) |
971 | break; | 971 | break; |
972 | } | 972 | } |
@@ -1093,7 +1093,7 @@ refind_writable: | |||
1093 | 1093 | ||
1094 | read_unlock(&GlobalSMBSeslock); | 1094 | read_unlock(&GlobalSMBSeslock); |
1095 | /* Had to unlock since following call can block */ | 1095 | /* Had to unlock since following call can block */ |
1096 | rc = cifs_reopen_file(open_file->pfile, FALSE); | 1096 | rc = cifs_reopen_file(open_file->pfile, false); |
1097 | if (!rc) { | 1097 | if (!rc) { |
1098 | if (!open_file->closePend) | 1098 | if (!open_file->closePend) |
1099 | return open_file; | 1099 | return open_file; |
@@ -1608,7 +1608,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
1608 | int buf_type = CIFS_NO_BUFFER; | 1608 | int buf_type = CIFS_NO_BUFFER; |
1609 | if ((open_file->invalidHandle) && | 1609 | if ((open_file->invalidHandle) && |
1610 | (!open_file->closePend)) { | 1610 | (!open_file->closePend)) { |
1611 | rc = cifs_reopen_file(file, TRUE); | 1611 | rc = cifs_reopen_file(file, true); |
1612 | if (rc != 0) | 1612 | if (rc != 0) |
1613 | break; | 1613 | break; |
1614 | } | 1614 | } |
@@ -1693,7 +1693,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
1693 | while (rc == -EAGAIN) { | 1693 | while (rc == -EAGAIN) { |
1694 | if ((open_file->invalidHandle) && | 1694 | if ((open_file->invalidHandle) && |
1695 | (!open_file->closePend)) { | 1695 | (!open_file->closePend)) { |
1696 | rc = cifs_reopen_file(file, TRUE); | 1696 | rc = cifs_reopen_file(file, true); |
1697 | if (rc != 0) | 1697 | if (rc != 0) |
1698 | break; | 1698 | break; |
1699 | } | 1699 | } |
@@ -1850,7 +1850,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
1850 | while (rc == -EAGAIN) { | 1850 | while (rc == -EAGAIN) { |
1851 | if ((open_file->invalidHandle) && | 1851 | if ((open_file->invalidHandle) && |
1852 | (!open_file->closePend)) { | 1852 | (!open_file->closePend)) { |
1853 | rc = cifs_reopen_file(file, TRUE); | 1853 | rc = cifs_reopen_file(file, true); |
1854 | if (rc != 0) | 1854 | if (rc != 0) |
1855 | break; | 1855 | break; |
1856 | } | 1856 | } |
@@ -2009,10 +2009,10 @@ static int is_inode_writable(struct cifsInodeInfo *cifs_inode) | |||
2009 | refreshing the inode only on increases in the file size | 2009 | refreshing the inode only on increases in the file size |
2010 | but this is tricky to do without racing with writebehind | 2010 | but this is tricky to do without racing with writebehind |
2011 | page caching in the current Linux kernel design */ | 2011 | page caching in the current Linux kernel design */ |
2012 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) | 2012 | bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) |
2013 | { | 2013 | { |
2014 | if (!cifsInode) | 2014 | if (!cifsInode) |
2015 | return 1; | 2015 | return true; |
2016 | 2016 | ||
2017 | if (is_inode_writable(cifsInode)) { | 2017 | if (is_inode_writable(cifsInode)) { |
2018 | /* This inode is open for write at least once */ | 2018 | /* This inode is open for write at least once */ |
@@ -2022,15 +2022,15 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) | |||
2022 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | 2022 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
2023 | /* since no page cache to corrupt on directio | 2023 | /* since no page cache to corrupt on directio |
2024 | we can change size safely */ | 2024 | we can change size safely */ |
2025 | return 1; | 2025 | return true; |
2026 | } | 2026 | } |
2027 | 2027 | ||
2028 | if (i_size_read(&cifsInode->vfs_inode) < end_of_file) | 2028 | if (i_size_read(&cifsInode->vfs_inode) < end_of_file) |
2029 | return 1; | 2029 | return true; |
2030 | 2030 | ||
2031 | return 0; | 2031 | return false; |
2032 | } else | 2032 | } else |
2033 | return 1; | 2033 | return true; |
2034 | } | 2034 | } |
2035 | 2035 | ||
2036 | static int cifs_prepare_write(struct file *file, struct page *page, | 2036 | static int cifs_prepare_write(struct file *file, struct page *page, |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index e1031b9e2c55..fcbdbb6ad7bf 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -281,7 +281,7 @@ static int decode_sfu_inode(struct inode *inode, __u64 size, | |||
281 | struct cifs_sb_info *cifs_sb, int xid) | 281 | struct cifs_sb_info *cifs_sb, int xid) |
282 | { | 282 | { |
283 | int rc; | 283 | int rc; |
284 | int oplock = FALSE; | 284 | int oplock = 0; |
285 | __u16 netfid; | 285 | __u16 netfid; |
286 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | 286 | struct cifsTconInfo *pTcon = cifs_sb->tcon; |
287 | char buf[24]; | 287 | char buf[24]; |
@@ -389,7 +389,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
389 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 389 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
390 | const unsigned char *full_path = NULL; | 390 | const unsigned char *full_path = NULL; |
391 | char *buf = NULL; | 391 | char *buf = NULL; |
392 | int adjustTZ = FALSE; | 392 | bool adjustTZ = false; |
393 | bool is_dfs_referral = false; | 393 | bool is_dfs_referral = false; |
394 | 394 | ||
395 | pTcon = cifs_sb->tcon; | 395 | pTcon = cifs_sb->tcon; |
@@ -425,7 +425,7 @@ try_again_CIFSSMBQPathInfo: | |||
425 | pfindData, cifs_sb->local_nls, | 425 | pfindData, cifs_sb->local_nls, |
426 | cifs_sb->mnt_cifs_flags & | 426 | cifs_sb->mnt_cifs_flags & |
427 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 427 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
428 | adjustTZ = TRUE; | 428 | adjustTZ = true; |
429 | } | 429 | } |
430 | } | 430 | } |
431 | /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ | 431 | /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ |
@@ -703,7 +703,7 @@ psx_del_no_retry: | |||
703 | } else if (rc == -ENOENT) { | 703 | } else if (rc == -ENOENT) { |
704 | d_drop(direntry); | 704 | d_drop(direntry); |
705 | } else if (rc == -ETXTBSY) { | 705 | } else if (rc == -ETXTBSY) { |
706 | int oplock = FALSE; | 706 | int oplock = 0; |
707 | __u16 netfid; | 707 | __u16 netfid; |
708 | 708 | ||
709 | rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, | 709 | rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, |
@@ -736,7 +736,7 @@ psx_del_no_retry: | |||
736 | rc = -EOPNOTSUPP; | 736 | rc = -EOPNOTSUPP; |
737 | 737 | ||
738 | if (rc == -EOPNOTSUPP) { | 738 | if (rc == -EOPNOTSUPP) { |
739 | int oplock = FALSE; | 739 | int oplock = 0; |
740 | __u16 netfid; | 740 | __u16 netfid; |
741 | /* rc = CIFSSMBSetAttrLegacy(xid, pTcon, | 741 | /* rc = CIFSSMBSetAttrLegacy(xid, pTcon, |
742 | full_path, | 742 | full_path, |
@@ -774,7 +774,7 @@ psx_del_no_retry: | |||
774 | if (direntry->d_inode) | 774 | if (direntry->d_inode) |
775 | drop_nlink(direntry->d_inode); | 775 | drop_nlink(direntry->d_inode); |
776 | } else if (rc == -ETXTBSY) { | 776 | } else if (rc == -ETXTBSY) { |
777 | int oplock = FALSE; | 777 | int oplock = 0; |
778 | __u16 netfid; | 778 | __u16 netfid; |
779 | 779 | ||
780 | rc = CIFSSMBOpen(xid, pTcon, full_path, | 780 | rc = CIFSSMBOpen(xid, pTcon, full_path, |
@@ -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; |
@@ -1149,7 +1156,7 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, | |||
1149 | cFYI(1, ("rename rc %d", rc)); | 1156 | cFYI(1, ("rename rc %d", rc)); |
1150 | 1157 | ||
1151 | if ((rc == -EIO) || (rc == -EEXIST)) { | 1158 | if ((rc == -EIO) || (rc == -EEXIST)) { |
1152 | int oplock = FALSE; | 1159 | int oplock = 0; |
1153 | __u16 netfid; | 1160 | __u16 netfid; |
1154 | 1161 | ||
1155 | /* BB FIXME Is Generic Read correct for rename? */ | 1162 | /* BB FIXME Is Generic Read correct for rename? */ |
@@ -1186,7 +1193,7 @@ int cifs_revalidate(struct dentry *direntry) | |||
1186 | struct cifsInodeInfo *cifsInode; | 1193 | struct cifsInodeInfo *cifsInode; |
1187 | loff_t local_size; | 1194 | loff_t local_size; |
1188 | struct timespec local_mtime; | 1195 | struct timespec local_mtime; |
1189 | int invalidate_inode = FALSE; | 1196 | bool invalidate_inode = false; |
1190 | 1197 | ||
1191 | if (direntry->d_inode == NULL) | 1198 | if (direntry->d_inode == NULL) |
1192 | return -ENOENT; | 1199 | return -ENOENT; |
@@ -1268,7 +1275,7 @@ int cifs_revalidate(struct dentry *direntry) | |||
1268 | only ones who could have modified the file and the | 1275 | only ones who could have modified the file and the |
1269 | server copy is staler than ours */ | 1276 | server copy is staler than ours */ |
1270 | } else { | 1277 | } else { |
1271 | invalidate_inode = TRUE; | 1278 | invalidate_inode = true; |
1272 | } | 1279 | } |
1273 | } | 1280 | } |
1274 | 1281 | ||
@@ -1402,24 +1409,25 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1402 | int rc = -EACCES; | 1409 | int rc = -EACCES; |
1403 | struct cifsFileInfo *open_file = NULL; | 1410 | struct cifsFileInfo *open_file = NULL; |
1404 | FILE_BASIC_INFO time_buf; | 1411 | FILE_BASIC_INFO time_buf; |
1405 | int set_time = FALSE; | 1412 | bool set_time = false; |
1406 | int set_dosattr = FALSE; | 1413 | bool set_dosattr = false; |
1407 | __u64 mode = 0xFFFFFFFFFFFFFFFFULL; | 1414 | __u64 mode = 0xFFFFFFFFFFFFFFFFULL; |
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 | } |
@@ -1464,7 +1472,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1464 | __u16 nfid = open_file->netfid; | 1472 | __u16 nfid = open_file->netfid; |
1465 | __u32 npid = open_file->pid; | 1473 | __u32 npid = open_file->pid; |
1466 | rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, | 1474 | rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, |
1467 | nfid, npid, FALSE); | 1475 | nfid, npid, false); |
1468 | atomic_dec(&open_file->wrtPending); | 1476 | atomic_dec(&open_file->wrtPending); |
1469 | cFYI(1, ("SetFSize for attrs rc = %d", rc)); | 1477 | cFYI(1, ("SetFSize for attrs rc = %d", rc)); |
1470 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | 1478 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { |
@@ -1484,14 +1492,14 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1484 | it was found or because there was an error setting | 1492 | it was found or because there was an error setting |
1485 | it by handle */ | 1493 | it by handle */ |
1486 | rc = CIFSSMBSetEOF(xid, pTcon, full_path, | 1494 | rc = CIFSSMBSetEOF(xid, pTcon, full_path, |
1487 | attrs->ia_size, FALSE, | 1495 | attrs->ia_size, false, |
1488 | cifs_sb->local_nls, | 1496 | cifs_sb->local_nls, |
1489 | cifs_sb->mnt_cifs_flags & | 1497 | cifs_sb->mnt_cifs_flags & |
1490 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1498 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1491 | cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc)); | 1499 | cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc)); |
1492 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { | 1500 | if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { |
1493 | __u16 netfid; | 1501 | __u16 netfid; |
1494 | int oplock = FALSE; | 1502 | int oplock = 0; |
1495 | 1503 | ||
1496 | rc = SMBLegacyOpen(xid, pTcon, full_path, | 1504 | rc = SMBLegacyOpen(xid, pTcon, full_path, |
1497 | FILE_OPEN, | 1505 | FILE_OPEN, |
@@ -1516,14 +1524,13 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1516 | 1524 | ||
1517 | /* Server is ok setting allocation size implicitly - no need | 1525 | /* Server is ok setting allocation size implicitly - no need |
1518 | to call: | 1526 | to call: |
1519 | CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, TRUE, | 1527 | CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, true, |
1520 | cifs_sb->local_nls); | 1528 | cifs_sb->local_nls); |
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,14 +1564,14 @@ 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) { |
1564 | #endif | 1571 | #endif |
1565 | /* not writeable */ | 1572 | /* not writeable */ |
1566 | if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) { | 1573 | if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) { |
1567 | set_dosattr = TRUE; | 1574 | set_dosattr = true; |
1568 | time_buf.Attributes = | 1575 | time_buf.Attributes = |
1569 | cpu_to_le32(cifsInode->cifsAttrs | | 1576 | cpu_to_le32(cifsInode->cifsAttrs | |
1570 | ATTR_READONLY); | 1577 | ATTR_READONLY); |
@@ -1574,28 +1581,24 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1574 | not be able to write to it - so if any write | 1581 | not be able to write to it - so if any write |
1575 | bit is enabled for user or group or other we | 1582 | bit is enabled for user or group or other we |
1576 | need to at least try to remove r/o dos attr */ | 1583 | need to at least try to remove r/o dos attr */ |
1577 | set_dosattr = TRUE; | 1584 | set_dosattr = true; |
1578 | time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs & | 1585 | time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs & |
1579 | (~ATTR_READONLY)); | 1586 | (~ATTR_READONLY)); |
1580 | /* Windows ignores set to zero */ | 1587 | /* Windows ignores set to zero */ |
1581 | if (time_buf.Attributes == 0) | 1588 | if (time_buf.Attributes == 0) |
1582 | time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL); | 1589 | time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL); |
1583 | } | 1590 | } |
1584 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
1585 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) | ||
1586 | mode_to_acl(direntry->d_inode, full_path, mode); | ||
1587 | #endif | ||
1588 | } | 1591 | } |
1589 | 1592 | ||
1590 | if (attrs->ia_valid & ATTR_ATIME) { | 1593 | if (attrs->ia_valid & ATTR_ATIME) { |
1591 | set_time = TRUE; | 1594 | set_time = true; |
1592 | time_buf.LastAccessTime = | 1595 | time_buf.LastAccessTime = |
1593 | cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime)); | 1596 | cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime)); |
1594 | } else | 1597 | } else |
1595 | time_buf.LastAccessTime = 0; | 1598 | time_buf.LastAccessTime = 0; |
1596 | 1599 | ||
1597 | if (attrs->ia_valid & ATTR_MTIME) { | 1600 | if (attrs->ia_valid & ATTR_MTIME) { |
1598 | set_time = TRUE; | 1601 | set_time = true; |
1599 | time_buf.LastWriteTime = | 1602 | time_buf.LastWriteTime = |
1600 | cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime)); | 1603 | cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime)); |
1601 | } else | 1604 | } else |
@@ -1606,7 +1609,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1606 | server times */ | 1609 | server times */ |
1607 | 1610 | ||
1608 | if (set_time && (attrs->ia_valid & ATTR_CTIME)) { | 1611 | if (set_time && (attrs->ia_valid & ATTR_CTIME)) { |
1609 | set_time = TRUE; | 1612 | set_time = true; |
1610 | /* Although Samba throws this field away | 1613 | /* Although Samba throws this field away |
1611 | it may be useful to Windows - but we do | 1614 | it may be useful to Windows - but we do |
1612 | not want to set ctime unless some other | 1615 | not want to set ctime unless some other |
@@ -1630,7 +1633,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1630 | rc = -EOPNOTSUPP; | 1633 | rc = -EOPNOTSUPP; |
1631 | 1634 | ||
1632 | if (rc == -EOPNOTSUPP) { | 1635 | if (rc == -EOPNOTSUPP) { |
1633 | int oplock = FALSE; | 1636 | int oplock = 0; |
1634 | __u16 netfid; | 1637 | __u16 netfid; |
1635 | 1638 | ||
1636 | cFYI(1, ("calling SetFileInfo since SetPathInfo for " | 1639 | cFYI(1, ("calling SetFileInfo since SetPathInfo for " |
@@ -1669,7 +1672,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1669 | /* 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 |
1670 | that */ | 1673 | that */ |
1671 | if (!rc) | 1674 | if (!rc) |
1672 | rc = inode_setattr(direntry->d_inode, attrs); | 1675 | rc = inode_setattr(inode, attrs); |
1673 | cifs_setattr_exit: | 1676 | cifs_setattr_exit: |
1674 | kfree(full_path); | 1677 | kfree(full_path); |
1675 | FreeXid(xid); | 1678 | FreeXid(xid); |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index d4e7ec93285f..1c2c3ce5020b 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -230,7 +230,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) | |||
230 | struct inode *inode = direntry->d_inode; | 230 | struct inode *inode = direntry->d_inode; |
231 | int rc = -EACCES; | 231 | int rc = -EACCES; |
232 | int xid; | 232 | int xid; |
233 | int oplock = FALSE; | 233 | int oplock = 0; |
234 | struct cifs_sb_info *cifs_sb; | 234 | struct cifs_sb_info *cifs_sb; |
235 | struct cifsTconInfo *pTcon; | 235 | struct cifsTconInfo *pTcon; |
236 | char *full_path = NULL; | 236 | char *full_path = NULL; |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 2a42d9fedbb2..1d69b8014e0b 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -496,7 +496,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
496 | } | 496 | } |
497 | return 0; | 497 | return 0; |
498 | } | 498 | } |
499 | int | 499 | |
500 | bool | ||
500 | is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | 501 | is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) |
501 | { | 502 | { |
502 | struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf; | 503 | struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf; |
@@ -522,17 +523,17 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
522 | pnotify->Action)); /* BB removeme BB */ | 523 | pnotify->Action)); /* BB removeme BB */ |
523 | /* cifs_dump_mem("Rcvd notify Data: ",buf, | 524 | /* cifs_dump_mem("Rcvd notify Data: ",buf, |
524 | sizeof(struct smb_hdr)+60); */ | 525 | sizeof(struct smb_hdr)+60); */ |
525 | return TRUE; | 526 | return true; |
526 | } | 527 | } |
527 | if (pSMBr->hdr.Status.CifsError) { | 528 | if (pSMBr->hdr.Status.CifsError) { |
528 | cFYI(1, ("notify err 0x%d", | 529 | cFYI(1, ("notify err 0x%d", |
529 | pSMBr->hdr.Status.CifsError)); | 530 | pSMBr->hdr.Status.CifsError)); |
530 | return TRUE; | 531 | return true; |
531 | } | 532 | } |
532 | return FALSE; | 533 | return false; |
533 | } | 534 | } |
534 | if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) | 535 | if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) |
535 | return FALSE; | 536 | return false; |
536 | if (pSMB->hdr.Flags & SMBFLG_RESPONSE) { | 537 | if (pSMB->hdr.Flags & SMBFLG_RESPONSE) { |
537 | /* no sense logging error on invalid handle on oplock | 538 | /* no sense logging error on invalid handle on oplock |
538 | break - harmless race between close request and oplock | 539 | break - harmless race between close request and oplock |
@@ -541,21 +542,21 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
541 | if ((NT_STATUS_INVALID_HANDLE) == | 542 | if ((NT_STATUS_INVALID_HANDLE) == |
542 | le32_to_cpu(pSMB->hdr.Status.CifsError)) { | 543 | le32_to_cpu(pSMB->hdr.Status.CifsError)) { |
543 | cFYI(1, ("invalid handle on oplock break")); | 544 | cFYI(1, ("invalid handle on oplock break")); |
544 | return TRUE; | 545 | return true; |
545 | } else if (ERRbadfid == | 546 | } else if (ERRbadfid == |
546 | le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { | 547 | le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { |
547 | return TRUE; | 548 | return true; |
548 | } else { | 549 | } else { |
549 | return FALSE; /* on valid oplock brk we get "request" */ | 550 | return false; /* on valid oplock brk we get "request" */ |
550 | } | 551 | } |
551 | } | 552 | } |
552 | if (pSMB->hdr.WordCount != 8) | 553 | if (pSMB->hdr.WordCount != 8) |
553 | return FALSE; | 554 | return false; |
554 | 555 | ||
555 | cFYI(1, ("oplock type 0x%d level 0x%d", | 556 | cFYI(1, ("oplock type 0x%d level 0x%d", |
556 | pSMB->LockType, pSMB->OplockLevel)); | 557 | pSMB->LockType, pSMB->OplockLevel)); |
557 | if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) | 558 | if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) |
558 | return FALSE; | 559 | return false; |
559 | 560 | ||
560 | /* look up tcon based on tid & uid */ | 561 | /* look up tcon based on tid & uid */ |
561 | read_lock(&GlobalSMBSeslock); | 562 | read_lock(&GlobalSMBSeslock); |
@@ -573,11 +574,11 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
573 | ("file id match, oplock break")); | 574 | ("file id match, oplock break")); |
574 | pCifsInode = | 575 | pCifsInode = |
575 | CIFS_I(netfile->pInode); | 576 | CIFS_I(netfile->pInode); |
576 | pCifsInode->clientCanCacheAll = FALSE; | 577 | pCifsInode->clientCanCacheAll = false; |
577 | if (pSMB->OplockLevel == 0) | 578 | if (pSMB->OplockLevel == 0) |
578 | pCifsInode->clientCanCacheRead | 579 | pCifsInode->clientCanCacheRead |
579 | = FALSE; | 580 | = false; |
580 | pCifsInode->oplockPending = TRUE; | 581 | pCifsInode->oplockPending = true; |
581 | AllocOplockQEntry(netfile->pInode, | 582 | AllocOplockQEntry(netfile->pInode, |
582 | netfile->netfid, | 583 | netfile->netfid, |
583 | tcon); | 584 | tcon); |
@@ -585,17 +586,17 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
585 | ("about to wake up oplock thread")); | 586 | ("about to wake up oplock thread")); |
586 | if (oplockThread) | 587 | if (oplockThread) |
587 | wake_up_process(oplockThread); | 588 | wake_up_process(oplockThread); |
588 | return TRUE; | 589 | return true; |
589 | } | 590 | } |
590 | } | 591 | } |
591 | read_unlock(&GlobalSMBSeslock); | 592 | read_unlock(&GlobalSMBSeslock); |
592 | cFYI(1, ("No matching file for oplock break")); | 593 | cFYI(1, ("No matching file for oplock break")); |
593 | return TRUE; | 594 | return true; |
594 | } | 595 | } |
595 | } | 596 | } |
596 | read_unlock(&GlobalSMBSeslock); | 597 | read_unlock(&GlobalSMBSeslock); |
597 | cFYI(1, ("Can not process oplock break for non-existent connection")); | 598 | cFYI(1, ("Can not process oplock break for non-existent connection")); |
598 | return TRUE; | 599 | return true; |
599 | } | 600 | } |
600 | 601 | ||
601 | void | 602 | void |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 3b5a5ce882b6..00f4cff400b3 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -132,47 +132,17 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = { | |||
132 | {0, 0} | 132 | {0, 0} |
133 | }; | 133 | }; |
134 | 134 | ||
135 | |||
136 | /* if the mount helper is missing we need to reverse the 1st slash | ||
137 | from '/' to backslash in order to format the UNC properly for | ||
138 | ip address parsing and for tree connect (unless the user | ||
139 | remembered to put the UNC name in properly). Fortunately we do | ||
140 | not have to call this twice (we check for IPv4 addresses | ||
141 | first, so it is already converted by the time we | ||
142 | try IPv6 addresses */ | ||
143 | static int canonicalize_unc(char *cp) | ||
144 | { | ||
145 | int i; | ||
146 | |||
147 | for (i = 0; i <= 46 /* INET6_ADDRSTRLEN */ ; i++) { | ||
148 | if (cp[i] == 0) | ||
149 | break; | ||
150 | if (cp[i] == '\\') | ||
151 | break; | ||
152 | if (cp[i] == '/') { | ||
153 | cFYI(DBG2, ("change slash to \\ in malformed UNC")); | ||
154 | cp[i] = '\\'; | ||
155 | return 1; | ||
156 | } | ||
157 | } | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | /* Convert string containing dotted ip address to binary form */ | 135 | /* Convert string containing dotted ip address to binary form */ |
162 | /* returns 0 if invalid address */ | 136 | /* returns 0 if invalid address */ |
163 | 137 | ||
164 | int | 138 | int |
165 | cifs_inet_pton(int address_family, char *cp, void *dst) | 139 | cifs_inet_pton(const int address_family, const char *cp, void *dst) |
166 | { | 140 | { |
167 | int ret = 0; | 141 | int ret = 0; |
168 | 142 | ||
169 | /* calculate length by finding first slash or NULL */ | 143 | /* calculate length by finding first slash or NULL */ |
170 | if (address_family == AF_INET) { | 144 | if (address_family == AF_INET) { |
171 | ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); | 145 | ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); |
172 | if (ret == 0) { | ||
173 | if (canonicalize_unc(cp)) | ||
174 | ret = in4_pton(cp, -1, dst, '\\', NULL); | ||
175 | } | ||
176 | } else if (address_family == AF_INET6) { | 146 | } else if (address_family == AF_INET6) { |
177 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); | 147 | ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); |
178 | } | 148 | } |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 32b445edc882..34ec32100c72 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -447,8 +447,8 @@ static int initiate_cifs_search(const int xid, struct file *file) | |||
447 | if (file->private_data == NULL) | 447 | if (file->private_data == NULL) |
448 | return -ENOMEM; | 448 | return -ENOMEM; |
449 | cifsFile = file->private_data; | 449 | cifsFile = file->private_data; |
450 | cifsFile->invalidHandle = TRUE; | 450 | cifsFile->invalidHandle = true; |
451 | cifsFile->srch_inf.endOfSearch = FALSE; | 451 | cifsFile->srch_inf.endOfSearch = false; |
452 | 452 | ||
453 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 453 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); |
454 | if (cifs_sb == NULL) | 454 | if (cifs_sb == NULL) |
@@ -485,7 +485,7 @@ ffirst_retry: | |||
485 | cifs_sb->mnt_cifs_flags & | 485 | cifs_sb->mnt_cifs_flags & |
486 | CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); | 486 | CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); |
487 | if (rc == 0) | 487 | if (rc == 0) |
488 | cifsFile->invalidHandle = FALSE; | 488 | cifsFile->invalidHandle = false; |
489 | if ((rc == -EOPNOTSUPP) && | 489 | if ((rc == -EOPNOTSUPP) && |
490 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { | 490 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { |
491 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; | 491 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; |
@@ -670,7 +670,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
670 | (index_to_find < first_entry_in_buffer)) { | 670 | (index_to_find < first_entry_in_buffer)) { |
671 | /* close and restart search */ | 671 | /* close and restart search */ |
672 | cFYI(1, ("search backing up - close and restart search")); | 672 | cFYI(1, ("search backing up - close and restart search")); |
673 | cifsFile->invalidHandle = TRUE; | 673 | cifsFile->invalidHandle = true; |
674 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 674 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
675 | kfree(cifsFile->search_resume_name); | 675 | kfree(cifsFile->search_resume_name); |
676 | cifsFile->search_resume_name = NULL; | 676 | cifsFile->search_resume_name = NULL; |
@@ -692,7 +692,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, | |||
692 | } | 692 | } |
693 | 693 | ||
694 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && | 694 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && |
695 | (rc == 0) && (cifsFile->srch_inf.endOfSearch == FALSE)) { | 695 | (rc == 0) && !cifsFile->srch_inf.endOfSearch) { |
696 | cFYI(1, ("calling findnext2")); | 696 | cFYI(1, ("calling findnext2")); |
697 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, | 697 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, |
698 | &cifsFile->srch_inf); | 698 | &cifsFile->srch_inf); |
@@ -1038,7 +1038,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
1038 | break; | 1038 | break; |
1039 | } | 1039 | } |
1040 | } /* else { | 1040 | } /* else { |
1041 | cifsFile->invalidHandle = TRUE; | 1041 | cifsFile->invalidHandle = true; |
1042 | CIFSFindClose(xid, pTcon, cifsFile->netfid); | 1042 | CIFSFindClose(xid, pTcon, cifsFile->netfid); |
1043 | } | 1043 | } |
1044 | kfree(cifsFile->search_resume_name); | 1044 | kfree(cifsFile->search_resume_name); |
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index 58bbfd992cc0..ff3232fa1015 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
@@ -35,11 +35,11 @@ | |||
35 | #include "cifs_debug.h" | 35 | #include "cifs_debug.h" |
36 | #include "cifsencrypt.h" | 36 | #include "cifsencrypt.h" |
37 | 37 | ||
38 | #ifndef FALSE | 38 | #ifndef false |
39 | #define FALSE 0 | 39 | #define false 0 |
40 | #endif | 40 | #endif |
41 | #ifndef TRUE | 41 | #ifndef true |
42 | #define TRUE 1 | 42 | #define true 1 |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | /* following came from the other byteorder.h to avoid include conflicts */ | 45 | /* following came from the other byteorder.h to avoid include conflicts */ |
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 8cd6a445b017..e9527eedc639 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -264,7 +264,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, | |||
264 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 264 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
265 | else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | 265 | else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { |
266 | __u16 fid; | 266 | __u16 fid; |
267 | int oplock = FALSE; | 267 | int oplock = 0; |
268 | struct cifs_ntsd *pacl = NULL; | 268 | struct cifs_ntsd *pacl = NULL; |
269 | __u32 buflen = 0; | 269 | __u32 buflen = 0; |
270 | if (experimEnabled) | 270 | if (experimEnabled) |
diff --git a/fs/dquot.c b/fs/dquot.c index dfba1623cccb..5ac77da19959 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 0a1397335a8e..c92cc1c00aae 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 | ||
45 | static void unlock_parent(struct dentry *dentry) | ||
46 | { | ||
47 | mutex_unlock(&(dentry->d_parent->d_inode->i_mutex)); | ||
48 | dput(dentry->d_parent); | ||
49 | } | ||
50 | |||
51 | static void unlock_dir(struct dentry *dir) | 45 | static 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); |
441 | out_unlock: | 436 | out_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 788995efd1d3..6560da1a58ce 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 */ |
@@ -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); |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index d4a4f0e9ff69..175414ac2210 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/mballoc.c b/fs/ext4/mballoc.c index fbec2ef93797..b128bdc0f55c 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); |
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 3fbc2c6c3d0e..ff08633f398e 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/fuse/file.c b/fs/fuse/file.c index f28cf8b46f80..8092f0d9fd1f 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 dadffa21a206..bae948657c4f 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 79b615873838..fb77e0962132 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 d53b2af91c25..67e1c8b467c4 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 6890433f7595..8a1f50344368 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 | ||
6 | hppfs-objs := hppfs_kern.o | 6 | hppfs-objs := hppfs.o |
7 | 7 | ||
8 | obj-y = | 8 | obj-y = |
9 | obj-$(CONFIG_HPPFS) += hppfs.o | 9 | obj-$(CONFIG_HPPFS) += $(hppfs-objs) |
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs.c index 8601d8ef3b55..65077aa90f0a 100644 --- a/fs/hppfs/hppfs_kern.c +++ b/fs/hppfs/hppfs.c | |||
@@ -33,7 +33,7 @@ struct hppfs_private { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | struct hppfs_inode_info { | 35 | struct 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 | ||
138 | static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, | 138 | static 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 | ||
288 | static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len, | 292 | static 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 | ||
305 | static int open_host_sock(char *host_file, int *filter_out) | 303 | static 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) | |||
429 | static int hppfs_open(struct inode *inode, struct file *file) | 427 | static 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) | |||
492 | static int hppfs_dir_open(struct inode *inode, struct file *file) | 490 | static 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 | ||
621 | void hppfs_delete_inode(struct inode *ino) | 619 | void 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 | ||
631 | static void hppfs_put_super(struct super_block *sb) | ||
632 | { | ||
633 | mntput(sb->s_fs_info); | ||
634 | } | ||
635 | |||
636 | static const struct super_operations hppfs_sbops = { | 632 | static 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 | ||
644 | static int hppfs_readlink(struct dentry *dentry, char __user *buffer, | 639 | static 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 | ||
666 | static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 649 | static 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; | 658 | int hppfs_permission(struct inode *inode, int mask, struct nameidata *nd) |
659 | { | ||
660 | return generic_permission(inode, mask, NULL); | ||
685 | } | 661 | } |
686 | 662 | ||
687 | static const struct inode_operations hppfs_dir_iops = { | 663 | static const struct inode_operations hppfs_dir_iops = { |
688 | .lookup = hppfs_lookup, | 664 | .lookup = hppfs_lookup, |
665 | .permission = hppfs_permission, | ||
689 | }; | 666 | }; |
690 | 667 | ||
691 | static const struct inode_operations hppfs_link_iops = { | 668 | static 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 | ||
696 | static struct inode *get_inode(struct super_block *sb, struct dentry *dentry) | 674 | static 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 | ||
731 | static int hppfs_fill_super(struct super_block *sb, void *d, int silent) | 709 | static int hppfs_fill_super(struct super_block *sb, void *d, int silent) |
diff --git a/fs/inode.c b/fs/inode.c index bf6478130424..c36d9480335c 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1149,13 +1149,8 @@ static inline void iput_final(struct inode *inode) | |||
1149 | void iput(struct inode *inode) | 1149 | void iput(struct inode *inode) |
1150 | { | 1150 | { |
1151 | if (inode) { | 1151 | if (inode) { |
1152 | const struct super_operations *op = inode->i_sb->s_op; | ||
1153 | |||
1154 | BUG_ON(inode->i_state == I_CLEAR); | 1152 | BUG_ON(inode->i_state == I_CLEAR); |
1155 | 1153 | ||
1156 | if (op && op->put_inode) | ||
1157 | op->put_inode(inode); | ||
1158 | |||
1159 | if (atomic_dec_and_lock(&inode->i_count, &inode_lock)) | 1154 | if (atomic_dec_and_lock(&inode->i_count, &inode_lock)) |
1160 | iput_final(inode); | 1155 | iput_final(inode); |
1161 | } | 1156 | } |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index cd931ef1f000..5a8ca61498ca 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/journal.c b/fs/jbd2/journal.c index 53632e3e8457..2e24567c4a79 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/locks.c b/fs/locks.c index 663c069b59b3..11dbf08651b7 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -773,7 +773,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request) | |||
773 | * give it the opportunity to lock the file. | 773 | * give it the opportunity to lock the file. |
774 | */ | 774 | */ |
775 | if (found) | 775 | if (found) |
776 | cond_resched(); | 776 | cond_resched_bkl(); |
777 | 777 | ||
778 | find_conflict: | 778 | find_conflict: |
779 | for_each_lock(inode, before) { | 779 | for_each_lock(inode, before) { |
@@ -1753,6 +1753,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, | |||
1753 | struct file_lock *file_lock = locks_alloc_lock(); | 1753 | struct file_lock *file_lock = locks_alloc_lock(); |
1754 | struct flock flock; | 1754 | struct flock flock; |
1755 | struct inode *inode; | 1755 | struct inode *inode; |
1756 | struct file *f; | ||
1756 | int error; | 1757 | int error; |
1757 | 1758 | ||
1758 | if (file_lock == NULL) | 1759 | if (file_lock == NULL) |
@@ -1825,7 +1826,15 @@ again: | |||
1825 | * Attempt to detect a close/fcntl race and recover by | 1826 | * Attempt to detect a close/fcntl race and recover by |
1826 | * releasing the lock that was just acquired. | 1827 | * releasing the lock that was just acquired. |
1827 | */ | 1828 | */ |
1828 | if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) { | 1829 | /* |
1830 | * we need that spin_lock here - it prevents reordering between | ||
1831 | * update of inode->i_flock and check for it done in close(). | ||
1832 | * rcu_read_lock() wouldn't do. | ||
1833 | */ | ||
1834 | spin_lock(¤t->files->file_lock); | ||
1835 | f = fcheck(fd); | ||
1836 | spin_unlock(¤t->files->file_lock); | ||
1837 | if (!error && f != filp && flock.l_type != F_UNLCK) { | ||
1829 | flock.l_type = F_UNLCK; | 1838 | flock.l_type = F_UNLCK; |
1830 | goto again; | 1839 | goto again; |
1831 | } | 1840 | } |
@@ -1881,6 +1890,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, | |||
1881 | struct file_lock *file_lock = locks_alloc_lock(); | 1890 | struct file_lock *file_lock = locks_alloc_lock(); |
1882 | struct flock64 flock; | 1891 | struct flock64 flock; |
1883 | struct inode *inode; | 1892 | struct inode *inode; |
1893 | struct file *f; | ||
1884 | int error; | 1894 | int error; |
1885 | 1895 | ||
1886 | if (file_lock == NULL) | 1896 | if (file_lock == NULL) |
@@ -1953,7 +1963,10 @@ again: | |||
1953 | * Attempt to detect a close/fcntl race and recover by | 1963 | * Attempt to detect a close/fcntl race and recover by |
1954 | * releasing the lock that was just acquired. | 1964 | * releasing the lock that was just acquired. |
1955 | */ | 1965 | */ |
1956 | if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) { | 1966 | spin_lock(¤t->files->file_lock); |
1967 | f = fcheck(fd); | ||
1968 | spin_unlock(¤t->files->file_lock); | ||
1969 | if (!error && f != filp && flock.l_type != F_UNLCK) { | ||
1957 | flock.l_type = F_UNLCK; | 1970 | flock.l_type = F_UNLCK; |
1958 | goto again; | 1971 | goto again; |
1959 | } | 1972 | } |
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/audit.h> | 19 | #include <linux/audit.h> |
20 | #include <linux/syscalls.h> | ||
20 | 21 | ||
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
22 | #include <asm/ioctls.h> | 23 | #include <asm/ioctls.h> |
@@ -1086,8 +1087,11 @@ asmlinkage long __weak sys_pipe(int __user *fildes) | |||
1086 | 1087 | ||
1087 | error = do_pipe(fd); | 1088 | error = do_pipe(fd); |
1088 | if (!error) { | 1089 | if (!error) { |
1089 | if (copy_to_user(fildes, fd, sizeof(fd))) | 1090 | if (copy_to_user(fildes, fd, sizeof(fd))) { |
1091 | sys_close(fd[0]); | ||
1092 | sys_close(fd[1]); | ||
1090 | error = -EFAULT; | 1093 | error = -EFAULT; |
1094 | } | ||
1091 | } | 1095 | } |
1092 | return error; | 1096 | return error; |
1093 | } | 1097 | } |
diff --git a/fs/proc/array.c b/fs/proc/array.c index dca997a93bff..9e3b8c33c24b 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 | ||
303 | static inline void task_context_switch_counts(struct seq_file *m, | 304 | static inline void task_context_switch_counts(struct seq_file *m, |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index e2b8e769f510..88717c0f941b 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -5,11 +5,9 @@ | |||
5 | #include <linux/highmem.h> | 5 | #include <linux/highmem.h> |
6 | #include <linux/ptrace.h> | 6 | #include <linux/ptrace.h> |
7 | #include <linux/pagemap.h> | 7 | #include <linux/pagemap.h> |
8 | #include <linux/ptrace.h> | ||
9 | #include <linux/mempolicy.h> | 8 | #include <linux/mempolicy.h> |
10 | #include <linux/swap.h> | 9 | #include <linux/swap.h> |
11 | #include <linux/swapops.h> | 10 | #include <linux/swapops.h> |
12 | #include <linux/seq_file.h> | ||
13 | 11 | ||
14 | #include <asm/elf.h> | 12 | #include <asm/elf.h> |
15 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
diff --git a/fs/splice.c b/fs/splice.c index 633f58ebfb72..78150038b584 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -811,24 +811,19 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
811 | { | 811 | { |
812 | struct address_space *mapping = out->f_mapping; | 812 | struct address_space *mapping = out->f_mapping; |
813 | struct inode *inode = mapping->host; | 813 | struct inode *inode = mapping->host; |
814 | int killsuid, killpriv; | 814 | struct splice_desc sd = { |
815 | .total_len = len, | ||
816 | .flags = flags, | ||
817 | .pos = *ppos, | ||
818 | .u.file = out, | ||
819 | }; | ||
815 | ssize_t ret; | 820 | ssize_t ret; |
816 | int err = 0; | ||
817 | |||
818 | killpriv = security_inode_need_killpriv(out->f_path.dentry); | ||
819 | killsuid = should_remove_suid(out->f_path.dentry); | ||
820 | if (unlikely(killsuid || killpriv)) { | ||
821 | mutex_lock(&inode->i_mutex); | ||
822 | if (killpriv) | ||
823 | err = security_inode_killpriv(out->f_path.dentry); | ||
824 | if (!err && killsuid) | ||
825 | err = __remove_suid(out->f_path.dentry, killsuid); | ||
826 | mutex_unlock(&inode->i_mutex); | ||
827 | if (err) | ||
828 | return err; | ||
829 | } | ||
830 | 821 | ||
831 | ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); | 822 | inode_double_lock(inode, pipe->inode); |
823 | ret = remove_suid(out->f_path.dentry); | ||
824 | if (likely(!ret)) | ||
825 | ret = __splice_from_pipe(pipe, &sd, pipe_to_file); | ||
826 | inode_double_unlock(inode, pipe->inode); | ||
832 | if (ret > 0) { | 827 | if (ret > 0) { |
833 | unsigned long nr_pages; | 828 | unsigned long nr_pages; |
834 | 829 | ||
@@ -840,6 +835,8 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
840 | * sync it. | 835 | * sync it. |
841 | */ | 836 | */ |
842 | if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { | 837 | if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) { |
838 | int err; | ||
839 | |||
843 | mutex_lock(&inode->i_mutex); | 840 | mutex_lock(&inode->i_mutex); |
844 | err = generic_osync_inode(inode, mapping, | 841 | err = generic_osync_inode(inode, mapping, |
845 | OSYNC_METADATA|OSYNC_DATA); | 842 | OSYNC_METADATA|OSYNC_DATA); |
@@ -1075,7 +1072,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | |||
1075 | 1072 | ||
1076 | ret = splice_direct_to_actor(in, &sd, direct_splice_actor); | 1073 | ret = splice_direct_to_actor(in, &sd, direct_splice_actor); |
1077 | if (ret > 0) | 1074 | if (ret > 0) |
1078 | *ppos = sd.pos; | 1075 | *ppos += ret; |
1079 | 1076 | ||
1080 | return ret; | 1077 | return ret; |
1081 | } | 1078 | } |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index a1c3a1fab7f0..8c0e4b92574f 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -419,12 +419,8 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, | |||
419 | */ | 419 | */ |
420 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | 420 | int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) |
421 | { | 421 | { |
422 | if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) { | 422 | if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) |
423 | printk(KERN_WARNING "sysfs: duplicate filename '%s' " | ||
424 | "can not be created\n", sd->s_name); | ||
425 | WARN_ON(1); | ||
426 | return -EEXIST; | 423 | return -EEXIST; |
427 | } | ||
428 | 424 | ||
429 | sd->s_parent = sysfs_get(acxt->parent_sd); | 425 | sd->s_parent = sysfs_get(acxt->parent_sd); |
430 | 426 | ||
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 2b34c8ca6c83..d3231947db19 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/buffer_head.h> | 32 | #include <linux/buffer_head.h> |
33 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
34 | #include <linux/crc-itu-t.h> | 34 | #include <linux/crc-itu-t.h> |
35 | #include <linux/exportfs.h> | ||
35 | 36 | ||
36 | static inline int udf_match(int len1, const char *name1, int len2, | 37 | static inline int udf_match(int len1, const char *name1, int len2, |
37 | const char *name2) | 38 | const char *name2) |
@@ -158,6 +159,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, | |||
158 | sector_t offset; | 159 | sector_t offset; |
159 | struct extent_position epos = {}; | 160 | struct extent_position epos = {}; |
160 | struct udf_inode_info *dinfo = UDF_I(dir); | 161 | struct udf_inode_info *dinfo = UDF_I(dir); |
162 | int isdotdot = dentry->d_name.len == 2 && | ||
163 | dentry->d_name.name[0] == '.' && dentry->d_name.name[1] == '.'; | ||
161 | 164 | ||
162 | size = udf_ext0_offset(dir) + dir->i_size; | 165 | size = udf_ext0_offset(dir) + dir->i_size; |
163 | f_pos = udf_ext0_offset(dir); | 166 | f_pos = udf_ext0_offset(dir); |
@@ -225,6 +228,12 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, | |||
225 | continue; | 228 | continue; |
226 | } | 229 | } |
227 | 230 | ||
231 | if ((cfi->fileCharacteristics & FID_FILE_CHAR_PARENT) && | ||
232 | isdotdot) { | ||
233 | brelse(epos.bh); | ||
234 | return fi; | ||
235 | } | ||
236 | |||
228 | if (!lfi) | 237 | if (!lfi) |
229 | continue; | 238 | continue; |
230 | 239 | ||
@@ -286,9 +295,8 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
286 | } | 295 | } |
287 | } | 296 | } |
288 | unlock_kernel(); | 297 | unlock_kernel(); |
289 | d_add(dentry, inode); | ||
290 | 298 | ||
291 | return NULL; | 299 | return d_splice_alias(inode, dentry); |
292 | } | 300 | } |
293 | 301 | ||
294 | static struct fileIdentDesc *udf_add_entry(struct inode *dir, | 302 | static struct fileIdentDesc *udf_add_entry(struct inode *dir, |
@@ -307,7 +315,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
307 | uint16_t liu; | 315 | uint16_t liu; |
308 | int block; | 316 | int block; |
309 | kernel_lb_addr eloc; | 317 | kernel_lb_addr eloc; |
310 | uint32_t elen; | 318 | uint32_t elen = 0; |
311 | sector_t offset; | 319 | sector_t offset; |
312 | struct extent_position epos = {}; | 320 | struct extent_position epos = {}; |
313 | struct udf_inode_info *dinfo; | 321 | struct udf_inode_info *dinfo; |
@@ -398,7 +406,8 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, | |||
398 | } | 406 | } |
399 | 407 | ||
400 | add: | 408 | add: |
401 | if (dinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) { | 409 | /* Is there any extent whose size we need to round up? */ |
410 | if (dinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && elen) { | ||
402 | elen = (elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1); | 411 | elen = (elen + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1); |
403 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) | 412 | if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
404 | epos.offset -= sizeof(short_ad); | 413 | epos.offset -= sizeof(short_ad); |
@@ -1232,6 +1241,134 @@ end_rename: | |||
1232 | return retval; | 1241 | return retval; |
1233 | } | 1242 | } |
1234 | 1243 | ||
1244 | static struct dentry *udf_get_parent(struct dentry *child) | ||
1245 | { | ||
1246 | struct dentry *parent; | ||
1247 | struct inode *inode = NULL; | ||
1248 | struct dentry dotdot; | ||
1249 | struct fileIdentDesc cfi; | ||
1250 | struct udf_fileident_bh fibh; | ||
1251 | |||
1252 | dotdot.d_name.name = ".."; | ||
1253 | dotdot.d_name.len = 2; | ||
1254 | |||
1255 | lock_kernel(); | ||
1256 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) | ||
1257 | goto out_unlock; | ||
1258 | |||
1259 | if (fibh.sbh != fibh.ebh) | ||
1260 | brelse(fibh.ebh); | ||
1261 | brelse(fibh.sbh); | ||
1262 | |||
1263 | inode = udf_iget(child->d_inode->i_sb, | ||
1264 | lelb_to_cpu(cfi.icb.extLocation)); | ||
1265 | if (!inode) | ||
1266 | goto out_unlock; | ||
1267 | unlock_kernel(); | ||
1268 | |||
1269 | parent = d_alloc_anon(inode); | ||
1270 | if (!parent) { | ||
1271 | iput(inode); | ||
1272 | parent = ERR_PTR(-ENOMEM); | ||
1273 | } | ||
1274 | |||
1275 | return parent; | ||
1276 | out_unlock: | ||
1277 | unlock_kernel(); | ||
1278 | return ERR_PTR(-EACCES); | ||
1279 | } | ||
1280 | |||
1281 | |||
1282 | static struct dentry *udf_nfs_get_inode(struct super_block *sb, u32 block, | ||
1283 | u16 partref, __u32 generation) | ||
1284 | { | ||
1285 | struct inode *inode; | ||
1286 | struct dentry *result; | ||
1287 | kernel_lb_addr loc; | ||
1288 | |||
1289 | if (block == 0) | ||
1290 | return ERR_PTR(-ESTALE); | ||
1291 | |||
1292 | loc.logicalBlockNum = block; | ||
1293 | loc.partitionReferenceNum = partref; | ||
1294 | inode = udf_iget(sb, loc); | ||
1295 | |||
1296 | if (inode == NULL) | ||
1297 | return ERR_PTR(-ENOMEM); | ||
1298 | |||
1299 | if (generation && inode->i_generation != generation) { | ||
1300 | iput(inode); | ||
1301 | return ERR_PTR(-ESTALE); | ||
1302 | } | ||
1303 | result = d_alloc_anon(inode); | ||
1304 | if (!result) { | ||
1305 | iput(inode); | ||
1306 | return ERR_PTR(-ENOMEM); | ||
1307 | } | ||
1308 | return result; | ||
1309 | } | ||
1310 | |||
1311 | static struct dentry *udf_fh_to_dentry(struct super_block *sb, | ||
1312 | struct fid *fid, int fh_len, int fh_type) | ||
1313 | { | ||
1314 | if ((fh_len != 3 && fh_len != 5) || | ||
1315 | (fh_type != FILEID_UDF_WITH_PARENT && | ||
1316 | fh_type != FILEID_UDF_WITHOUT_PARENT)) | ||
1317 | return NULL; | ||
1318 | |||
1319 | return udf_nfs_get_inode(sb, fid->udf.block, fid->udf.partref, | ||
1320 | fid->udf.generation); | ||
1321 | } | ||
1322 | |||
1323 | static struct dentry *udf_fh_to_parent(struct super_block *sb, | ||
1324 | struct fid *fid, int fh_len, int fh_type) | ||
1325 | { | ||
1326 | if (fh_len != 5 || fh_type != FILEID_UDF_WITH_PARENT) | ||
1327 | return NULL; | ||
1328 | |||
1329 | return udf_nfs_get_inode(sb, fid->udf.parent_block, | ||
1330 | fid->udf.parent_partref, | ||
1331 | fid->udf.parent_generation); | ||
1332 | } | ||
1333 | static int udf_encode_fh(struct dentry *de, __u32 *fh, int *lenp, | ||
1334 | int connectable) | ||
1335 | { | ||
1336 | int len = *lenp; | ||
1337 | struct inode *inode = de->d_inode; | ||
1338 | kernel_lb_addr location = UDF_I(inode)->i_location; | ||
1339 | struct fid *fid = (struct fid *)fh; | ||
1340 | int type = FILEID_UDF_WITHOUT_PARENT; | ||
1341 | |||
1342 | if (len < 3 || (connectable && len < 5)) | ||
1343 | return 255; | ||
1344 | |||
1345 | *lenp = 3; | ||
1346 | fid->udf.block = location.logicalBlockNum; | ||
1347 | fid->udf.partref = location.partitionReferenceNum; | ||
1348 | fid->udf.generation = inode->i_generation; | ||
1349 | |||
1350 | if (connectable && !S_ISDIR(inode->i_mode)) { | ||
1351 | spin_lock(&de->d_lock); | ||
1352 | inode = de->d_parent->d_inode; | ||
1353 | location = UDF_I(inode)->i_location; | ||
1354 | fid->udf.parent_block = location.logicalBlockNum; | ||
1355 | fid->udf.parent_partref = location.partitionReferenceNum; | ||
1356 | fid->udf.parent_generation = inode->i_generation; | ||
1357 | spin_unlock(&de->d_lock); | ||
1358 | *lenp = 5; | ||
1359 | type = FILEID_UDF_WITH_PARENT; | ||
1360 | } | ||
1361 | |||
1362 | return type; | ||
1363 | } | ||
1364 | |||
1365 | const struct export_operations udf_export_ops = { | ||
1366 | .encode_fh = udf_encode_fh, | ||
1367 | .fh_to_dentry = udf_fh_to_dentry, | ||
1368 | .fh_to_parent = udf_fh_to_parent, | ||
1369 | .get_parent = udf_get_parent, | ||
1370 | }; | ||
1371 | |||
1235 | const struct inode_operations udf_dir_inode_operations = { | 1372 | const struct inode_operations udf_dir_inode_operations = { |
1236 | .lookup = udf_lookup, | 1373 | .lookup = udf_lookup, |
1237 | .create = udf_create, | 1374 | .create = udf_create, |
diff --git a/fs/udf/partition.c b/fs/udf/partition.c index 63610f026ae1..96dfd207c3d6 100644 --- a/fs/udf/partition.c +++ b/fs/udf/partition.c | |||
@@ -27,8 +27,8 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/buffer_head.h> | 28 | #include <linux/buffer_head.h> |
29 | 29 | ||
30 | inline uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, | 30 | uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, |
31 | uint16_t partition, uint32_t offset) | 31 | uint16_t partition, uint32_t offset) |
32 | { | 32 | { |
33 | struct udf_sb_info *sbi = UDF_SB(sb); | 33 | struct udf_sb_info *sbi = UDF_SB(sb); |
34 | struct udf_part_map *map; | 34 | struct udf_part_map *map; |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 9fb18a340fc1..7a5f69be6ac2 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -1933,6 +1933,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1933 | 1933 | ||
1934 | /* Fill in the rest of the superblock */ | 1934 | /* Fill in the rest of the superblock */ |
1935 | sb->s_op = &udf_sb_ops; | 1935 | sb->s_op = &udf_sb_ops; |
1936 | sb->s_export_op = &udf_export_ops; | ||
1936 | sb->dq_op = NULL; | 1937 | sb->dq_op = NULL; |
1937 | sb->s_dirt = 0; | 1938 | sb->s_dirt = 0; |
1938 | sb->s_magic = UDF_SUPER_MAGIC; | 1939 | sb->s_magic = UDF_SUPER_MAGIC; |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index f3f45d029277..8fa9c2d70911 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -73,6 +73,7 @@ struct task_struct; | |||
73 | struct buffer_head; | 73 | struct buffer_head; |
74 | struct super_block; | 74 | struct super_block; |
75 | 75 | ||
76 | extern const struct export_operations udf_export_ops; | ||
76 | extern const struct inode_operations udf_dir_inode_operations; | 77 | extern const struct inode_operations udf_dir_inode_operations; |
77 | extern const struct file_operations udf_dir_operations; | 78 | extern const struct file_operations udf_dir_operations; |
78 | extern const struct inode_operations udf_file_inode_operations; | 79 | extern const struct inode_operations udf_file_inode_operations; |
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h index 244a1aaa940e..11c035168ea6 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 */ |
109 | extern struct inode *ufs_iget(struct super_block *, unsigned long); | 109 | extern struct inode *ufs_iget(struct super_block *, unsigned long); |
110 | extern void ufs_put_inode (struct inode *); | ||
111 | extern int ufs_write_inode (struct inode *, int); | 110 | extern int ufs_write_inode (struct inode *, int); |
112 | extern int ufs_sync_inode (struct inode *); | 111 | extern int ufs_sync_inode (struct inode *); |
113 | extern void ufs_delete_inode (struct inode *); | 112 | extern void ufs_delete_inode (struct inode *); |