diff options
Diffstat (limited to 'fs')
71 files changed, 642 insertions, 459 deletions
diff --git a/fs/9p/error.c b/fs/9p/error.c index fee5d19179c5..834cb179e388 100644 --- a/fs/9p/error.c +++ b/fs/9p/error.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <linux/list.h> | 34 | #include <linux/list.h> |
35 | #include <linux/jhash.h> | 35 | #include <linux/jhash.h> |
36 | #include <linux/string.h> | ||
36 | 37 | ||
37 | #include "debug.h" | 38 | #include "debug.h" |
38 | #include "error.h" | 39 | #include "error.h" |
diff --git a/fs/9p/trans_sock.c b/fs/9p/trans_sock.c index 01e26f0013ac..a93c2bf94c33 100644 --- a/fs/9p/trans_sock.c +++ b/fs/9p/trans_sock.c | |||
@@ -269,8 +269,7 @@ static void v9fs_sock_close(struct v9fs_transport *trans) | |||
269 | dprintk(DEBUG_TRANS, "socket closed\n"); | 269 | dprintk(DEBUG_TRANS, "socket closed\n"); |
270 | } | 270 | } |
271 | 271 | ||
272 | if (ts) | 272 | kfree(ts); |
273 | kfree(ts); | ||
274 | 273 | ||
275 | trans->priv = NULL; | 274 | trans->priv = NULL; |
276 | } | 275 | } |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 82303f3bf76f..418c3743fdee 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -266,7 +266,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses, | |||
266 | 266 | ||
267 | v9ses->remotename = __getname(); | 267 | v9ses->remotename = __getname(); |
268 | if (!v9ses->remotename) { | 268 | if (!v9ses->remotename) { |
269 | putname(v9ses->name); | 269 | __putname(v9ses->name); |
270 | return -ENOMEM; | 270 | return -ENOMEM; |
271 | } | 271 | } |
272 | 272 | ||
@@ -411,8 +411,8 @@ void v9fs_session_close(struct v9fs_session_info *v9ses) | |||
411 | if (v9ses->transport) | 411 | if (v9ses->transport) |
412 | v9ses->transport->close(v9ses->transport); | 412 | v9ses->transport->close(v9ses->transport); |
413 | 413 | ||
414 | putname(v9ses->name); | 414 | __putname(v9ses->name); |
415 | putname(v9ses->remotename); | 415 | __putname(v9ses->remotename); |
416 | } | 416 | } |
417 | 417 | ||
418 | /** | 418 | /** |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 2b696ae6655a..be7288184fa9 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -1105,7 +1105,7 @@ static int v9fs_vfs_readlink(struct dentry *dentry, char __user * buffer, | |||
1105 | } | 1105 | } |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | putname(link); | 1108 | __putname(link); |
1109 | return retval; | 1109 | return retval; |
1110 | } | 1110 | } |
1111 | 1111 | ||
@@ -1129,7 +1129,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
1129 | len = v9fs_readlink(dentry, link, strlen(link)); | 1129 | len = v9fs_readlink(dentry, link, strlen(link)); |
1130 | 1130 | ||
1131 | if (len < 0) { | 1131 | if (len < 0) { |
1132 | putname(link); | 1132 | __putname(link); |
1133 | link = ERR_PTR(len); | 1133 | link = ERR_PTR(len); |
1134 | } else | 1134 | } else |
1135 | link[len] = 0; | 1135 | link[len] = 0; |
@@ -1152,7 +1152,7 @@ static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void | |||
1152 | 1152 | ||
1153 | dprintk(DEBUG_VFS, " %s %s\n", dentry->d_name.name, s); | 1153 | dprintk(DEBUG_VFS, " %s %s\n", dentry->d_name.name, s); |
1154 | if (!IS_ERR(s)) | 1154 | if (!IS_ERR(s)) |
1155 | putname(s); | 1155 | __putname(s); |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | /** | 1158 | /** |
@@ -1228,7 +1228,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, | |||
1228 | FreeMem: | 1228 | FreeMem: |
1229 | kfree(mistat); | 1229 | kfree(mistat); |
1230 | kfree(fcall); | 1230 | kfree(fcall); |
1231 | putname(symname); | 1231 | __putname(symname); |
1232 | return retval; | 1232 | return retval; |
1233 | } | 1233 | } |
1234 | 1234 | ||
@@ -1319,7 +1319,7 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | |||
1319 | FreeMem: | 1319 | FreeMem: |
1320 | kfree(mistat); | 1320 | kfree(mistat); |
1321 | kfree(fcall); | 1321 | kfree(fcall); |
1322 | putname(symname); | 1322 | __putname(symname); |
1323 | 1323 | ||
1324 | return retval; | 1324 | return retval; |
1325 | } | 1325 | } |
diff --git a/fs/Kconfig b/fs/Kconfig index 660a0c04d6b9..7d6ae369ce44 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -898,6 +898,7 @@ config AFFS_FS | |||
898 | config HFS_FS | 898 | config HFS_FS |
899 | tristate "Apple Macintosh file system support (EXPERIMENTAL)" | 899 | tristate "Apple Macintosh file system support (EXPERIMENTAL)" |
900 | depends on EXPERIMENTAL | 900 | depends on EXPERIMENTAL |
901 | select NLS | ||
901 | help | 902 | help |
902 | If you say Y here, you will be able to mount Macintosh-formatted | 903 | If you say Y here, you will be able to mount Macintosh-formatted |
903 | floppy disks and hard drive partitions with full read-write access. | 904 | floppy disks and hard drive partitions with full read-write access. |
diff --git a/fs/affs/file.c b/fs/affs/file.c index 6744924b6905..f72fb776ecdf 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -22,14 +22,13 @@ static int affs_grow_extcache(struct inode *inode, u32 lc_idx); | |||
22 | static struct buffer_head *affs_alloc_extblock(struct inode *inode, struct buffer_head *bh, u32 ext); | 22 | static struct buffer_head *affs_alloc_extblock(struct inode *inode, struct buffer_head *bh, u32 ext); |
23 | static inline struct buffer_head *affs_get_extblock(struct inode *inode, u32 ext); | 23 | static inline struct buffer_head *affs_get_extblock(struct inode *inode, u32 ext); |
24 | static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext); | 24 | static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext); |
25 | static ssize_t affs_file_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos); | ||
26 | static int affs_file_open(struct inode *inode, struct file *filp); | 25 | static int affs_file_open(struct inode *inode, struct file *filp); |
27 | static int affs_file_release(struct inode *inode, struct file *filp); | 26 | static int affs_file_release(struct inode *inode, struct file *filp); |
28 | 27 | ||
29 | struct file_operations affs_file_operations = { | 28 | struct file_operations affs_file_operations = { |
30 | .llseek = generic_file_llseek, | 29 | .llseek = generic_file_llseek, |
31 | .read = generic_file_read, | 30 | .read = generic_file_read, |
32 | .write = affs_file_write, | 31 | .write = generic_file_write, |
33 | .mmap = generic_file_mmap, | 32 | .mmap = generic_file_mmap, |
34 | .open = affs_file_open, | 33 | .open = affs_file_open, |
35 | .release = affs_file_release, | 34 | .release = affs_file_release, |
@@ -473,21 +472,6 @@ affs_getemptyblk_ino(struct inode *inode, int block) | |||
473 | return ERR_PTR(err); | 472 | return ERR_PTR(err); |
474 | } | 473 | } |
475 | 474 | ||
476 | static ssize_t | ||
477 | affs_file_write(struct file *file, const char __user *buf, | ||
478 | size_t count, loff_t *ppos) | ||
479 | { | ||
480 | ssize_t retval; | ||
481 | |||
482 | retval = generic_file_write (file, buf, count, ppos); | ||
483 | if (retval >0) { | ||
484 | struct inode *inode = file->f_dentry->d_inode; | ||
485 | inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; | ||
486 | mark_inode_dirty(inode); | ||
487 | } | ||
488 | return retval; | ||
489 | } | ||
490 | |||
491 | static int | 475 | static int |
492 | affs_do_readpage_ofs(struct file *file, struct page *page, unsigned from, unsigned to) | 476 | affs_do_readpage_ofs(struct file *file, struct page *page, unsigned from, unsigned to) |
493 | { | 477 | { |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 9c3080716c92..aaec015a16e4 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -35,8 +35,7 @@ affs_put_super(struct super_block *sb) | |||
35 | mark_buffer_dirty(sbi->s_root_bh); | 35 | mark_buffer_dirty(sbi->s_root_bh); |
36 | } | 36 | } |
37 | 37 | ||
38 | if (sbi->s_prefix) | 38 | kfree(sbi->s_prefix); |
39 | kfree(sbi->s_prefix); | ||
40 | affs_free_bitmap(sb); | 39 | affs_free_bitmap(sb); |
41 | affs_brelse(sbi->s_root_bh); | 40 | affs_brelse(sbi->s_root_bh); |
42 | kfree(sbi); | 41 | kfree(sbi); |
@@ -198,10 +197,9 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s | |||
198 | *mount_opts |= SF_MUFS; | 197 | *mount_opts |= SF_MUFS; |
199 | break; | 198 | break; |
200 | case Opt_prefix: | 199 | case Opt_prefix: |
201 | if (*prefix) { /* Free any previous prefix */ | 200 | /* Free any previous prefix */ |
202 | kfree(*prefix); | 201 | kfree(*prefix); |
203 | *prefix = NULL; | 202 | *prefix = NULL; |
204 | } | ||
205 | *prefix = match_strdup(&args[0]); | 203 | *prefix = match_strdup(&args[0]); |
206 | if (!*prefix) | 204 | if (!*prefix) |
207 | return 0; | 205 | return 0; |
@@ -462,11 +460,9 @@ got_root: | |||
462 | out_error: | 460 | out_error: |
463 | if (root_inode) | 461 | if (root_inode) |
464 | iput(root_inode); | 462 | iput(root_inode); |
465 | if (sbi->s_bitmap) | 463 | kfree(sbi->s_bitmap); |
466 | kfree(sbi->s_bitmap); | ||
467 | affs_brelse(root_bh); | 464 | affs_brelse(root_bh); |
468 | if (sbi->s_prefix) | 465 | kfree(sbi->s_prefix); |
469 | kfree(sbi->s_prefix); | ||
470 | kfree(sbi); | 466 | kfree(sbi); |
471 | sb->s_fs_info = NULL; | 467 | sb->s_fs_info = NULL; |
472 | return -EINVAL; | 468 | return -EINVAL; |
diff --git a/fs/afs/file.c b/fs/afs/file.c index 4975c9c193dd..150b19227922 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -31,24 +31,10 @@ static int afs_file_readpage(struct file *file, struct page *page); | |||
31 | static int afs_file_invalidatepage(struct page *page, unsigned long offset); | 31 | static int afs_file_invalidatepage(struct page *page, unsigned long offset); |
32 | static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); | 32 | static int afs_file_releasepage(struct page *page, gfp_t gfp_flags); |
33 | 33 | ||
34 | static ssize_t afs_file_write(struct file *file, const char __user *buf, | ||
35 | size_t size, loff_t *off); | ||
36 | |||
37 | struct inode_operations afs_file_inode_operations = { | 34 | struct inode_operations afs_file_inode_operations = { |
38 | .getattr = afs_inode_getattr, | 35 | .getattr = afs_inode_getattr, |
39 | }; | 36 | }; |
40 | 37 | ||
41 | struct file_operations afs_file_file_operations = { | ||
42 | .read = generic_file_read, | ||
43 | .write = afs_file_write, | ||
44 | .mmap = generic_file_mmap, | ||
45 | #if 0 | ||
46 | .open = afs_file_open, | ||
47 | .release = afs_file_release, | ||
48 | .fsync = afs_file_fsync, | ||
49 | #endif | ||
50 | }; | ||
51 | |||
52 | struct address_space_operations afs_fs_aops = { | 38 | struct address_space_operations afs_fs_aops = { |
53 | .readpage = afs_file_readpage, | 39 | .readpage = afs_file_readpage, |
54 | .sync_page = block_sync_page, | 40 | .sync_page = block_sync_page, |
@@ -59,22 +45,6 @@ struct address_space_operations afs_fs_aops = { | |||
59 | 45 | ||
60 | /*****************************************************************************/ | 46 | /*****************************************************************************/ |
61 | /* | 47 | /* |
62 | * AFS file write | ||
63 | */ | ||
64 | static ssize_t afs_file_write(struct file *file, const char __user *buf, | ||
65 | size_t size, loff_t *off) | ||
66 | { | ||
67 | struct afs_vnode *vnode; | ||
68 | |||
69 | vnode = AFS_FS_I(file->f_dentry->d_inode); | ||
70 | if (vnode->flags & AFS_VNODE_DELETED) | ||
71 | return -ESTALE; | ||
72 | |||
73 | return -EIO; | ||
74 | } /* end afs_file_write() */ | ||
75 | |||
76 | /*****************************************************************************/ | ||
77 | /* | ||
78 | * deal with notification that a page was read from the cache | 48 | * deal with notification that a page was read from the cache |
79 | */ | 49 | */ |
80 | #ifdef AFS_CACHING_SUPPORT | 50 | #ifdef AFS_CACHING_SUPPORT |
@@ -295,8 +265,7 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags) | |||
295 | set_page_private(page, 0); | 265 | set_page_private(page, 0); |
296 | ClearPagePrivate(page); | 266 | ClearPagePrivate(page); |
297 | 267 | ||
298 | if (pageio) | 268 | kfree(pageio); |
299 | kfree(pageio); | ||
300 | } | 269 | } |
301 | 270 | ||
302 | _leave(" = 0"); | 271 | _leave(" = 0"); |
diff --git a/fs/afs/inode.c b/fs/afs/inode.c index c476fde33fbc..4ebb30a50ed5 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c | |||
@@ -49,7 +49,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode) | |||
49 | case AFS_FTYPE_FILE: | 49 | case AFS_FTYPE_FILE: |
50 | inode->i_mode = S_IFREG | vnode->status.mode; | 50 | inode->i_mode = S_IFREG | vnode->status.mode; |
51 | inode->i_op = &afs_file_inode_operations; | 51 | inode->i_op = &afs_file_inode_operations; |
52 | inode->i_fop = &afs_file_file_operations; | 52 | inode->i_fop = &generic_ro_fops; |
53 | break; | 53 | break; |
54 | case AFS_FTYPE_DIR: | 54 | case AFS_FTYPE_DIR: |
55 | inode->i_mode = S_IFDIR | vnode->status.mode; | 55 | inode->i_mode = S_IFDIR | vnode->status.mode; |
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index f09860b45c1a..ab8f87c66319 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -71,7 +71,6 @@ extern struct file_operations afs_dir_file_operations; | |||
71 | */ | 71 | */ |
72 | extern struct address_space_operations afs_fs_aops; | 72 | extern struct address_space_operations afs_fs_aops; |
73 | extern struct inode_operations afs_file_inode_operations; | 73 | extern struct inode_operations afs_file_inode_operations; |
74 | extern struct file_operations afs_file_file_operations; | ||
75 | 74 | ||
76 | #ifdef AFS_CACHING_SUPPORT | 75 | #ifdef AFS_CACHING_SUPPORT |
77 | extern int afs_cache_get_page_cookie(struct page *page, | 76 | extern int afs_cache_get_page_cookie(struct page *page, |
@@ -42,8 +42,9 @@ | |||
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | /*------ sysctl variables----*/ | 44 | /*------ sysctl variables----*/ |
45 | atomic_t aio_nr = ATOMIC_INIT(0); /* current system wide number of aio requests */ | 45 | static DEFINE_SPINLOCK(aio_nr_lock); |
46 | unsigned aio_max_nr = 0x10000; /* system wide maximum number of aio requests */ | 46 | unsigned long aio_nr; /* current system wide number of aio requests */ |
47 | unsigned long aio_max_nr = 0x10000; /* system wide maximum number of aio requests */ | ||
47 | /*----end sysctl variables---*/ | 48 | /*----end sysctl variables---*/ |
48 | 49 | ||
49 | static kmem_cache_t *kiocb_cachep; | 50 | static kmem_cache_t *kiocb_cachep; |
@@ -208,7 +209,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
208 | return ERR_PTR(-EINVAL); | 209 | return ERR_PTR(-EINVAL); |
209 | } | 210 | } |
210 | 211 | ||
211 | if (nr_events > aio_max_nr) | 212 | if ((unsigned long)nr_events > aio_max_nr) |
212 | return ERR_PTR(-EAGAIN); | 213 | return ERR_PTR(-EAGAIN); |
213 | 214 | ||
214 | ctx = kmem_cache_alloc(kioctx_cachep, GFP_KERNEL); | 215 | ctx = kmem_cache_alloc(kioctx_cachep, GFP_KERNEL); |
@@ -233,8 +234,14 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
233 | goto out_freectx; | 234 | goto out_freectx; |
234 | 235 | ||
235 | /* limit the number of system wide aios */ | 236 | /* limit the number of system wide aios */ |
236 | atomic_add(ctx->max_reqs, &aio_nr); /* undone by __put_ioctx */ | 237 | spin_lock(&aio_nr_lock); |
237 | if (unlikely(atomic_read(&aio_nr) > aio_max_nr)) | 238 | if (aio_nr + ctx->max_reqs > aio_max_nr || |
239 | aio_nr + ctx->max_reqs < aio_nr) | ||
240 | ctx->max_reqs = 0; | ||
241 | else | ||
242 | aio_nr += ctx->max_reqs; | ||
243 | spin_unlock(&aio_nr_lock); | ||
244 | if (ctx->max_reqs == 0) | ||
238 | goto out_cleanup; | 245 | goto out_cleanup; |
239 | 246 | ||
240 | /* now link into global list. kludge. FIXME */ | 247 | /* now link into global list. kludge. FIXME */ |
@@ -248,8 +255,6 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
248 | return ctx; | 255 | return ctx; |
249 | 256 | ||
250 | out_cleanup: | 257 | out_cleanup: |
251 | atomic_sub(ctx->max_reqs, &aio_nr); | ||
252 | ctx->max_reqs = 0; /* prevent __put_ioctx from sub'ing aio_nr */ | ||
253 | __put_ioctx(ctx); | 258 | __put_ioctx(ctx); |
254 | return ERR_PTR(-EAGAIN); | 259 | return ERR_PTR(-EAGAIN); |
255 | 260 | ||
@@ -374,7 +379,12 @@ void fastcall __put_ioctx(struct kioctx *ctx) | |||
374 | pr_debug("__put_ioctx: freeing %p\n", ctx); | 379 | pr_debug("__put_ioctx: freeing %p\n", ctx); |
375 | kmem_cache_free(kioctx_cachep, ctx); | 380 | kmem_cache_free(kioctx_cachep, ctx); |
376 | 381 | ||
377 | atomic_sub(nr_events, &aio_nr); | 382 | if (nr_events) { |
383 | spin_lock(&aio_nr_lock); | ||
384 | BUG_ON(aio_nr - nr_events > aio_nr); | ||
385 | aio_nr -= nr_events; | ||
386 | spin_unlock(&aio_nr_lock); | ||
387 | } | ||
378 | } | 388 | } |
379 | 389 | ||
380 | /* aio_get_req | 390 | /* aio_get_req |
@@ -1258,8 +1268,9 @@ asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp) | |||
1258 | goto out; | 1268 | goto out; |
1259 | 1269 | ||
1260 | ret = -EINVAL; | 1270 | ret = -EINVAL; |
1261 | if (unlikely(ctx || (int)nr_events <= 0)) { | 1271 | if (unlikely(ctx || nr_events == 0)) { |
1262 | pr_debug("EINVAL: io_setup: ctx or nr_events > max\n"); | 1272 | pr_debug("EINVAL: io_setup: ctx %lu nr_events %u\n", |
1273 | ctx, nr_events); | ||
1263 | goto out; | 1274 | goto out; |
1264 | } | 1275 | } |
1265 | 1276 | ||
diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c index 1fcaa1568541..633f628005b4 100644 --- a/fs/autofs/waitq.c +++ b/fs/autofs/waitq.c | |||
@@ -150,10 +150,8 @@ int autofs_wait(struct autofs_sb_info *sbi, struct qstr *name) | |||
150 | if ( sbi->catatonic ) { | 150 | if ( sbi->catatonic ) { |
151 | /* We might have slept, so check again for catatonic mode */ | 151 | /* We might have slept, so check again for catatonic mode */ |
152 | wq->status = -ENOENT; | 152 | wq->status = -ENOENT; |
153 | if ( wq->name ) { | 153 | kfree(wq->name); |
154 | kfree(wq->name); | 154 | wq->name = NULL; |
155 | wq->name = NULL; | ||
156 | } | ||
157 | } | 155 | } |
158 | 156 | ||
159 | if ( wq->name ) { | 157 | if ( wq->name ) { |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 0a3c05d10167..818b37be5153 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -22,10 +22,8 @@ | |||
22 | 22 | ||
23 | static void ino_lnkfree(struct autofs_info *ino) | 23 | static void ino_lnkfree(struct autofs_info *ino) |
24 | { | 24 | { |
25 | if (ino->u.symlink) { | 25 | kfree(ino->u.symlink); |
26 | kfree(ino->u.symlink); | 26 | ino->u.symlink = NULL; |
27 | ino->u.symlink = NULL; | ||
28 | } | ||
29 | } | 27 | } |
30 | 28 | ||
31 | struct autofs_info *autofs4_init_ino(struct autofs_info *ino, | 29 | struct autofs_info *autofs4_init_ino(struct autofs_info *ino, |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 3df86285a1c7..394ff36ef8f1 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -243,10 +243,8 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
243 | if ( sbi->catatonic ) { | 243 | if ( sbi->catatonic ) { |
244 | /* We might have slept, so check again for catatonic mode */ | 244 | /* We might have slept, so check again for catatonic mode */ |
245 | wq->status = -ENOENT; | 245 | wq->status = -ENOENT; |
246 | if ( wq->name ) { | 246 | kfree(wq->name); |
247 | kfree(wq->name); | 247 | wq->name = NULL; |
248 | wq->name = NULL; | ||
249 | } | ||
250 | } | 248 | } |
251 | 249 | ||
252 | if ( wq->name ) { | 250 | if ( wq->name ) { |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index e0a6025f1d06..2d365cb8eec6 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -73,12 +73,6 @@ static struct inode_operations befs_dir_inode_operations = { | |||
73 | .lookup = befs_lookup, | 73 | .lookup = befs_lookup, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static struct file_operations befs_file_operations = { | ||
77 | .llseek = default_llseek, | ||
78 | .read = generic_file_read, | ||
79 | .mmap = generic_file_readonly_mmap, | ||
80 | }; | ||
81 | |||
82 | static struct address_space_operations befs_aops = { | 76 | static struct address_space_operations befs_aops = { |
83 | .readpage = befs_readpage, | 77 | .readpage = befs_readpage, |
84 | .sync_page = block_sync_page, | 78 | .sync_page = block_sync_page, |
@@ -398,7 +392,7 @@ befs_read_inode(struct inode *inode) | |||
398 | inode->i_mapping->a_ops = &befs_aops; | 392 | inode->i_mapping->a_ops = &befs_aops; |
399 | 393 | ||
400 | if (S_ISREG(inode->i_mode)) { | 394 | if (S_ISREG(inode->i_mode)) { |
401 | inode->i_fop = &befs_file_operations; | 395 | inode->i_fop = &generic_ro_fops; |
402 | } else if (S_ISDIR(inode->i_mode)) { | 396 | } else if (S_ISDIR(inode->i_mode)) { |
403 | inode->i_op = &befs_dir_inode_operations; | 397 | inode->i_op = &befs_dir_inode_operations; |
404 | inode->i_fop = &befs_dir_operations; | 398 | inode->i_fop = &befs_dir_operations; |
@@ -731,20 +725,16 @@ parse_options(char *options, befs_mount_options * opts) | |||
731 | static void | 725 | static void |
732 | befs_put_super(struct super_block *sb) | 726 | befs_put_super(struct super_block *sb) |
733 | { | 727 | { |
734 | if (BEFS_SB(sb)->mount_opts.iocharset) { | 728 | kfree(BEFS_SB(sb)->mount_opts.iocharset); |
735 | kfree(BEFS_SB(sb)->mount_opts.iocharset); | 729 | BEFS_SB(sb)->mount_opts.iocharset = NULL; |
736 | BEFS_SB(sb)->mount_opts.iocharset = NULL; | ||
737 | } | ||
738 | 730 | ||
739 | if (BEFS_SB(sb)->nls) { | 731 | if (BEFS_SB(sb)->nls) { |
740 | unload_nls(BEFS_SB(sb)->nls); | 732 | unload_nls(BEFS_SB(sb)->nls); |
741 | BEFS_SB(sb)->nls = NULL; | 733 | BEFS_SB(sb)->nls = NULL; |
742 | } | 734 | } |
743 | 735 | ||
744 | if (sb->s_fs_info) { | 736 | kfree(sb->s_fs_info); |
745 | kfree(sb->s_fs_info); | 737 | sb->s_fs_info = NULL; |
746 | sb->s_fs_info = NULL; | ||
747 | } | ||
748 | return; | 738 | return; |
749 | } | 739 | } |
750 | 740 | ||
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 6fa6adc40972..f36f2210204f 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1006,8 +1006,7 @@ out_free_dentry: | |||
1006 | if (interpreter) | 1006 | if (interpreter) |
1007 | fput(interpreter); | 1007 | fput(interpreter); |
1008 | out_free_interp: | 1008 | out_free_interp: |
1009 | if (elf_interpreter) | 1009 | kfree(elf_interpreter); |
1010 | kfree(elf_interpreter); | ||
1011 | out_free_file: | 1010 | out_free_file: |
1012 | sys_close(elf_exec_fileno); | 1011 | sys_close(elf_exec_fileno); |
1013 | out_free_fh: | 1012 | out_free_fh: |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index dda87c4c82a3..e0344f69c79d 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -411,16 +411,11 @@ error: | |||
411 | allow_write_access(interpreter); | 411 | allow_write_access(interpreter); |
412 | fput(interpreter); | 412 | fput(interpreter); |
413 | } | 413 | } |
414 | if (interpreter_name) | 414 | kfree(interpreter_name); |
415 | kfree(interpreter_name); | 415 | kfree(exec_params.phdrs); |
416 | if (exec_params.phdrs) | 416 | kfree(exec_params.loadmap); |
417 | kfree(exec_params.phdrs); | 417 | kfree(interp_params.phdrs); |
418 | if (exec_params.loadmap) | 418 | kfree(interp_params.loadmap); |
419 | kfree(exec_params.loadmap); | ||
420 | if (interp_params.phdrs) | ||
421 | kfree(interp_params.phdrs); | ||
422 | if (interp_params.loadmap) | ||
423 | kfree(interp_params.loadmap); | ||
424 | return retval; | 419 | return retval; |
425 | 420 | ||
426 | /* unrecoverable error - kill the process */ | 421 | /* unrecoverable error - kill the process */ |
diff --git a/fs/buffer.c b/fs/buffer.c index 35fa34977e81..5287be18633b 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -396,7 +396,7 @@ asmlinkage long sys_fdatasync(unsigned int fd) | |||
396 | * private_lock is contended then so is mapping->tree_lock). | 396 | * private_lock is contended then so is mapping->tree_lock). |
397 | */ | 397 | */ |
398 | static struct buffer_head * | 398 | static struct buffer_head * |
399 | __find_get_block_slow(struct block_device *bdev, sector_t block, int unused) | 399 | __find_get_block_slow(struct block_device *bdev, sector_t block) |
400 | { | 400 | { |
401 | struct inode *bd_inode = bdev->bd_inode; | 401 | struct inode *bd_inode = bdev->bd_inode; |
402 | struct address_space *bd_mapping = bd_inode->i_mapping; | 402 | struct address_space *bd_mapping = bd_inode->i_mapping; |
@@ -1438,7 +1438,7 @@ __find_get_block(struct block_device *bdev, sector_t block, int size) | |||
1438 | struct buffer_head *bh = lookup_bh_lru(bdev, block, size); | 1438 | struct buffer_head *bh = lookup_bh_lru(bdev, block, size); |
1439 | 1439 | ||
1440 | if (bh == NULL) { | 1440 | if (bh == NULL) { |
1441 | bh = __find_get_block_slow(bdev, block, size); | 1441 | bh = __find_get_block_slow(bdev, block); |
1442 | if (bh) | 1442 | if (bh) |
1443 | bh_lru_install(bh); | 1443 | bh_lru_install(bh); |
1444 | } | 1444 | } |
@@ -1705,7 +1705,7 @@ void unmap_underlying_metadata(struct block_device *bdev, sector_t block) | |||
1705 | 1705 | ||
1706 | might_sleep(); | 1706 | might_sleep(); |
1707 | 1707 | ||
1708 | old_bh = __find_get_block_slow(bdev, block, 0); | 1708 | old_bh = __find_get_block_slow(bdev, block); |
1709 | if (old_bh) { | 1709 | if (old_bh) { |
1710 | clear_buffer_dirty(old_bh); | 1710 | clear_buffer_dirty(old_bh); |
1711 | wait_on_buffer(old_bh); | 1711 | wait_on_buffer(old_bh); |
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index 98539e2afe81..086ae8f4a207 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -553,8 +553,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
553 | *(oid + 3))); | 553 | *(oid + 3))); |
554 | rc = compare_oid(oid, oidlen, NTLMSSP_OID, | 554 | rc = compare_oid(oid, oidlen, NTLMSSP_OID, |
555 | NTLMSSP_OID_LEN); | 555 | NTLMSSP_OID_LEN); |
556 | if(oid) | 556 | kfree(oid); |
557 | kfree(oid); | ||
558 | if (rc) | 557 | if (rc) |
559 | use_ntlmssp = TRUE; | 558 | use_ntlmssp = TRUE; |
560 | } | 559 | } |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d74367a08d51..450ab75d6546 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1265,8 +1265,7 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo, | |||
1265 | the helper that resolves tcp names, mount to it, try to | 1265 | the helper that resolves tcp names, mount to it, try to |
1266 | tcon to it unmount it if fail */ | 1266 | tcon to it unmount it if fail */ |
1267 | 1267 | ||
1268 | if(referrals) | 1268 | kfree(referrals); |
1269 | kfree(referrals); | ||
1270 | 1269 | ||
1271 | return rc; | 1270 | return rc; |
1272 | } | 1271 | } |
@@ -1535,10 +1534,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1535 | 1534 | ||
1536 | memset(&volume_info,0,sizeof(struct smb_vol)); | 1535 | memset(&volume_info,0,sizeof(struct smb_vol)); |
1537 | if (cifs_parse_mount_options(mount_data, devname, &volume_info)) { | 1536 | if (cifs_parse_mount_options(mount_data, devname, &volume_info)) { |
1538 | if(volume_info.UNC) | 1537 | kfree(volume_info.UNC); |
1539 | kfree(volume_info.UNC); | 1538 | kfree(volume_info.password); |
1540 | if(volume_info.password) | ||
1541 | kfree(volume_info.password); | ||
1542 | FreeXid(xid); | 1539 | FreeXid(xid); |
1543 | return -EINVAL; | 1540 | return -EINVAL; |
1544 | } | 1541 | } |
@@ -1551,10 +1548,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1551 | cifserror("No username specified "); | 1548 | cifserror("No username specified "); |
1552 | /* In userspace mount helper we can get user name from alternate | 1549 | /* In userspace mount helper we can get user name from alternate |
1553 | locations such as env variables and files on disk */ | 1550 | locations such as env variables and files on disk */ |
1554 | if(volume_info.UNC) | 1551 | kfree(volume_info.UNC); |
1555 | kfree(volume_info.UNC); | 1552 | kfree(volume_info.password); |
1556 | if(volume_info.password) | ||
1557 | kfree(volume_info.password); | ||
1558 | FreeXid(xid); | 1553 | FreeXid(xid); |
1559 | return -EINVAL; | 1554 | return -EINVAL; |
1560 | } | 1555 | } |
@@ -1573,10 +1568,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1573 | 1568 | ||
1574 | if(rc <= 0) { | 1569 | if(rc <= 0) { |
1575 | /* we failed translating address */ | 1570 | /* we failed translating address */ |
1576 | if(volume_info.UNC) | 1571 | kfree(volume_info.UNC); |
1577 | kfree(volume_info.UNC); | 1572 | kfree(volume_info.password); |
1578 | if(volume_info.password) | ||
1579 | kfree(volume_info.password); | ||
1580 | FreeXid(xid); | 1573 | FreeXid(xid); |
1581 | return -EINVAL; | 1574 | return -EINVAL; |
1582 | } | 1575 | } |
@@ -1587,19 +1580,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1587 | } else if (volume_info.UNCip){ | 1580 | } else if (volume_info.UNCip){ |
1588 | /* BB using ip addr as server name connect to the DFS root below */ | 1581 | /* BB using ip addr as server name connect to the DFS root below */ |
1589 | cERROR(1,("Connecting to DFS root not implemented yet")); | 1582 | cERROR(1,("Connecting to DFS root not implemented yet")); |
1590 | if(volume_info.UNC) | 1583 | kfree(volume_info.UNC); |
1591 | kfree(volume_info.UNC); | 1584 | kfree(volume_info.password); |
1592 | if(volume_info.password) | ||
1593 | kfree(volume_info.password); | ||
1594 | FreeXid(xid); | 1585 | FreeXid(xid); |
1595 | return -EINVAL; | 1586 | return -EINVAL; |
1596 | } else /* which servers DFS root would we conect to */ { | 1587 | } else /* which servers DFS root would we conect to */ { |
1597 | cERROR(1, | 1588 | cERROR(1, |
1598 | ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified ")); | 1589 | ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified ")); |
1599 | if(volume_info.UNC) | 1590 | kfree(volume_info.UNC); |
1600 | kfree(volume_info.UNC); | 1591 | kfree(volume_info.password); |
1601 | if(volume_info.password) | ||
1602 | kfree(volume_info.password); | ||
1603 | FreeXid(xid); | 1592 | FreeXid(xid); |
1604 | return -EINVAL; | 1593 | return -EINVAL; |
1605 | } | 1594 | } |
@@ -1612,10 +1601,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1612 | cifs_sb->local_nls = load_nls(volume_info.iocharset); | 1601 | cifs_sb->local_nls = load_nls(volume_info.iocharset); |
1613 | if(cifs_sb->local_nls == NULL) { | 1602 | if(cifs_sb->local_nls == NULL) { |
1614 | cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset)); | 1603 | cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset)); |
1615 | if(volume_info.UNC) | 1604 | kfree(volume_info.UNC); |
1616 | kfree(volume_info.UNC); | 1605 | kfree(volume_info.password); |
1617 | if(volume_info.password) | ||
1618 | kfree(volume_info.password); | ||
1619 | FreeXid(xid); | 1606 | FreeXid(xid); |
1620 | return -ELIBACC; | 1607 | return -ELIBACC; |
1621 | } | 1608 | } |
@@ -1630,10 +1617,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1630 | &sin_server6.sin6_addr, | 1617 | &sin_server6.sin6_addr, |
1631 | volume_info.username, &srvTcp); | 1618 | volume_info.username, &srvTcp); |
1632 | else { | 1619 | else { |
1633 | if(volume_info.UNC) | 1620 | kfree(volume_info.UNC); |
1634 | kfree(volume_info.UNC); | 1621 | kfree(volume_info.password); |
1635 | if(volume_info.password) | ||
1636 | kfree(volume_info.password); | ||
1637 | FreeXid(xid); | 1622 | FreeXid(xid); |
1638 | return -EINVAL; | 1623 | return -EINVAL; |
1639 | } | 1624 | } |
@@ -1654,10 +1639,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1654 | ("Error connecting to IPv4 socket. Aborting operation")); | 1639 | ("Error connecting to IPv4 socket. Aborting operation")); |
1655 | if(csocket != NULL) | 1640 | if(csocket != NULL) |
1656 | sock_release(csocket); | 1641 | sock_release(csocket); |
1657 | if(volume_info.UNC) | 1642 | kfree(volume_info.UNC); |
1658 | kfree(volume_info.UNC); | 1643 | kfree(volume_info.password); |
1659 | if(volume_info.password) | ||
1660 | kfree(volume_info.password); | ||
1661 | FreeXid(xid); | 1644 | FreeXid(xid); |
1662 | return rc; | 1645 | return rc; |
1663 | } | 1646 | } |
@@ -1666,10 +1649,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1666 | if (srvTcp == NULL) { | 1649 | if (srvTcp == NULL) { |
1667 | rc = -ENOMEM; | 1650 | rc = -ENOMEM; |
1668 | sock_release(csocket); | 1651 | sock_release(csocket); |
1669 | if(volume_info.UNC) | 1652 | kfree(volume_info.UNC); |
1670 | kfree(volume_info.UNC); | 1653 | kfree(volume_info.password); |
1671 | if(volume_info.password) | ||
1672 | kfree(volume_info.password); | ||
1673 | FreeXid(xid); | 1654 | FreeXid(xid); |
1674 | return rc; | 1655 | return rc; |
1675 | } else { | 1656 | } else { |
@@ -1692,10 +1673,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1692 | if(rc < 0) { | 1673 | if(rc < 0) { |
1693 | rc = -ENOMEM; | 1674 | rc = -ENOMEM; |
1694 | sock_release(csocket); | 1675 | sock_release(csocket); |
1695 | if(volume_info.UNC) | 1676 | kfree(volume_info.UNC); |
1696 | kfree(volume_info.UNC); | 1677 | kfree(volume_info.password); |
1697 | if(volume_info.password) | ||
1698 | kfree(volume_info.password); | ||
1699 | FreeXid(xid); | 1678 | FreeXid(xid); |
1700 | return rc; | 1679 | return rc; |
1701 | } | 1680 | } |
@@ -1710,8 +1689,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1710 | if (existingCifsSes) { | 1689 | if (existingCifsSes) { |
1711 | pSesInfo = existingCifsSes; | 1690 | pSesInfo = existingCifsSes; |
1712 | cFYI(1, ("Existing smb sess found ")); | 1691 | cFYI(1, ("Existing smb sess found ")); |
1713 | if(volume_info.password) | 1692 | kfree(volume_info.password); |
1714 | kfree(volume_info.password); | ||
1715 | /* volume_info.UNC freed at end of function */ | 1693 | /* volume_info.UNC freed at end of function */ |
1716 | } else if (!rc) { | 1694 | } else if (!rc) { |
1717 | cFYI(1, ("Existing smb sess not found ")); | 1695 | cFYI(1, ("Existing smb sess not found ")); |
@@ -1741,8 +1719,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1741 | if(!rc) | 1719 | if(!rc) |
1742 | atomic_inc(&srvTcp->socketUseCount); | 1720 | atomic_inc(&srvTcp->socketUseCount); |
1743 | } else | 1721 | } else |
1744 | if(volume_info.password) | 1722 | kfree(volume_info.password); |
1745 | kfree(volume_info.password); | ||
1746 | } | 1723 | } |
1747 | 1724 | ||
1748 | /* search for existing tcon to this server share */ | 1725 | /* search for existing tcon to this server share */ |
@@ -1821,8 +1798,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1821 | "", cifs_sb->local_nls, | 1798 | "", cifs_sb->local_nls, |
1822 | cifs_sb->mnt_cifs_flags & | 1799 | cifs_sb->mnt_cifs_flags & |
1823 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1800 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1824 | if(volume_info.UNC) | 1801 | kfree(volume_info.UNC); |
1825 | kfree(volume_info.UNC); | ||
1826 | FreeXid(xid); | 1802 | FreeXid(xid); |
1827 | return -ENODEV; | 1803 | return -ENODEV; |
1828 | } else { | 1804 | } else { |
@@ -1925,8 +1901,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1925 | (in which case it is not needed anymore) but when new sesion is created | 1901 | (in which case it is not needed anymore) but when new sesion is created |
1926 | the password ptr is put in the new session structure (in which case the | 1902 | the password ptr is put in the new session structure (in which case the |
1927 | password will be freed at unmount time) */ | 1903 | password will be freed at unmount time) */ |
1928 | if(volume_info.UNC) | 1904 | kfree(volume_info.UNC); |
1929 | kfree(volume_info.UNC); | ||
1930 | FreeXid(xid); | 1905 | FreeXid(xid); |
1931 | return rc; | 1906 | return rc; |
1932 | } | 1907 | } |
@@ -3283,8 +3258,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3283 | if ((bcc_ptr + (2 * length)) - | 3258 | if ((bcc_ptr + (2 * length)) - |
3284 | pByteArea(smb_buffer_response) <= | 3259 | pByteArea(smb_buffer_response) <= |
3285 | BCC(smb_buffer_response)) { | 3260 | BCC(smb_buffer_response)) { |
3286 | if(tcon->nativeFileSystem) | 3261 | kfree(tcon->nativeFileSystem); |
3287 | kfree(tcon->nativeFileSystem); | ||
3288 | tcon->nativeFileSystem = | 3262 | tcon->nativeFileSystem = |
3289 | kzalloc(length + 2, GFP_KERNEL); | 3263 | kzalloc(length + 2, GFP_KERNEL); |
3290 | cifs_strfromUCS_le(tcon->nativeFileSystem, | 3264 | cifs_strfromUCS_le(tcon->nativeFileSystem, |
@@ -3301,8 +3275,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3301 | if ((bcc_ptr + length) - | 3275 | if ((bcc_ptr + length) - |
3302 | pByteArea(smb_buffer_response) <= | 3276 | pByteArea(smb_buffer_response) <= |
3303 | BCC(smb_buffer_response)) { | 3277 | BCC(smb_buffer_response)) { |
3304 | if(tcon->nativeFileSystem) | 3278 | kfree(tcon->nativeFileSystem); |
3305 | kfree(tcon->nativeFileSystem); | ||
3306 | tcon->nativeFileSystem = | 3279 | tcon->nativeFileSystem = |
3307 | kzalloc(length + 1, GFP_KERNEL); | 3280 | kzalloc(length + 1, GFP_KERNEL); |
3308 | strncpy(tcon->nativeFileSystem, bcc_ptr, | 3281 | strncpy(tcon->nativeFileSystem, bcc_ptr, |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index b43e071fe110..0f99aae33162 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -84,10 +84,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, | |||
84 | cifsInode->time = 0; /* will force revalidate to go get info when needed */ | 84 | cifsInode->time = 0; /* will force revalidate to go get info when needed */ |
85 | 85 | ||
86 | cifs_hl_exit: | 86 | cifs_hl_exit: |
87 | if (fromName) | 87 | kfree(fromName); |
88 | kfree(fromName); | 88 | kfree(toName); |
89 | if (toName) | ||
90 | kfree(toName); | ||
91 | FreeXid(xid); | 89 | FreeXid(xid); |
92 | return rc; | 90 | return rc; |
93 | } | 91 | } |
@@ -206,8 +204,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) | |||
206 | } | 204 | } |
207 | } | 205 | } |
208 | 206 | ||
209 | if (full_path) | 207 | kfree(full_path); |
210 | kfree(full_path); | ||
211 | FreeXid(xid); | 208 | FreeXid(xid); |
212 | return rc; | 209 | return rc; |
213 | } | 210 | } |
@@ -253,8 +250,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) | |||
253 | len = buflen; | 250 | len = buflen; |
254 | tmpbuffer = kmalloc(len,GFP_KERNEL); | 251 | tmpbuffer = kmalloc(len,GFP_KERNEL); |
255 | if(tmpbuffer == NULL) { | 252 | if(tmpbuffer == NULL) { |
256 | if (full_path) | 253 | kfree(full_path); |
257 | kfree(full_path); | ||
258 | FreeXid(xid); | 254 | FreeXid(xid); |
259 | return -ENOMEM; | 255 | return -ENOMEM; |
260 | } | 256 | } |
@@ -303,8 +299,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) | |||
303 | strncpy(tmpbuffer, referrals, len-1); | 299 | strncpy(tmpbuffer, referrals, len-1); |
304 | } | 300 | } |
305 | } | 301 | } |
306 | if(referrals) | 302 | kfree(referrals); |
307 | kfree(referrals); | ||
308 | kfree(tmp_path); | 303 | kfree(tmp_path); |
309 | } | 304 | } |
310 | /* BB add code like else decode referrals then memcpy to | 305 | /* BB add code like else decode referrals then memcpy to |
@@ -323,12 +318,8 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) | |||
323 | rc)); | 318 | rc)); |
324 | } | 319 | } |
325 | 320 | ||
326 | if (tmpbuffer) { | 321 | kfree(tmpbuffer); |
327 | kfree(tmpbuffer); | 322 | kfree(full_path); |
328 | } | ||
329 | if (full_path) { | ||
330 | kfree(full_path); | ||
331 | } | ||
332 | FreeXid(xid); | 323 | FreeXid(xid); |
333 | return rc; | 324 | return rc; |
334 | } | 325 | } |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index eba1de917f2a..34a06692e4fa 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -98,14 +98,10 @@ sesInfoFree(struct cifsSesInfo *buf_to_free) | |||
98 | atomic_dec(&sesInfoAllocCount); | 98 | atomic_dec(&sesInfoAllocCount); |
99 | list_del(&buf_to_free->cifsSessionList); | 99 | list_del(&buf_to_free->cifsSessionList); |
100 | write_unlock(&GlobalSMBSeslock); | 100 | write_unlock(&GlobalSMBSeslock); |
101 | if (buf_to_free->serverOS) | 101 | kfree(buf_to_free->serverOS); |
102 | kfree(buf_to_free->serverOS); | 102 | kfree(buf_to_free->serverDomain); |
103 | if (buf_to_free->serverDomain) | 103 | kfree(buf_to_free->serverNOS); |
104 | kfree(buf_to_free->serverDomain); | 104 | kfree(buf_to_free->password); |
105 | if (buf_to_free->serverNOS) | ||
106 | kfree(buf_to_free->serverNOS); | ||
107 | if (buf_to_free->password) | ||
108 | kfree(buf_to_free->password); | ||
109 | kfree(buf_to_free); | 105 | kfree(buf_to_free); |
110 | } | 106 | } |
111 | 107 | ||
@@ -144,8 +140,7 @@ tconInfoFree(struct cifsTconInfo *buf_to_free) | |||
144 | atomic_dec(&tconInfoAllocCount); | 140 | atomic_dec(&tconInfoAllocCount); |
145 | list_del(&buf_to_free->cifsConnectionList); | 141 | list_del(&buf_to_free->cifsConnectionList); |
146 | write_unlock(&GlobalSMBSeslock); | 142 | write_unlock(&GlobalSMBSeslock); |
147 | if (buf_to_free->nativeFileSystem) | 143 | kfree(buf_to_free->nativeFileSystem); |
148 | kfree(buf_to_free->nativeFileSystem); | ||
149 | kfree(buf_to_free); | 144 | kfree(buf_to_free); |
150 | } | 145 | } |
151 | 146 | ||
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index c1e02eff1d25..f375f87c7dbd 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -87,8 +87,7 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name) | |||
87 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 87 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
88 | } | 88 | } |
89 | remove_ea_exit: | 89 | remove_ea_exit: |
90 | if (full_path) | 90 | kfree(full_path); |
91 | kfree(full_path); | ||
92 | FreeXid(xid); | 91 | FreeXid(xid); |
93 | #endif | 92 | #endif |
94 | return rc; | 93 | return rc; |
@@ -132,8 +131,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name, | |||
132 | returns as xattrs */ | 131 | returns as xattrs */ |
133 | if(value_size > MAX_EA_VALUE_SIZE) { | 132 | if(value_size > MAX_EA_VALUE_SIZE) { |
134 | cFYI(1,("size of EA value too large")); | 133 | cFYI(1,("size of EA value too large")); |
135 | if(full_path) | 134 | kfree(full_path); |
136 | kfree(full_path); | ||
137 | FreeXid(xid); | 135 | FreeXid(xid); |
138 | return -EOPNOTSUPP; | 136 | return -EOPNOTSUPP; |
139 | } | 137 | } |
@@ -195,8 +193,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name, | |||
195 | } | 193 | } |
196 | 194 | ||
197 | set_ea_exit: | 195 | set_ea_exit: |
198 | if (full_path) | 196 | kfree(full_path); |
199 | kfree(full_path); | ||
200 | FreeXid(xid); | 197 | FreeXid(xid); |
201 | #endif | 198 | #endif |
202 | return rc; | 199 | return rc; |
@@ -298,8 +295,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name, | |||
298 | rc = -EOPNOTSUPP; | 295 | rc = -EOPNOTSUPP; |
299 | 296 | ||
300 | get_ea_exit: | 297 | get_ea_exit: |
301 | if (full_path) | 298 | kfree(full_path); |
302 | kfree(full_path); | ||
303 | FreeXid(xid); | 299 | FreeXid(xid); |
304 | #endif | 300 | #endif |
305 | return rc; | 301 | return rc; |
@@ -345,8 +341,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size) | |||
345 | cifs_sb->mnt_cifs_flags & | 341 | cifs_sb->mnt_cifs_flags & |
346 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 342 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
347 | 343 | ||
348 | if (full_path) | 344 | kfree(full_path); |
349 | kfree(full_path); | ||
350 | FreeXid(xid); | 345 | FreeXid(xid); |
351 | #endif | 346 | #endif |
352 | return rc; | 347 | return rc; |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 43dbcb0b21eb..4909754ea84a 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -2235,7 +2235,8 @@ static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
2235 | if (err) | 2235 | if (err) |
2236 | err = -EFAULT; | 2236 | err = -EFAULT; |
2237 | 2237 | ||
2238 | out: if (karg) kfree(karg); | 2238 | out: |
2239 | kfree(karg); | ||
2239 | return err; | 2240 | return err; |
2240 | } | 2241 | } |
2241 | 2242 | ||
diff --git a/fs/dcache.c b/fs/dcache.c index e90512ed35a4..17e439138681 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -644,7 +644,7 @@ void shrink_dcache_parent(struct dentry * parent) | |||
644 | * | 644 | * |
645 | * Prune the dentries that are anonymous | 645 | * Prune the dentries that are anonymous |
646 | * | 646 | * |
647 | * parsing d_hash list does not hlist_for_each_rcu() as it | 647 | * parsing d_hash list does not hlist_for_each_entry_rcu() as it |
648 | * done under dcache_lock. | 648 | * done under dcache_lock. |
649 | * | 649 | * |
650 | */ | 650 | */ |
@@ -1043,15 +1043,13 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name) | |||
1043 | struct hlist_head *head = d_hash(parent,hash); | 1043 | struct hlist_head *head = d_hash(parent,hash); |
1044 | struct dentry *found = NULL; | 1044 | struct dentry *found = NULL; |
1045 | struct hlist_node *node; | 1045 | struct hlist_node *node; |
1046 | struct dentry *dentry; | ||
1046 | 1047 | ||
1047 | rcu_read_lock(); | 1048 | rcu_read_lock(); |
1048 | 1049 | ||
1049 | hlist_for_each_rcu(node, head) { | 1050 | hlist_for_each_entry_rcu(dentry, node, head, d_hash) { |
1050 | struct dentry *dentry; | ||
1051 | struct qstr *qstr; | 1051 | struct qstr *qstr; |
1052 | 1052 | ||
1053 | dentry = hlist_entry(node, struct dentry, d_hash); | ||
1054 | |||
1055 | if (dentry->d_name.hash != hash) | 1053 | if (dentry->d_name.hash != hash) |
1056 | continue; | 1054 | continue; |
1057 | if (dentry->d_parent != parent) | 1055 | if (dentry->d_parent != parent) |
@@ -1123,7 +1121,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent) | |||
1123 | spin_lock(&dcache_lock); | 1121 | spin_lock(&dcache_lock); |
1124 | base = d_hash(dparent, dentry->d_name.hash); | 1122 | base = d_hash(dparent, dentry->d_name.hash); |
1125 | hlist_for_each(lhp,base) { | 1123 | hlist_for_each(lhp,base) { |
1126 | /* hlist_for_each_rcu() not required for d_hash list | 1124 | /* hlist_for_each_entry_rcu() not required for d_hash list |
1127 | * as it is parsed under dcache_lock | 1125 | * as it is parsed under dcache_lock |
1128 | */ | 1126 | */ |
1129 | if (dentry == hlist_entry(lhp, struct dentry, d_hash)) { | 1127 | if (dentry == hlist_entry(lhp, struct dentry, d_hash)) { |
diff --git a/fs/devfs/base.c b/fs/devfs/base.c index 8b679b67e5e0..1274422a5384 100644 --- a/fs/devfs/base.c +++ b/fs/devfs/base.c | |||
@@ -2738,10 +2738,8 @@ static int devfsd_close(struct inode *inode, struct file *file) | |||
2738 | entry = fs_info->devfsd_first_event; | 2738 | entry = fs_info->devfsd_first_event; |
2739 | fs_info->devfsd_first_event = NULL; | 2739 | fs_info->devfsd_first_event = NULL; |
2740 | fs_info->devfsd_last_event = NULL; | 2740 | fs_info->devfsd_last_event = NULL; |
2741 | if (fs_info->devfsd_info) { | 2741 | kfree(fs_info->devfsd_info); |
2742 | kfree(fs_info->devfsd_info); | 2742 | fs_info->devfsd_info = NULL; |
2743 | fs_info->devfsd_info = NULL; | ||
2744 | } | ||
2745 | spin_unlock(&fs_info->devfsd_buffer_lock); | 2743 | spin_unlock(&fs_info->devfsd_buffer_lock); |
2746 | fs_info->devfsd_pgrp = 0; | 2744 | fs_info->devfsd_pgrp = 0; |
2747 | fs_info->devfsd_task = NULL; | 2745 | fs_info->devfsd_task = NULL; |
diff --git a/fs/dquot.c b/fs/dquot.c index ea7644227a65..afa06a893468 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -77,6 +77,7 @@ | |||
77 | #include <linux/kmod.h> | 77 | #include <linux/kmod.h> |
78 | #include <linux/namei.h> | 78 | #include <linux/namei.h> |
79 | #include <linux/buffer_head.h> | 79 | #include <linux/buffer_head.h> |
80 | #include <linux/quotaops.h> | ||
80 | 81 | ||
81 | #include <asm/uaccess.h> | 82 | #include <asm/uaccess.h> |
82 | 83 | ||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/syscalls.h> | 48 | #include <linux/syscalls.h> |
49 | #include <linux/rmap.h> | 49 | #include <linux/rmap.h> |
50 | #include <linux/acct.h> | 50 | #include <linux/acct.h> |
51 | #include <linux/cn_proc.h> | ||
51 | 52 | ||
52 | #include <asm/uaccess.h> | 53 | #include <asm/uaccess.h> |
53 | #include <asm/mmu_context.h> | 54 | #include <asm/mmu_context.h> |
@@ -1096,6 +1097,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs) | |||
1096 | fput(bprm->file); | 1097 | fput(bprm->file); |
1097 | bprm->file = NULL; | 1098 | bprm->file = NULL; |
1098 | current->did_exec = 1; | 1099 | current->did_exec = 1; |
1100 | proc_exec_connector(current); | ||
1099 | return retval; | 1101 | return retval; |
1100 | } | 1102 | } |
1101 | read_lock(&binfmt_lock); | 1103 | read_lock(&binfmt_lock); |
@@ -1509,7 +1511,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs) | |||
1509 | goto close_fail; | 1511 | goto close_fail; |
1510 | if (!file->f_op->write) | 1512 | if (!file->f_op->write) |
1511 | goto close_fail; | 1513 | goto close_fail; |
1512 | if (do_truncate(file->f_dentry, 0) != 0) | 1514 | if (do_truncate(file->f_dentry, 0, file) != 0) |
1513 | goto close_fail; | 1515 | goto close_fail; |
1514 | 1516 | ||
1515 | retval = binfmt->core_dump(signr, regs, file); | 1517 | retval = binfmt->core_dump(signr, regs, file); |
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c index 213148c36ebe..6af2f4130290 100644 --- a/fs/ext2/acl.c +++ b/fs/ext2/acl.c | |||
@@ -194,8 +194,7 @@ ext2_get_acl(struct inode *inode, int type) | |||
194 | acl = NULL; | 194 | acl = NULL; |
195 | else | 195 | else |
196 | acl = ERR_PTR(retval); | 196 | acl = ERR_PTR(retval); |
197 | if (value) | 197 | kfree(value); |
198 | kfree(value); | ||
199 | 198 | ||
200 | if (!IS_ERR(acl)) { | 199 | if (!IS_ERR(acl)) { |
201 | switch(type) { | 200 | switch(type) { |
@@ -262,8 +261,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
262 | 261 | ||
263 | error = ext2_xattr_set(inode, name_index, "", value, size, 0); | 262 | error = ext2_xattr_set(inode, name_index, "", value, size, 0); |
264 | 263 | ||
265 | if (value) | 264 | kfree(value); |
266 | kfree(value); | ||
267 | if (!error) { | 265 | if (!error) { |
268 | switch(type) { | 266 | switch(type) { |
269 | case ACL_TYPE_ACCESS: | 267 | case ACL_TYPE_ACCESS: |
diff --git a/fs/file_table.c b/fs/file_table.c index 4dc205546547..c3a5e2fd663b 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -35,7 +35,7 @@ static DEFINE_SPINLOCK(filp_count_lock); | |||
35 | * context and must be fully threaded - use a local spinlock | 35 | * context and must be fully threaded - use a local spinlock |
36 | * to protect files_stat.nr_files | 36 | * to protect files_stat.nr_files |
37 | */ | 37 | */ |
38 | void filp_ctor(void * objp, struct kmem_cache_s *cachep, unsigned long cflags) | 38 | void filp_ctor(void *objp, struct kmem_cache *cachep, unsigned long cflags) |
39 | { | 39 | { |
40 | if ((cflags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | 40 | if ((cflags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == |
41 | SLAB_CTOR_CONSTRUCTOR) { | 41 | SLAB_CTOR_CONSTRUCTOR) { |
@@ -46,7 +46,7 @@ void filp_ctor(void * objp, struct kmem_cache_s *cachep, unsigned long cflags) | |||
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | void filp_dtor(void * objp, struct kmem_cache_s *cachep, unsigned long dflags) | 49 | void filp_dtor(void *objp, struct kmem_cache *cachep, unsigned long dflags) |
50 | { | 50 | { |
51 | unsigned long flags; | 51 | unsigned long flags; |
52 | spin_lock_irqsave(&filp_count_lock, flags); | 52 | spin_lock_irqsave(&filp_count_lock, flags); |
diff --git a/fs/freevxfs/vxfs_extern.h b/fs/freevxfs/vxfs_extern.h index d8be917f9797..927acf70c591 100644 --- a/fs/freevxfs/vxfs_extern.h +++ b/fs/freevxfs/vxfs_extern.h | |||
@@ -38,7 +38,7 @@ | |||
38 | */ | 38 | */ |
39 | 39 | ||
40 | 40 | ||
41 | struct kmem_cache_s; | 41 | struct kmem_cache; |
42 | struct super_block; | 42 | struct super_block; |
43 | struct vxfs_inode_info; | 43 | struct vxfs_inode_info; |
44 | struct inode; | 44 | struct inode; |
@@ -51,7 +51,7 @@ extern daddr_t vxfs_bmap1(struct inode *, long); | |||
51 | extern int vxfs_read_fshead(struct super_block *); | 51 | extern int vxfs_read_fshead(struct super_block *); |
52 | 52 | ||
53 | /* vxfs_inode.c */ | 53 | /* vxfs_inode.c */ |
54 | extern struct kmem_cache_s *vxfs_inode_cachep; | 54 | extern struct kmem_cache *vxfs_inode_cachep; |
55 | extern void vxfs_dumpi(struct vxfs_inode_info *, ino_t); | 55 | extern void vxfs_dumpi(struct vxfs_inode_info *, ino_t); |
56 | extern struct inode * vxfs_get_fake_inode(struct super_block *, | 56 | extern struct inode * vxfs_get_fake_inode(struct super_block *, |
57 | struct vxfs_inode_info *); | 57 | struct vxfs_inode_info *); |
diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c index 9672d2facffe..f544aae9169f 100644 --- a/fs/freevxfs/vxfs_inode.c +++ b/fs/freevxfs/vxfs_inode.c | |||
@@ -46,15 +46,6 @@ extern struct address_space_operations vxfs_immed_aops; | |||
46 | 46 | ||
47 | extern struct inode_operations vxfs_immed_symlink_iops; | 47 | extern struct inode_operations vxfs_immed_symlink_iops; |
48 | 48 | ||
49 | static struct file_operations vxfs_file_operations = { | ||
50 | .open = generic_file_open, | ||
51 | .llseek = generic_file_llseek, | ||
52 | .read = generic_file_read, | ||
53 | .mmap = generic_file_mmap, | ||
54 | .sendfile = generic_file_sendfile, | ||
55 | }; | ||
56 | |||
57 | |||
58 | kmem_cache_t *vxfs_inode_cachep; | 49 | kmem_cache_t *vxfs_inode_cachep; |
59 | 50 | ||
60 | 51 | ||
@@ -318,7 +309,7 @@ vxfs_read_inode(struct inode *ip) | |||
318 | aops = &vxfs_aops; | 309 | aops = &vxfs_aops; |
319 | 310 | ||
320 | if (S_ISREG(ip->i_mode)) { | 311 | if (S_ISREG(ip->i_mode)) { |
321 | ip->i_fop = &vxfs_file_operations; | 312 | ip->i_fop = &generic_ro_fops; |
322 | ip->i_mapping->a_ops = aops; | 313 | ip->i_mapping->a_ops = aops; |
323 | } else if (S_ISDIR(ip->i_mode)) { | 314 | } else if (S_ISDIR(ip->i_mode)) { |
324 | ip->i_op = &vxfs_dir_inode_ops; | 315 | ip->i_op = &vxfs_dir_inode_ops; |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index c27f8d4098be..785c7213a54f 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -562,7 +562,7 @@ int write_inode_now(struct inode *inode, int sync) | |||
562 | }; | 562 | }; |
563 | 563 | ||
564 | if (!mapping_cap_writeback_dirty(inode->i_mapping)) | 564 | if (!mapping_cap_writeback_dirty(inode->i_mapping)) |
565 | return 0; | 565 | wbc.nr_to_write = 0; |
566 | 566 | ||
567 | might_sleep(); | 567 | might_sleep(); |
568 | spin_lock(&inode_lock); | 568 | spin_lock(&inode_lock); |
@@ -606,7 +606,7 @@ EXPORT_SYMBOL(sync_inode); | |||
606 | * O_SYNC flag set, to flush dirty writes to disk. | 606 | * O_SYNC flag set, to flush dirty writes to disk. |
607 | * | 607 | * |
608 | * @what is a bitmask, specifying which part of the inode's data should be | 608 | * @what is a bitmask, specifying which part of the inode's data should be |
609 | * written and waited upon: | 609 | * written and waited upon. |
610 | * | 610 | * |
611 | * OSYNC_DATA: i_mapping's dirty data | 611 | * OSYNC_DATA: i_mapping's dirty data |
612 | * OSYNC_METADATA: the buffers at i_mapping->private_list | 612 | * OSYNC_METADATA: the buffers at i_mapping->private_list |
@@ -672,8 +672,9 @@ int writeback_acquire(struct backing_dev_info *bdi) | |||
672 | 672 | ||
673 | /** | 673 | /** |
674 | * writeback_in_progress: determine whether there is writeback in progress | 674 | * writeback_in_progress: determine whether there is writeback in progress |
675 | * against a backing device. | ||
676 | * @bdi: the device's backing_dev_info structure. | 675 | * @bdi: the device's backing_dev_info structure. |
676 | * | ||
677 | * Determine whether there is writeback in progress against a backing device. | ||
677 | */ | 678 | */ |
678 | int writeback_in_progress(struct backing_dev_info *bdi) | 679 | int writeback_in_progress(struct backing_dev_info *bdi) |
679 | { | 680 | { |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index a6f90a6c754a..8f873e621f41 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -184,6 +184,13 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) | |||
184 | fuse_putback_request() */ | 184 | fuse_putback_request() */ |
185 | for (i = 1; i < FUSE_MAX_OUTSTANDING; i++) | 185 | for (i = 1; i < FUSE_MAX_OUTSTANDING; i++) |
186 | up(&fc->outstanding_sem); | 186 | up(&fc->outstanding_sem); |
187 | } else if (req->in.h.opcode == FUSE_RELEASE && req->inode == NULL) { | ||
188 | /* Special case for failed iget in CREATE */ | ||
189 | u64 nodeid = req->in.h.nodeid; | ||
190 | __fuse_get_request(req); | ||
191 | fuse_reset_request(req); | ||
192 | fuse_send_forget(fc, req, nodeid, 1); | ||
193 | putback = 0; | ||
187 | } | 194 | } |
188 | if (putback) | 195 | if (putback) |
189 | fuse_putback_request(fc, req); | 196 | fuse_putback_request(fc, req); |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 70dba721acab..c045cc70c749 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/gfp.h> | 13 | #include <linux/gfp.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/namei.h> | 15 | #include <linux/namei.h> |
16 | #include <linux/mount.h> | ||
16 | 17 | ||
17 | static inline unsigned long time_to_jiffies(unsigned long sec, | 18 | static inline unsigned long time_to_jiffies(unsigned long sec, |
18 | unsigned long nsec) | 19 | unsigned long nsec) |
@@ -134,6 +135,101 @@ static void fuse_invalidate_entry(struct dentry *entry) | |||
134 | entry->d_time = jiffies - 1; | 135 | entry->d_time = jiffies - 1; |
135 | } | 136 | } |
136 | 137 | ||
138 | static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | ||
139 | struct nameidata *nd) | ||
140 | { | ||
141 | int err; | ||
142 | struct inode *inode; | ||
143 | struct fuse_conn *fc = get_fuse_conn(dir); | ||
144 | struct fuse_req *req; | ||
145 | struct fuse_open_in inarg; | ||
146 | struct fuse_open_out outopen; | ||
147 | struct fuse_entry_out outentry; | ||
148 | struct fuse_inode *fi; | ||
149 | struct fuse_file *ff; | ||
150 | struct file *file; | ||
151 | int flags = nd->intent.open.flags - 1; | ||
152 | |||
153 | err = -ENOSYS; | ||
154 | if (fc->no_create) | ||
155 | goto out; | ||
156 | |||
157 | err = -ENAMETOOLONG; | ||
158 | if (entry->d_name.len > FUSE_NAME_MAX) | ||
159 | goto out; | ||
160 | |||
161 | err = -EINTR; | ||
162 | req = fuse_get_request(fc); | ||
163 | if (!req) | ||
164 | goto out; | ||
165 | |||
166 | ff = fuse_file_alloc(); | ||
167 | if (!ff) | ||
168 | goto out_put_request; | ||
169 | |||
170 | flags &= ~O_NOCTTY; | ||
171 | memset(&inarg, 0, sizeof(inarg)); | ||
172 | inarg.flags = flags; | ||
173 | inarg.mode = mode; | ||
174 | req->in.h.opcode = FUSE_CREATE; | ||
175 | req->in.h.nodeid = get_node_id(dir); | ||
176 | req->inode = dir; | ||
177 | req->in.numargs = 2; | ||
178 | req->in.args[0].size = sizeof(inarg); | ||
179 | req->in.args[0].value = &inarg; | ||
180 | req->in.args[1].size = entry->d_name.len + 1; | ||
181 | req->in.args[1].value = entry->d_name.name; | ||
182 | req->out.numargs = 2; | ||
183 | req->out.args[0].size = sizeof(outentry); | ||
184 | req->out.args[0].value = &outentry; | ||
185 | req->out.args[1].size = sizeof(outopen); | ||
186 | req->out.args[1].value = &outopen; | ||
187 | request_send(fc, req); | ||
188 | err = req->out.h.error; | ||
189 | if (err) { | ||
190 | if (err == -ENOSYS) | ||
191 | fc->no_create = 1; | ||
192 | goto out_free_ff; | ||
193 | } | ||
194 | |||
195 | err = -EIO; | ||
196 | if (!S_ISREG(outentry.attr.mode)) | ||
197 | goto out_free_ff; | ||
198 | |||
199 | inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, | ||
200 | &outentry.attr); | ||
201 | err = -ENOMEM; | ||
202 | if (!inode) { | ||
203 | flags &= ~(O_CREAT | O_EXCL | O_TRUNC); | ||
204 | ff->fh = outopen.fh; | ||
205 | fuse_send_release(fc, ff, outentry.nodeid, NULL, flags, 0); | ||
206 | goto out_put_request; | ||
207 | } | ||
208 | fuse_put_request(fc, req); | ||
209 | entry->d_time = time_to_jiffies(outentry.entry_valid, | ||
210 | outentry.entry_valid_nsec); | ||
211 | fi = get_fuse_inode(inode); | ||
212 | fi->i_time = time_to_jiffies(outentry.attr_valid, | ||
213 | outentry.attr_valid_nsec); | ||
214 | |||
215 | d_instantiate(entry, inode); | ||
216 | file = lookup_instantiate_filp(nd, entry, generic_file_open); | ||
217 | if (IS_ERR(file)) { | ||
218 | ff->fh = outopen.fh; | ||
219 | fuse_send_release(fc, ff, outentry.nodeid, inode, flags, 0); | ||
220 | return PTR_ERR(file); | ||
221 | } | ||
222 | fuse_finish_open(inode, file, ff, &outopen); | ||
223 | return 0; | ||
224 | |||
225 | out_free_ff: | ||
226 | fuse_file_free(ff); | ||
227 | out_put_request: | ||
228 | fuse_put_request(fc, req); | ||
229 | out: | ||
230 | return err; | ||
231 | } | ||
232 | |||
137 | static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | 233 | static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, |
138 | struct inode *dir, struct dentry *entry, | 234 | struct inode *dir, struct dentry *entry, |
139 | int mode) | 235 | int mode) |
@@ -208,6 +304,12 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode, | |||
208 | static int fuse_create(struct inode *dir, struct dentry *entry, int mode, | 304 | static int fuse_create(struct inode *dir, struct dentry *entry, int mode, |
209 | struct nameidata *nd) | 305 | struct nameidata *nd) |
210 | { | 306 | { |
307 | if (nd && (nd->flags & LOOKUP_CREATE)) { | ||
308 | int err = fuse_create_open(dir, entry, mode, nd); | ||
309 | if (err != -ENOSYS) | ||
310 | return err; | ||
311 | /* Fall back on mknod */ | ||
312 | } | ||
211 | return fuse_mknod(dir, entry, mode, 0); | 313 | return fuse_mknod(dir, entry, mode, 0); |
212 | } | 314 | } |
213 | 315 | ||
@@ -461,6 +563,38 @@ static int fuse_revalidate(struct dentry *entry) | |||
461 | return fuse_do_getattr(inode); | 563 | return fuse_do_getattr(inode); |
462 | } | 564 | } |
463 | 565 | ||
566 | static int fuse_access(struct inode *inode, int mask) | ||
567 | { | ||
568 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
569 | struct fuse_req *req; | ||
570 | struct fuse_access_in inarg; | ||
571 | int err; | ||
572 | |||
573 | if (fc->no_access) | ||
574 | return 0; | ||
575 | |||
576 | req = fuse_get_request(fc); | ||
577 | if (!req) | ||
578 | return -EINTR; | ||
579 | |||
580 | memset(&inarg, 0, sizeof(inarg)); | ||
581 | inarg.mask = mask; | ||
582 | req->in.h.opcode = FUSE_ACCESS; | ||
583 | req->in.h.nodeid = get_node_id(inode); | ||
584 | req->inode = inode; | ||
585 | req->in.numargs = 1; | ||
586 | req->in.args[0].size = sizeof(inarg); | ||
587 | req->in.args[0].value = &inarg; | ||
588 | request_send(fc, req); | ||
589 | err = req->out.h.error; | ||
590 | fuse_put_request(fc, req); | ||
591 | if (err == -ENOSYS) { | ||
592 | fc->no_access = 1; | ||
593 | err = 0; | ||
594 | } | ||
595 | return err; | ||
596 | } | ||
597 | |||
464 | static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) | 598 | static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) |
465 | { | 599 | { |
466 | struct fuse_conn *fc = get_fuse_conn(inode); | 600 | struct fuse_conn *fc = get_fuse_conn(inode); |
@@ -491,11 +625,11 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) | |||
491 | return err; | 625 | return err; |
492 | } else { | 626 | } else { |
493 | int mode = inode->i_mode; | 627 | int mode = inode->i_mode; |
494 | if ((mask & MAY_WRITE) && IS_RDONLY(inode) && | ||
495 | (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) | ||
496 | return -EROFS; | ||
497 | if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO)) | 628 | if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO)) |
498 | return -EACCES; | 629 | return -EACCES; |
630 | |||
631 | if (nd && (nd->flags & LOOKUP_ACCESS)) | ||
632 | return fuse_access(inode, mask); | ||
499 | return 0; | 633 | return 0; |
500 | } | 634 | } |
501 | } | 635 | } |
@@ -629,29 +763,29 @@ static int fuse_dir_fsync(struct file *file, struct dentry *de, int datasync) | |||
629 | return file ? fuse_fsync_common(file, de, datasync, 1) : 0; | 763 | return file ? fuse_fsync_common(file, de, datasync, 1) : 0; |
630 | } | 764 | } |
631 | 765 | ||
632 | static unsigned iattr_to_fattr(struct iattr *iattr, struct fuse_attr *fattr) | 766 | static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg) |
633 | { | 767 | { |
634 | unsigned ivalid = iattr->ia_valid; | 768 | unsigned ivalid = iattr->ia_valid; |
635 | unsigned fvalid = 0; | ||
636 | |||
637 | memset(fattr, 0, sizeof(*fattr)); | ||
638 | 769 | ||
639 | if (ivalid & ATTR_MODE) | 770 | if (ivalid & ATTR_MODE) |
640 | fvalid |= FATTR_MODE, fattr->mode = iattr->ia_mode; | 771 | arg->valid |= FATTR_MODE, arg->mode = iattr->ia_mode; |
641 | if (ivalid & ATTR_UID) | 772 | if (ivalid & ATTR_UID) |
642 | fvalid |= FATTR_UID, fattr->uid = iattr->ia_uid; | 773 | arg->valid |= FATTR_UID, arg->uid = iattr->ia_uid; |
643 | if (ivalid & ATTR_GID) | 774 | if (ivalid & ATTR_GID) |
644 | fvalid |= FATTR_GID, fattr->gid = iattr->ia_gid; | 775 | arg->valid |= FATTR_GID, arg->gid = iattr->ia_gid; |
645 | if (ivalid & ATTR_SIZE) | 776 | if (ivalid & ATTR_SIZE) |
646 | fvalid |= FATTR_SIZE, fattr->size = iattr->ia_size; | 777 | arg->valid |= FATTR_SIZE, arg->size = iattr->ia_size; |
647 | /* You can only _set_ these together (they may change by themselves) */ | 778 | /* You can only _set_ these together (they may change by themselves) */ |
648 | if ((ivalid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) { | 779 | if ((ivalid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) { |
649 | fvalid |= FATTR_ATIME | FATTR_MTIME; | 780 | arg->valid |= FATTR_ATIME | FATTR_MTIME; |
650 | fattr->atime = iattr->ia_atime.tv_sec; | 781 | arg->atime = iattr->ia_atime.tv_sec; |
651 | fattr->mtime = iattr->ia_mtime.tv_sec; | 782 | arg->mtime = iattr->ia_mtime.tv_sec; |
783 | } | ||
784 | if (ivalid & ATTR_FILE) { | ||
785 | struct fuse_file *ff = iattr->ia_file->private_data; | ||
786 | arg->valid |= FATTR_FH; | ||
787 | arg->fh = ff->fh; | ||
652 | } | 788 | } |
653 | |||
654 | return fvalid; | ||
655 | } | 789 | } |
656 | 790 | ||
657 | static int fuse_setattr(struct dentry *entry, struct iattr *attr) | 791 | static int fuse_setattr(struct dentry *entry, struct iattr *attr) |
@@ -686,7 +820,7 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) | |||
686 | return -EINTR; | 820 | return -EINTR; |
687 | 821 | ||
688 | memset(&inarg, 0, sizeof(inarg)); | 822 | memset(&inarg, 0, sizeof(inarg)); |
689 | inarg.valid = iattr_to_fattr(attr, &inarg.attr); | 823 | iattr_to_fattr(attr, &inarg); |
690 | req->in.h.opcode = FUSE_SETATTR; | 824 | req->in.h.opcode = FUSE_SETATTR; |
691 | req->in.h.nodeid = get_node_id(inode); | 825 | req->in.h.nodeid = get_node_id(inode); |
692 | req->inode = inode; | 826 | req->inode = inode; |
@@ -735,7 +869,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, | |||
735 | struct nameidata *nd) | 869 | struct nameidata *nd) |
736 | { | 870 | { |
737 | struct inode *inode; | 871 | struct inode *inode; |
738 | int err = fuse_lookup_iget(dir, entry, &inode); | 872 | int err; |
873 | |||
874 | err = fuse_lookup_iget(dir, entry, &inode); | ||
739 | if (err) | 875 | if (err) |
740 | return ERR_PTR(err); | 876 | return ERR_PTR(err); |
741 | if (inode && S_ISDIR(inode->i_mode)) { | 877 | if (inode && S_ISDIR(inode->i_mode)) { |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 657ab11c173b..2ca86141d13a 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -14,11 +14,69 @@ | |||
14 | 14 | ||
15 | static struct file_operations fuse_direct_io_file_operations; | 15 | static struct file_operations fuse_direct_io_file_operations; |
16 | 16 | ||
17 | int fuse_open_common(struct inode *inode, struct file *file, int isdir) | 17 | static int fuse_send_open(struct inode *inode, struct file *file, int isdir, |
18 | struct fuse_open_out *outargp) | ||
18 | { | 19 | { |
19 | struct fuse_conn *fc = get_fuse_conn(inode); | 20 | struct fuse_conn *fc = get_fuse_conn(inode); |
20 | struct fuse_req *req; | ||
21 | struct fuse_open_in inarg; | 21 | struct fuse_open_in inarg; |
22 | struct fuse_req *req; | ||
23 | int err; | ||
24 | |||
25 | req = fuse_get_request(fc); | ||
26 | if (!req) | ||
27 | return -EINTR; | ||
28 | |||
29 | memset(&inarg, 0, sizeof(inarg)); | ||
30 | inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); | ||
31 | req->in.h.opcode = isdir ? FUSE_OPENDIR : FUSE_OPEN; | ||
32 | req->in.h.nodeid = get_node_id(inode); | ||
33 | req->inode = inode; | ||
34 | req->in.numargs = 1; | ||
35 | req->in.args[0].size = sizeof(inarg); | ||
36 | req->in.args[0].value = &inarg; | ||
37 | req->out.numargs = 1; | ||
38 | req->out.args[0].size = sizeof(*outargp); | ||
39 | req->out.args[0].value = outargp; | ||
40 | request_send(fc, req); | ||
41 | err = req->out.h.error; | ||
42 | fuse_put_request(fc, req); | ||
43 | |||
44 | return err; | ||
45 | } | ||
46 | |||
47 | struct fuse_file *fuse_file_alloc(void) | ||
48 | { | ||
49 | struct fuse_file *ff; | ||
50 | ff = kmalloc(sizeof(struct fuse_file), GFP_KERNEL); | ||
51 | if (ff) { | ||
52 | ff->release_req = fuse_request_alloc(); | ||
53 | if (!ff->release_req) { | ||
54 | kfree(ff); | ||
55 | ff = NULL; | ||
56 | } | ||
57 | } | ||
58 | return ff; | ||
59 | } | ||
60 | |||
61 | void fuse_file_free(struct fuse_file *ff) | ||
62 | { | ||
63 | fuse_request_free(ff->release_req); | ||
64 | kfree(ff); | ||
65 | } | ||
66 | |||
67 | void fuse_finish_open(struct inode *inode, struct file *file, | ||
68 | struct fuse_file *ff, struct fuse_open_out *outarg) | ||
69 | { | ||
70 | if (outarg->open_flags & FOPEN_DIRECT_IO) | ||
71 | file->f_op = &fuse_direct_io_file_operations; | ||
72 | if (!(outarg->open_flags & FOPEN_KEEP_CACHE)) | ||
73 | invalidate_inode_pages(inode->i_mapping); | ||
74 | ff->fh = outarg->fh; | ||
75 | file->private_data = ff; | ||
76 | } | ||
77 | |||
78 | int fuse_open_common(struct inode *inode, struct file *file, int isdir) | ||
79 | { | ||
22 | struct fuse_open_out outarg; | 80 | struct fuse_open_out outarg; |
23 | struct fuse_file *ff; | 81 | struct fuse_file *ff; |
24 | int err; | 82 | int err; |
@@ -34,73 +92,53 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir) | |||
34 | /* If opening the root node, no lookup has been performed on | 92 | /* If opening the root node, no lookup has been performed on |
35 | it, so the attributes must be refreshed */ | 93 | it, so the attributes must be refreshed */ |
36 | if (get_node_id(inode) == FUSE_ROOT_ID) { | 94 | if (get_node_id(inode) == FUSE_ROOT_ID) { |
37 | int err = fuse_do_getattr(inode); | 95 | err = fuse_do_getattr(inode); |
38 | if (err) | 96 | if (err) |
39 | return err; | 97 | return err; |
40 | } | 98 | } |
41 | 99 | ||
42 | req = fuse_get_request(fc); | 100 | ff = fuse_file_alloc(); |
43 | if (!req) | ||
44 | return -EINTR; | ||
45 | |||
46 | err = -ENOMEM; | ||
47 | ff = kmalloc(sizeof(struct fuse_file), GFP_KERNEL); | ||
48 | if (!ff) | 101 | if (!ff) |
49 | goto out_put_request; | 102 | return -ENOMEM; |
50 | 103 | ||
51 | ff->release_req = fuse_request_alloc(); | 104 | err = fuse_send_open(inode, file, isdir, &outarg); |
52 | if (!ff->release_req) { | 105 | if (err) |
53 | kfree(ff); | 106 | fuse_file_free(ff); |
54 | goto out_put_request; | 107 | else { |
55 | } | 108 | if (isdir) |
56 | 109 | outarg.open_flags &= ~FOPEN_DIRECT_IO; | |
57 | memset(&inarg, 0, sizeof(inarg)); | 110 | fuse_finish_open(inode, file, ff, &outarg); |
58 | inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); | ||
59 | req->in.h.opcode = isdir ? FUSE_OPENDIR : FUSE_OPEN; | ||
60 | req->in.h.nodeid = get_node_id(inode); | ||
61 | req->inode = inode; | ||
62 | req->in.numargs = 1; | ||
63 | req->in.args[0].size = sizeof(inarg); | ||
64 | req->in.args[0].value = &inarg; | ||
65 | req->out.numargs = 1; | ||
66 | req->out.args[0].size = sizeof(outarg); | ||
67 | req->out.args[0].value = &outarg; | ||
68 | request_send(fc, req); | ||
69 | err = req->out.h.error; | ||
70 | if (err) { | ||
71 | fuse_request_free(ff->release_req); | ||
72 | kfree(ff); | ||
73 | } else { | ||
74 | if (!isdir && (outarg.open_flags & FOPEN_DIRECT_IO)) | ||
75 | file->f_op = &fuse_direct_io_file_operations; | ||
76 | if (!(outarg.open_flags & FOPEN_KEEP_CACHE)) | ||
77 | invalidate_inode_pages(inode->i_mapping); | ||
78 | ff->fh = outarg.fh; | ||
79 | file->private_data = ff; | ||
80 | } | 111 | } |
81 | 112 | ||
82 | out_put_request: | ||
83 | fuse_put_request(fc, req); | ||
84 | return err; | 113 | return err; |
85 | } | 114 | } |
86 | 115 | ||
87 | int fuse_release_common(struct inode *inode, struct file *file, int isdir) | 116 | void fuse_send_release(struct fuse_conn *fc, struct fuse_file *ff, |
117 | u64 nodeid, struct inode *inode, int flags, int isdir) | ||
88 | { | 118 | { |
89 | struct fuse_conn *fc = get_fuse_conn(inode); | 119 | struct fuse_req * req = ff->release_req; |
90 | struct fuse_file *ff = file->private_data; | ||
91 | struct fuse_req *req = ff->release_req; | ||
92 | struct fuse_release_in *inarg = &req->misc.release_in; | 120 | struct fuse_release_in *inarg = &req->misc.release_in; |
93 | 121 | ||
94 | inarg->fh = ff->fh; | 122 | inarg->fh = ff->fh; |
95 | inarg->flags = file->f_flags & ~O_EXCL; | 123 | inarg->flags = flags; |
96 | req->in.h.opcode = isdir ? FUSE_RELEASEDIR : FUSE_RELEASE; | 124 | req->in.h.opcode = isdir ? FUSE_RELEASEDIR : FUSE_RELEASE; |
97 | req->in.h.nodeid = get_node_id(inode); | 125 | req->in.h.nodeid = nodeid; |
98 | req->inode = inode; | 126 | req->inode = inode; |
99 | req->in.numargs = 1; | 127 | req->in.numargs = 1; |
100 | req->in.args[0].size = sizeof(struct fuse_release_in); | 128 | req->in.args[0].size = sizeof(struct fuse_release_in); |
101 | req->in.args[0].value = inarg; | 129 | req->in.args[0].value = inarg; |
102 | request_send_background(fc, req); | 130 | request_send_background(fc, req); |
103 | kfree(ff); | 131 | kfree(ff); |
132 | } | ||
133 | |||
134 | int fuse_release_common(struct inode *inode, struct file *file, int isdir) | ||
135 | { | ||
136 | struct fuse_file *ff = file->private_data; | ||
137 | if (ff) { | ||
138 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
139 | u64 nodeid = get_node_id(inode); | ||
140 | fuse_send_release(fc, ff, nodeid, inode, file->f_flags, isdir); | ||
141 | } | ||
104 | 142 | ||
105 | /* Return value is ignored by VFS */ | 143 | /* Return value is ignored by VFS */ |
106 | return 0; | 144 | return 0; |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 5cb456f572c1..0ea5301f86be 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -266,6 +266,12 @@ struct fuse_conn { | |||
266 | /** Is removexattr not implemented by fs? */ | 266 | /** Is removexattr not implemented by fs? */ |
267 | unsigned no_removexattr : 1; | 267 | unsigned no_removexattr : 1; |
268 | 268 | ||
269 | /** Is access not implemented by fs? */ | ||
270 | unsigned no_access : 1; | ||
271 | |||
272 | /** Is create not implemented by fs? */ | ||
273 | unsigned no_create : 1; | ||
274 | |||
269 | /** Backing dev info */ | 275 | /** Backing dev info */ |
270 | struct backing_dev_info bdi; | 276 | struct backing_dev_info bdi; |
271 | }; | 277 | }; |
@@ -337,6 +343,17 @@ size_t fuse_send_read_common(struct fuse_req *req, struct file *file, | |||
337 | */ | 343 | */ |
338 | int fuse_open_common(struct inode *inode, struct file *file, int isdir); | 344 | int fuse_open_common(struct inode *inode, struct file *file, int isdir); |
339 | 345 | ||
346 | struct fuse_file *fuse_file_alloc(void); | ||
347 | void fuse_file_free(struct fuse_file *ff); | ||
348 | void fuse_finish_open(struct inode *inode, struct file *file, | ||
349 | struct fuse_file *ff, struct fuse_open_out *outarg); | ||
350 | |||
351 | /** | ||
352 | * Send a RELEASE request | ||
353 | */ | ||
354 | void fuse_send_release(struct fuse_conn *fc, struct fuse_file *ff, | ||
355 | u64 nodeid, struct inode *inode, int flags, int isdir); | ||
356 | |||
340 | /** | 357 | /** |
341 | * Send RELEASE or RELEASEDIR request | 358 | * Send RELEASE or RELEASEDIR request |
342 | */ | 359 | */ |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index dd7113106269..a33fb1d91373 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -294,8 +294,7 @@ static void hostfs_delete_inode(struct inode *inode) | |||
294 | 294 | ||
295 | static void hostfs_destroy_inode(struct inode *inode) | 295 | static void hostfs_destroy_inode(struct inode *inode) |
296 | { | 296 | { |
297 | if(HOSTFS_I(inode)->host_filename) | 297 | kfree(HOSTFS_I(inode)->host_filename); |
298 | kfree(HOSTFS_I(inode)->host_filename); | ||
299 | 298 | ||
300 | /*XXX: This should not happen, probably. The check is here for | 299 | /*XXX: This should not happen, probably. The check is here for |
301 | * additional safety.*/ | 300 | * additional safety.*/ |
diff --git a/fs/hpfs/dnode.c b/fs/hpfs/dnode.c index 1d21307730a8..229ff2fb1809 100644 --- a/fs/hpfs/dnode.c +++ b/fs/hpfs/dnode.c | |||
@@ -244,12 +244,12 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
244 | go_up: | 244 | go_up: |
245 | if (namelen >= 256) { | 245 | if (namelen >= 256) { |
246 | hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen); | 246 | hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen); |
247 | if (nd) kfree(nd); | 247 | kfree(nd); |
248 | kfree(nname); | 248 | kfree(nname); |
249 | return 1; | 249 | return 1; |
250 | } | 250 | } |
251 | if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) { | 251 | if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) { |
252 | if (nd) kfree(nd); | 252 | kfree(nd); |
253 | kfree(nname); | 253 | kfree(nname); |
254 | return 1; | 254 | return 1; |
255 | } | 255 | } |
@@ -257,7 +257,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
257 | if (hpfs_sb(i->i_sb)->sb_chk) | 257 | if (hpfs_sb(i->i_sb)->sb_chk) |
258 | if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) { | 258 | if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) { |
259 | hpfs_brelse4(&qbh); | 259 | hpfs_brelse4(&qbh); |
260 | if (nd) kfree(nd); | 260 | kfree(nd); |
261 | kfree(nname); | 261 | kfree(nname); |
262 | return 1; | 262 | return 1; |
263 | } | 263 | } |
@@ -270,7 +270,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno, | |||
270 | for_all_poss(i, hpfs_pos_subst, 5, t + 1); | 270 | for_all_poss(i, hpfs_pos_subst, 5, t + 1); |
271 | hpfs_mark_4buffers_dirty(&qbh); | 271 | hpfs_mark_4buffers_dirty(&qbh); |
272 | hpfs_brelse4(&qbh); | 272 | hpfs_brelse4(&qbh); |
273 | if (nd) kfree(nd); | 273 | kfree(nd); |
274 | kfree(nname); | 274 | kfree(nname); |
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 8eefa6366db7..63e88d7e2c3b 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -75,7 +75,7 @@ void hpfs_error(struct super_block *s, char *m,...) | |||
75 | } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); | 75 | } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); |
76 | else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); | 76 | else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); |
77 | } else printk("\n"); | 77 | } else printk("\n"); |
78 | if (buf) kfree(buf); | 78 | kfree(buf); |
79 | hpfs_sb(s)->sb_was_error = 1; | 79 | hpfs_sb(s)->sb_was_error = 1; |
80 | } | 80 | } |
81 | 81 | ||
@@ -102,8 +102,8 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2, | |||
102 | static void hpfs_put_super(struct super_block *s) | 102 | static void hpfs_put_super(struct super_block *s) |
103 | { | 103 | { |
104 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 104 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
105 | if (sbi->sb_cp_table) kfree(sbi->sb_cp_table); | 105 | kfree(sbi->sb_cp_table); |
106 | if (sbi->sb_bmp_dir) kfree(sbi->sb_bmp_dir); | 106 | kfree(sbi->sb_bmp_dir); |
107 | unmark_dirty(s); | 107 | unmark_dirty(s); |
108 | s->s_fs_info = NULL; | 108 | s->s_fs_info = NULL; |
109 | kfree(sbi); | 109 | kfree(sbi); |
@@ -654,8 +654,8 @@ bail3: brelse(bh1); | |||
654 | bail2: brelse(bh0); | 654 | bail2: brelse(bh0); |
655 | bail1: | 655 | bail1: |
656 | bail0: | 656 | bail0: |
657 | if (sbi->sb_bmp_dir) kfree(sbi->sb_bmp_dir); | 657 | kfree(sbi->sb_bmp_dir); |
658 | if (sbi->sb_cp_table) kfree(sbi->sb_cp_table); | 658 | kfree(sbi->sb_cp_table); |
659 | s->s_fs_info = NULL; | 659 | s->s_fs_info = NULL; |
660 | kfree(sbi); | 660 | kfree(sbi); |
661 | return -EINVAL; | 661 | return -EINVAL; |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 1652de1b6cb9..298f08be22d4 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -855,8 +855,7 @@ root_found: | |||
855 | if (opt.check == 'r') table++; | 855 | if (opt.check == 'r') table++; |
856 | s->s_root->d_op = &isofs_dentry_ops[table]; | 856 | s->s_root->d_op = &isofs_dentry_ops[table]; |
857 | 857 | ||
858 | if (opt.iocharset) | 858 | kfree(opt.iocharset); |
859 | kfree(opt.iocharset); | ||
860 | 859 | ||
861 | return 0; | 860 | return 0; |
862 | 861 | ||
@@ -895,8 +894,7 @@ out_unknown_format: | |||
895 | out_freebh: | 894 | out_freebh: |
896 | brelse(bh); | 895 | brelse(bh); |
897 | out_freesbi: | 896 | out_freesbi: |
898 | if (opt.iocharset) | 897 | kfree(opt.iocharset); |
899 | kfree(opt.iocharset); | ||
900 | kfree(sbi); | 898 | kfree(sbi); |
901 | s->s_fs_info = NULL; | 899 | s->s_fs_info = NULL; |
902 | return -EINVAL; | 900 | return -EINVAL; |
@@ -1164,8 +1162,7 @@ out_nomem: | |||
1164 | 1162 | ||
1165 | out_noread: | 1163 | out_noread: |
1166 | printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block); | 1164 | printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block); |
1167 | if (tmpde) | 1165 | kfree(tmpde); |
1168 | kfree(tmpde); | ||
1169 | return -EIO; | 1166 | return -EIO; |
1170 | 1167 | ||
1171 | out_toomany: | 1168 | out_toomany: |
@@ -1334,8 +1331,7 @@ static void isofs_read_inode(struct inode *inode) | |||
1334 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | 1331 | init_special_inode(inode, inode->i_mode, inode->i_rdev); |
1335 | 1332 | ||
1336 | out: | 1333 | out: |
1337 | if (tmpde) | 1334 | kfree(tmpde); |
1338 | kfree(tmpde); | ||
1339 | if (bh) | 1335 | if (bh) |
1340 | brelse(bh); | 1336 | brelse(bh); |
1341 | return; | 1337 | return; |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 2a3e310f79ef..002ad2bbc769 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -261,10 +261,8 @@ void journal_commit_transaction(journal_t *journal) | |||
261 | struct buffer_head *bh = jh2bh(jh); | 261 | struct buffer_head *bh = jh2bh(jh); |
262 | 262 | ||
263 | jbd_lock_bh_state(bh); | 263 | jbd_lock_bh_state(bh); |
264 | if (jh->b_committed_data) { | 264 | kfree(jh->b_committed_data); |
265 | kfree(jh->b_committed_data); | 265 | jh->b_committed_data = NULL; |
266 | jh->b_committed_data = NULL; | ||
267 | } | ||
268 | jbd_unlock_bh_state(bh); | 266 | jbd_unlock_bh_state(bh); |
269 | } | 267 | } |
270 | journal_refile_buffer(journal, jh); | 268 | journal_refile_buffer(journal, jh); |
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c index 103c34e4fb28..80d7f53fd0a7 100644 --- a/fs/jbd/recovery.c +++ b/fs/jbd/recovery.c | |||
@@ -210,7 +210,7 @@ do { \ | |||
210 | } while (0) | 210 | } while (0) |
211 | 211 | ||
212 | /** | 212 | /** |
213 | * int journal_recover(journal_t *journal) - recovers a on-disk journal | 213 | * journal_recover - recovers a on-disk journal |
214 | * @journal: the journal to recover | 214 | * @journal: the journal to recover |
215 | * | 215 | * |
216 | * The primary function for recovering the log contents when mounting a | 216 | * The primary function for recovering the log contents when mounting a |
@@ -266,7 +266,7 @@ int journal_recover(journal_t *journal) | |||
266 | } | 266 | } |
267 | 267 | ||
268 | /** | 268 | /** |
269 | * int journal_skip_recovery() - Start journal and wipe exiting records | 269 | * journal_skip_recovery - Start journal and wipe exiting records |
270 | * @journal: journal to startup | 270 | * @journal: journal to startup |
271 | * | 271 | * |
272 | * Locate any valid recovery information from the journal and set up the | 272 | * Locate any valid recovery information from the journal and set up the |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 13cb05bf6048..429f4b263cf1 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -227,8 +227,7 @@ repeat_locked: | |||
227 | spin_unlock(&transaction->t_handle_lock); | 227 | spin_unlock(&transaction->t_handle_lock); |
228 | spin_unlock(&journal->j_state_lock); | 228 | spin_unlock(&journal->j_state_lock); |
229 | out: | 229 | out: |
230 | if (new_transaction) | 230 | kfree(new_transaction); |
231 | kfree(new_transaction); | ||
232 | return ret; | 231 | return ret; |
233 | } | 232 | } |
234 | 233 | ||
@@ -725,8 +724,7 @@ done: | |||
725 | journal_cancel_revoke(handle, jh); | 724 | journal_cancel_revoke(handle, jh); |
726 | 725 | ||
727 | out: | 726 | out: |
728 | if (frozen_buffer) | 727 | kfree(frozen_buffer); |
729 | kfree(frozen_buffer); | ||
730 | 728 | ||
731 | JBUFFER_TRACE(jh, "exit"); | 729 | JBUFFER_TRACE(jh, "exit"); |
732 | return error; | 730 | return error; |
@@ -905,8 +903,7 @@ repeat: | |||
905 | jbd_unlock_bh_state(bh); | 903 | jbd_unlock_bh_state(bh); |
906 | out: | 904 | out: |
907 | journal_put_journal_head(jh); | 905 | journal_put_journal_head(jh); |
908 | if (committed_data) | 906 | kfree(committed_data); |
909 | kfree(committed_data); | ||
910 | return err; | 907 | return err; |
911 | } | 908 | } |
912 | 909 | ||
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c index 27f199e94cfc..b2e95421d932 100644 --- a/fs/jffs/intrep.c +++ b/fs/jffs/intrep.c | |||
@@ -462,7 +462,7 @@ jffs_checksum_flash(struct mtd_info *mtd, loff_t start, int size, __u32 *result) | |||
462 | } | 462 | } |
463 | 463 | ||
464 | /* Free read buffer */ | 464 | /* Free read buffer */ |
465 | kfree (read_buf); | 465 | kfree(read_buf); |
466 | 466 | ||
467 | /* Return result */ | 467 | /* Return result */ |
468 | D3(printk("checksum result: 0x%08x\n", sum)); | 468 | D3(printk("checksum result: 0x%08x\n", sum)); |
@@ -1011,12 +1011,12 @@ jffs_scan_flash(struct jffs_control *c) | |||
1011 | offset , fmc->sector_size); | 1011 | offset , fmc->sector_size); |
1012 | 1012 | ||
1013 | flash_safe_release(fmc->mtd); | 1013 | flash_safe_release(fmc->mtd); |
1014 | kfree (read_buf); | 1014 | kfree(read_buf); |
1015 | return -1; /* bad, bad, bad! */ | 1015 | return -1; /* bad, bad, bad! */ |
1016 | 1016 | ||
1017 | } | 1017 | } |
1018 | flash_safe_release(fmc->mtd); | 1018 | flash_safe_release(fmc->mtd); |
1019 | kfree (read_buf); | 1019 | kfree(read_buf); |
1020 | 1020 | ||
1021 | return -EAGAIN; /* erased offending sector. Try mount one more time please. */ | 1021 | return -EAGAIN; /* erased offending sector. Try mount one more time please. */ |
1022 | } | 1022 | } |
@@ -1112,7 +1112,7 @@ jffs_scan_flash(struct jffs_control *c) | |||
1112 | if (!node) { | 1112 | if (!node) { |
1113 | if (!(node = jffs_alloc_node())) { | 1113 | if (!(node = jffs_alloc_node())) { |
1114 | /* Free read buffer */ | 1114 | /* Free read buffer */ |
1115 | kfree (read_buf); | 1115 | kfree(read_buf); |
1116 | 1116 | ||
1117 | /* Release the flash device */ | 1117 | /* Release the flash device */ |
1118 | flash_safe_release(fmc->mtd); | 1118 | flash_safe_release(fmc->mtd); |
@@ -1269,7 +1269,7 @@ jffs_scan_flash(struct jffs_control *c) | |||
1269 | DJM(no_jffs_node--); | 1269 | DJM(no_jffs_node--); |
1270 | 1270 | ||
1271 | /* Free read buffer */ | 1271 | /* Free read buffer */ |
1272 | kfree (read_buf); | 1272 | kfree(read_buf); |
1273 | 1273 | ||
1274 | /* Release the flash device */ | 1274 | /* Release the flash device */ |
1275 | flash_safe_release(fmc->mtd); | 1275 | flash_safe_release(fmc->mtd); |
@@ -1296,7 +1296,7 @@ jffs_scan_flash(struct jffs_control *c) | |||
1296 | flash_safe_release(fmc->flash_part); | 1296 | flash_safe_release(fmc->flash_part); |
1297 | 1297 | ||
1298 | /* Free read buffer */ | 1298 | /* Free read buffer */ |
1299 | kfree (read_buf); | 1299 | kfree(read_buf); |
1300 | 1300 | ||
1301 | return -ENOMEM; | 1301 | return -ENOMEM; |
1302 | } | 1302 | } |
@@ -1324,7 +1324,7 @@ jffs_scan_flash(struct jffs_control *c) | |||
1324 | jffs_build_end(fmc); | 1324 | jffs_build_end(fmc); |
1325 | 1325 | ||
1326 | /* Free read buffer */ | 1326 | /* Free read buffer */ |
1327 | kfree (read_buf); | 1327 | kfree(read_buf); |
1328 | 1328 | ||
1329 | if(!num_free_space){ | 1329 | if(!num_free_space){ |
1330 | printk(KERN_WARNING "jffs_scan_flash(): Did not find even a single " | 1330 | printk(KERN_WARNING "jffs_scan_flash(): Did not find even a single " |
@@ -1747,9 +1747,7 @@ jffs_find_child(struct jffs_file *dir, const char *name, int len) | |||
1747 | } | 1747 | } |
1748 | printk("jffs_find_child(): Didn't find the file \"%s\".\n", | 1748 | printk("jffs_find_child(): Didn't find the file \"%s\".\n", |
1749 | (copy ? copy : "")); | 1749 | (copy ? copy : "")); |
1750 | if (copy) { | 1750 | kfree(copy); |
1751 | kfree(copy); | ||
1752 | } | ||
1753 | }); | 1751 | }); |
1754 | 1752 | ||
1755 | return f; | 1753 | return f; |
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c index 242cd53a970c..4cebf0e57c46 100644 --- a/fs/jffs2/wbuf.c +++ b/fs/jffs2/wbuf.c | |||
@@ -326,8 +326,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) | |||
326 | c->wbuf_ofs = ofs + towrite; | 326 | c->wbuf_ofs = ofs + towrite; |
327 | memmove(c->wbuf, rewrite_buf + towrite, c->wbuf_len); | 327 | memmove(c->wbuf, rewrite_buf + towrite, c->wbuf_len); |
328 | /* Don't muck about with c->wbuf_inodes. False positives are harmless. */ | 328 | /* Don't muck about with c->wbuf_inodes. False positives are harmless. */ |
329 | if (buf) | 329 | kfree(buf); |
330 | kfree(buf); | ||
331 | } else { | 330 | } else { |
332 | /* OK, now we're left with the dregs in whichever buffer we're using */ | 331 | /* OK, now we're left with the dregs in whichever buffer we're using */ |
333 | if (buf) { | 332 | if (buf) { |
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 87332f30141b..c5a33648e9fd 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -112,8 +112,7 @@ static struct nlm_lockowner *nlm_find_lockowner(struct nlm_host *host, fl_owner_ | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | spin_unlock(&host->h_lock); | 114 | spin_unlock(&host->h_lock); |
115 | if (new != NULL) | 115 | kfree(new); |
116 | kfree(new); | ||
117 | return res; | 116 | return res; |
118 | } | 117 | } |
119 | 118 | ||
diff --git a/fs/mbcache.c b/fs/mbcache.c index 298997f17475..0f1e4530670f 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c | |||
@@ -301,8 +301,7 @@ fail: | |||
301 | if (cache) { | 301 | if (cache) { |
302 | while (--m >= 0) | 302 | while (--m >= 0) |
303 | kfree(cache->c_indexes_hash[m]); | 303 | kfree(cache->c_indexes_hash[m]); |
304 | if (cache->c_block_hash) | 304 | kfree(cache->c_block_hash); |
305 | kfree(cache->c_block_hash); | ||
306 | kfree(cache); | 305 | kfree(cache); |
307 | } | 306 | } |
308 | return NULL; | 307 | return NULL; |
diff --git a/fs/namei.c b/fs/namei.c index c5769c4fcab1..b3f8a1966c9c 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1459,7 +1459,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) | |||
1459 | if (!error) { | 1459 | if (!error) { |
1460 | DQUOT_INIT(inode); | 1460 | DQUOT_INIT(inode); |
1461 | 1461 | ||
1462 | error = do_truncate(dentry, 0); | 1462 | error = do_truncate(dentry, 0, NULL); |
1463 | } | 1463 | } |
1464 | put_write_access(inode); | 1464 | put_write_access(inode); |
1465 | if (error) | 1465 | if (error) |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 3976c177a7d0..618a327027b3 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -149,8 +149,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct | |||
149 | } | 149 | } |
150 | } | 150 | } |
151 | spin_unlock(&clp->cl_lock); | 151 | spin_unlock(&clp->cl_lock); |
152 | if (delegation != NULL) | 152 | kfree(delegation); |
153 | kfree(delegation); | ||
154 | return status; | 153 | return status; |
155 | } | 154 | } |
156 | 155 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 24d2fbf549bd..6391d8964214 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1688,8 +1688,7 @@ static void nfs_kill_super(struct super_block *s) | |||
1688 | 1688 | ||
1689 | rpciod_down(); /* release rpciod */ | 1689 | rpciod_down(); /* release rpciod */ |
1690 | 1690 | ||
1691 | if (server->hostname != NULL) | 1691 | kfree(server->hostname); |
1692 | kfree(server->hostname); | ||
1693 | kfree(server); | 1692 | kfree(server); |
1694 | } | 1693 | } |
1695 | 1694 | ||
@@ -1908,8 +1907,7 @@ nfs_copy_user_string(char *dst, struct nfs_string *src, int maxlen) | |||
1908 | return ERR_PTR(-ENOMEM); | 1907 | return ERR_PTR(-ENOMEM); |
1909 | } | 1908 | } |
1910 | if (copy_from_user(dst, src->data, maxlen)) { | 1909 | if (copy_from_user(dst, src->data, maxlen)) { |
1911 | if (p != NULL) | 1910 | kfree(p); |
1912 | kfree(p); | ||
1913 | return ERR_PTR(-EFAULT); | 1911 | return ERR_PTR(-EFAULT); |
1914 | } | 1912 | } |
1915 | dst[maxlen] = '\0'; | 1913 | dst[maxlen] = '\0'; |
@@ -2000,10 +1998,8 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type, | |||
2000 | out_err: | 1998 | out_err: |
2001 | s = (struct super_block *)p; | 1999 | s = (struct super_block *)p; |
2002 | out_free: | 2000 | out_free: |
2003 | if (server->mnt_path) | 2001 | kfree(server->mnt_path); |
2004 | kfree(server->mnt_path); | 2002 | kfree(server->hostname); |
2005 | if (server->hostname) | ||
2006 | kfree(server->hostname); | ||
2007 | kfree(server); | 2003 | kfree(server); |
2008 | return s; | 2004 | return s; |
2009 | } | 2005 | } |
@@ -2023,8 +2019,7 @@ static void nfs4_kill_super(struct super_block *sb) | |||
2023 | 2019 | ||
2024 | destroy_nfsv4_state(server); | 2020 | destroy_nfsv4_state(server); |
2025 | 2021 | ||
2026 | if (server->hostname != NULL) | 2022 | kfree(server->hostname); |
2027 | kfree(server->hostname); | ||
2028 | kfree(server); | 2023 | kfree(server); |
2029 | } | 2024 | } |
2030 | 2025 | ||
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 52a26baa114c..0675f3215e0a 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -69,10 +69,8 @@ init_nfsv4_state(struct nfs_server *server) | |||
69 | void | 69 | void |
70 | destroy_nfsv4_state(struct nfs_server *server) | 70 | destroy_nfsv4_state(struct nfs_server *server) |
71 | { | 71 | { |
72 | if (server->mnt_path) { | 72 | kfree(server->mnt_path); |
73 | kfree(server->mnt_path); | 73 | server->mnt_path = NULL; |
74 | server->mnt_path = NULL; | ||
75 | } | ||
76 | if (server->nfs4_state) { | 74 | if (server->nfs4_state) { |
77 | nfs4_put_client(server->nfs4_state); | 75 | nfs4_put_client(server->nfs4_state); |
78 | server->nfs4_state = NULL; | 76 | server->nfs4_state = NULL; |
@@ -311,8 +309,7 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct | |||
311 | new = NULL; | 309 | new = NULL; |
312 | } | 310 | } |
313 | spin_unlock(&clp->cl_lock); | 311 | spin_unlock(&clp->cl_lock); |
314 | if (new) | 312 | kfree(new); |
315 | kfree(new); | ||
316 | if (sp != NULL) | 313 | if (sp != NULL) |
317 | return sp; | 314 | return sp; |
318 | put_rpccred(cred); | 315 | put_rpccred(cred); |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index f732541a3332..d639d172d568 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -52,8 +52,7 @@ nfs_put_unlinkdata(struct nfs_unlinkdata *data) | |||
52 | { | 52 | { |
53 | if (--data->count == 0) { | 53 | if (--data->count == 0) { |
54 | nfs_detach_unlinkdata(data); | 54 | nfs_detach_unlinkdata(data); |
55 | if (data->name.name != NULL) | 55 | kfree(data->name.name); |
56 | kfree(data->name.name); | ||
57 | kfree(data); | 56 | kfree(data); |
58 | } | 57 | } |
59 | } | 58 | } |
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 057aff745506..417ec02df44f 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -190,8 +190,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
190 | out: | 190 | out: |
191 | if (dom) | 191 | if (dom) |
192 | auth_domain_put(dom); | 192 | auth_domain_put(dom); |
193 | if (buf) | 193 | kfree(buf); |
194 | kfree(buf); | ||
195 | return err; | 194 | return err; |
196 | } | 195 | } |
197 | 196 | ||
@@ -428,8 +427,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
428 | path_release(&nd); | 427 | path_release(&nd); |
429 | if (dom) | 428 | if (dom) |
430 | auth_domain_put(dom); | 429 | auth_domain_put(dom); |
431 | if (buf) | 430 | kfree(buf); |
432 | kfree(buf); | ||
433 | return err; | 431 | return err; |
434 | } | 432 | } |
435 | 433 | ||
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index e0e134d6baba..9147b8524d05 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -366,7 +366,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, | |||
366 | len = args->len = ntohl(*p++); | 366 | len = args->len = ntohl(*p++); |
367 | 367 | ||
368 | hdr = (void*)p - rqstp->rq_arg.head[0].iov_base; | 368 | hdr = (void*)p - rqstp->rq_arg.head[0].iov_base; |
369 | if (rqstp->rq_arg.len < len + hdr) | 369 | if (rqstp->rq_arg.len < hdr || |
370 | rqstp->rq_arg.len - hdr < len) | ||
370 | return 0; | 371 | return 0; |
371 | 372 | ||
372 | args->vec[0].iov_base = (void*)p; | 373 | args->vec[0].iov_base = (void*)p; |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 4c4146350236..dcd673186944 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -151,8 +151,7 @@ static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) | |||
151 | if (nbytes <= sizeof(argp->tmp)) | 151 | if (nbytes <= sizeof(argp->tmp)) |
152 | p = argp->tmp; | 152 | p = argp->tmp; |
153 | else { | 153 | else { |
154 | if (argp->tmpp) | 154 | kfree(argp->tmpp); |
155 | kfree(argp->tmpp); | ||
156 | p = argp->tmpp = kmalloc(nbytes, GFP_KERNEL); | 155 | p = argp->tmpp = kmalloc(nbytes, GFP_KERNEL); |
157 | if (!p) | 156 | if (!p) |
158 | return NULL; | 157 | return NULL; |
@@ -2476,10 +2475,8 @@ void nfsd4_release_compoundargs(struct nfsd4_compoundargs *args) | |||
2476 | kfree(args->ops); | 2475 | kfree(args->ops); |
2477 | args->ops = args->iops; | 2476 | args->ops = args->iops; |
2478 | } | 2477 | } |
2479 | if (args->tmpp) { | 2478 | kfree(args->tmpp); |
2480 | kfree(args->tmpp); | 2479 | args->tmpp = NULL; |
2481 | args->tmpp = NULL; | ||
2482 | } | ||
2483 | while (args->to_free) { | 2480 | while (args->to_free) { |
2484 | struct tmpbuf *tb = args->to_free; | 2481 | struct tmpbuf *tb = args->to_free; |
2485 | args->to_free = tb->next; | 2482 | args->to_free = tb->next; |
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 119e4d4495b8..d852ebb538e3 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -93,8 +93,7 @@ nfsd_cache_shutdown(void) | |||
93 | 93 | ||
94 | cache_disabled = 1; | 94 | cache_disabled = 1; |
95 | 95 | ||
96 | if (hash_list) | 96 | kfree (hash_list); |
97 | kfree (hash_list); | ||
98 | hash_list = NULL; | 97 | hash_list = NULL; |
99 | } | 98 | } |
100 | 99 | ||
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 841c562991e8..a0871b3efeb7 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/seq_file.h> | 23 | #include <linux/seq_file.h> |
24 | #include <linux/pagemap.h> | 24 | #include <linux/pagemap.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/string.h> | ||
26 | 27 | ||
27 | #include <linux/nfs.h> | 28 | #include <linux/nfs.h> |
28 | #include <linux/nfsd_idmap.h> | 29 | #include <linux/nfsd_idmap.h> |
@@ -35,6 +36,8 @@ | |||
35 | 36 | ||
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | 38 | ||
39 | unsigned int nfsd_versbits = ~0; | ||
40 | |||
38 | /* | 41 | /* |
39 | * We have a single directory with 9 nodes in it. | 42 | * We have a single directory with 9 nodes in it. |
40 | */ | 43 | */ |
@@ -50,8 +53,15 @@ enum { | |||
50 | NFSD_List, | 53 | NFSD_List, |
51 | NFSD_Fh, | 54 | NFSD_Fh, |
52 | NFSD_Threads, | 55 | NFSD_Threads, |
56 | NFSD_Versions, | ||
57 | /* | ||
58 | * The below MUST come last. Otherwise we leave a hole in nfsd_files[] | ||
59 | * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops | ||
60 | */ | ||
61 | #ifdef CONFIG_NFSD_V4 | ||
53 | NFSD_Leasetime, | 62 | NFSD_Leasetime, |
54 | NFSD_RecoveryDir, | 63 | NFSD_RecoveryDir, |
64 | #endif | ||
55 | }; | 65 | }; |
56 | 66 | ||
57 | /* | 67 | /* |
@@ -66,8 +76,11 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size); | |||
66 | static ssize_t write_getfs(struct file *file, char *buf, size_t size); | 76 | static ssize_t write_getfs(struct file *file, char *buf, size_t size); |
67 | static ssize_t write_filehandle(struct file *file, char *buf, size_t size); | 77 | static ssize_t write_filehandle(struct file *file, char *buf, size_t size); |
68 | static ssize_t write_threads(struct file *file, char *buf, size_t size); | 78 | static ssize_t write_threads(struct file *file, char *buf, size_t size); |
79 | static ssize_t write_versions(struct file *file, char *buf, size_t size); | ||
80 | #ifdef CONFIG_NFSD_V4 | ||
69 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size); | 81 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size); |
70 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); | 82 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); |
83 | #endif | ||
71 | 84 | ||
72 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { | 85 | static ssize_t (*write_op[])(struct file *, char *, size_t) = { |
73 | [NFSD_Svc] = write_svc, | 86 | [NFSD_Svc] = write_svc, |
@@ -79,8 +92,11 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { | |||
79 | [NFSD_Getfs] = write_getfs, | 92 | [NFSD_Getfs] = write_getfs, |
80 | [NFSD_Fh] = write_filehandle, | 93 | [NFSD_Fh] = write_filehandle, |
81 | [NFSD_Threads] = write_threads, | 94 | [NFSD_Threads] = write_threads, |
95 | [NFSD_Versions] = write_versions, | ||
96 | #ifdef CONFIG_NFSD_V4 | ||
82 | [NFSD_Leasetime] = write_leasetime, | 97 | [NFSD_Leasetime] = write_leasetime, |
83 | [NFSD_RecoveryDir] = write_recoverydir, | 98 | [NFSD_RecoveryDir] = write_recoverydir, |
99 | #endif | ||
84 | }; | 100 | }; |
85 | 101 | ||
86 | static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) | 102 | static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) |
@@ -104,9 +120,23 @@ static ssize_t nfsctl_transaction_write(struct file *file, const char __user *bu | |||
104 | return rv; | 120 | return rv; |
105 | } | 121 | } |
106 | 122 | ||
123 | static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos) | ||
124 | { | ||
125 | if (! file->private_data) { | ||
126 | /* An attempt to read a transaction file without writing | ||
127 | * causes a 0-byte write so that the file can return | ||
128 | * state information | ||
129 | */ | ||
130 | ssize_t rv = nfsctl_transaction_write(file, buf, 0, pos); | ||
131 | if (rv < 0) | ||
132 | return rv; | ||
133 | } | ||
134 | return simple_transaction_read(file, buf, size, pos); | ||
135 | } | ||
136 | |||
107 | static struct file_operations transaction_ops = { | 137 | static struct file_operations transaction_ops = { |
108 | .write = nfsctl_transaction_write, | 138 | .write = nfsctl_transaction_write, |
109 | .read = simple_transaction_read, | 139 | .read = nfsctl_transaction_read, |
110 | .release = simple_transaction_release, | 140 | .release = simple_transaction_release, |
111 | }; | 141 | }; |
112 | 142 | ||
@@ -329,6 +359,70 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size) | |||
329 | return strlen(buf); | 359 | return strlen(buf); |
330 | } | 360 | } |
331 | 361 | ||
362 | static ssize_t write_versions(struct file *file, char *buf, size_t size) | ||
363 | { | ||
364 | /* | ||
365 | * Format: | ||
366 | * [-/+]vers [-/+]vers ... | ||
367 | */ | ||
368 | char *mesg = buf; | ||
369 | char *vers, sign; | ||
370 | int len, num; | ||
371 | ssize_t tlen = 0; | ||
372 | char *sep; | ||
373 | |||
374 | if (size>0) { | ||
375 | if (nfsd_serv) | ||
376 | return -EBUSY; | ||
377 | if (buf[size-1] != '\n') | ||
378 | return -EINVAL; | ||
379 | buf[size-1] = 0; | ||
380 | |||
381 | vers = mesg; | ||
382 | len = qword_get(&mesg, vers, size); | ||
383 | if (len <= 0) return -EINVAL; | ||
384 | do { | ||
385 | sign = *vers; | ||
386 | if (sign == '+' || sign == '-') | ||
387 | num = simple_strtol((vers+1), NULL, 0); | ||
388 | else | ||
389 | num = simple_strtol(vers, NULL, 0); | ||
390 | switch(num) { | ||
391 | case 2: | ||
392 | case 3: | ||
393 | case 4: | ||
394 | if (sign != '-') | ||
395 | NFSCTL_VERSET(nfsd_versbits, num); | ||
396 | else | ||
397 | NFSCTL_VERUNSET(nfsd_versbits, num); | ||
398 | break; | ||
399 | default: | ||
400 | return -EINVAL; | ||
401 | } | ||
402 | vers += len + 1; | ||
403 | tlen += len; | ||
404 | } while ((len = qword_get(&mesg, vers, size)) > 0); | ||
405 | /* If all get turned off, turn them back on, as | ||
406 | * having no versions is BAD | ||
407 | */ | ||
408 | if ((nfsd_versbits & NFSCTL_VERALL)==0) | ||
409 | nfsd_versbits = NFSCTL_VERALL; | ||
410 | } | ||
411 | /* Now write current state into reply buffer */ | ||
412 | len = 0; | ||
413 | sep = ""; | ||
414 | for (num=2 ; num <= 4 ; num++) | ||
415 | if (NFSCTL_VERISSET(NFSCTL_VERALL, num)) { | ||
416 | len += sprintf(buf+len, "%s%c%d", sep, | ||
417 | NFSCTL_VERISSET(nfsd_versbits, num)?'+':'-', | ||
418 | num); | ||
419 | sep = " "; | ||
420 | } | ||
421 | len += sprintf(buf+len, "\n"); | ||
422 | return len; | ||
423 | } | ||
424 | |||
425 | #ifdef CONFIG_NFSD_V4 | ||
332 | extern time_t nfs4_leasetime(void); | 426 | extern time_t nfs4_leasetime(void); |
333 | 427 | ||
334 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size) | 428 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size) |
@@ -370,6 +464,7 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) | |||
370 | status = nfs4_reset_recoverydir(recdir); | 464 | status = nfs4_reset_recoverydir(recdir); |
371 | return strlen(buf); | 465 | return strlen(buf); |
372 | } | 466 | } |
467 | #endif | ||
373 | 468 | ||
374 | /*----------------------------------------------------------------------------*/ | 469 | /*----------------------------------------------------------------------------*/ |
375 | /* | 470 | /* |
@@ -389,6 +484,7 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
389 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, | 484 | [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, |
390 | [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, | 485 | [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, |
391 | [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, | 486 | [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, |
487 | [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, | ||
392 | #ifdef CONFIG_NFSD_V4 | 488 | #ifdef CONFIG_NFSD_V4 |
393 | [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, | 489 | [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, |
394 | [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, | 490 | [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, |
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 1697539a7171..89ed04696865 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/nfsd/nfsd.h> | 30 | #include <linux/nfsd/nfsd.h> |
31 | #include <linux/nfsd/stats.h> | 31 | #include <linux/nfsd/stats.h> |
32 | #include <linux/nfsd/cache.h> | 32 | #include <linux/nfsd/cache.h> |
33 | #include <linux/nfsd/syscall.h> | ||
33 | #include <linux/lockd/bind.h> | 34 | #include <linux/lockd/bind.h> |
34 | #include <linux/nfsacl.h> | 35 | #include <linux/nfsacl.h> |
35 | 36 | ||
@@ -52,7 +53,7 @@ | |||
52 | extern struct svc_program nfsd_program; | 53 | extern struct svc_program nfsd_program; |
53 | static void nfsd(struct svc_rqst *rqstp); | 54 | static void nfsd(struct svc_rqst *rqstp); |
54 | struct timeval nfssvc_boot; | 55 | struct timeval nfssvc_boot; |
55 | static struct svc_serv *nfsd_serv; | 56 | struct svc_serv *nfsd_serv; |
56 | static atomic_t nfsd_busy; | 57 | static atomic_t nfsd_busy; |
57 | static unsigned long nfsd_last_call; | 58 | static unsigned long nfsd_last_call; |
58 | static DEFINE_SPINLOCK(nfsd_call_lock); | 59 | static DEFINE_SPINLOCK(nfsd_call_lock); |
@@ -63,6 +64,31 @@ struct nfsd_list { | |||
63 | }; | 64 | }; |
64 | static struct list_head nfsd_list = LIST_HEAD_INIT(nfsd_list); | 65 | static struct list_head nfsd_list = LIST_HEAD_INIT(nfsd_list); |
65 | 66 | ||
67 | static struct svc_version * nfsd_version[] = { | ||
68 | [2] = &nfsd_version2, | ||
69 | #if defined(CONFIG_NFSD_V3) | ||
70 | [3] = &nfsd_version3, | ||
71 | #endif | ||
72 | #if defined(CONFIG_NFSD_V4) | ||
73 | [4] = &nfsd_version4, | ||
74 | #endif | ||
75 | }; | ||
76 | |||
77 | #define NFSD_MINVERS 2 | ||
78 | #define NFSD_NRVERS (sizeof(nfsd_version)/sizeof(nfsd_version[0])) | ||
79 | static struct svc_version *nfsd_versions[NFSD_NRVERS]; | ||
80 | |||
81 | struct svc_program nfsd_program = { | ||
82 | .pg_prog = NFS_PROGRAM, /* program number */ | ||
83 | .pg_nvers = NFSD_NRVERS, /* nr of entries in nfsd_version */ | ||
84 | .pg_vers = nfsd_versions, /* version table */ | ||
85 | .pg_name = "nfsd", /* program name */ | ||
86 | .pg_class = "nfsd", /* authentication class */ | ||
87 | .pg_stats = &nfsd_svcstats, /* version table */ | ||
88 | .pg_authenticate = &svc_set_client, /* export authentication */ | ||
89 | |||
90 | }; | ||
91 | |||
66 | /* | 92 | /* |
67 | * Maximum number of nfsd processes | 93 | * Maximum number of nfsd processes |
68 | */ | 94 | */ |
@@ -80,11 +106,12 @@ int | |||
80 | nfsd_svc(unsigned short port, int nrservs) | 106 | nfsd_svc(unsigned short port, int nrservs) |
81 | { | 107 | { |
82 | int error; | 108 | int error; |
83 | int none_left; | 109 | int none_left, found_one, i; |
84 | struct list_head *victim; | 110 | struct list_head *victim; |
85 | 111 | ||
86 | lock_kernel(); | 112 | lock_kernel(); |
87 | dprintk("nfsd: creating service\n"); | 113 | dprintk("nfsd: creating service: vers 0x%x\n", |
114 | nfsd_versbits); | ||
88 | error = -EINVAL; | 115 | error = -EINVAL; |
89 | if (nrservs <= 0) | 116 | if (nrservs <= 0) |
90 | nrservs = 0; | 117 | nrservs = 0; |
@@ -99,6 +126,27 @@ nfsd_svc(unsigned short port, int nrservs) | |||
99 | if (error<0) | 126 | if (error<0) |
100 | goto out; | 127 | goto out; |
101 | if (!nfsd_serv) { | 128 | if (!nfsd_serv) { |
129 | /* | ||
130 | * Use the nfsd_ctlbits to define which | ||
131 | * versions that will be advertised. | ||
132 | * If nfsd_ctlbits doesn't list any version, | ||
133 | * export them all. | ||
134 | */ | ||
135 | found_one = 0; | ||
136 | |||
137 | for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) { | ||
138 | if (NFSCTL_VERISSET(nfsd_versbits, i)) { | ||
139 | nfsd_program.pg_vers[i] = nfsd_version[i]; | ||
140 | found_one = 1; | ||
141 | } else | ||
142 | nfsd_program.pg_vers[i] = NULL; | ||
143 | } | ||
144 | |||
145 | if (!found_one) { | ||
146 | for (i = NFSD_MINVERS; i < NFSD_NRVERS; i++) | ||
147 | nfsd_program.pg_vers[i] = nfsd_version[i]; | ||
148 | } | ||
149 | |||
102 | atomic_set(&nfsd_busy, 0); | 150 | atomic_set(&nfsd_busy, 0); |
103 | error = -ENOMEM; | 151 | error = -ENOMEM; |
104 | nfsd_serv = svc_create(&nfsd_program, NFSD_BUFSIZE); | 152 | nfsd_serv = svc_create(&nfsd_program, NFSD_BUFSIZE); |
@@ -379,6 +427,7 @@ static struct svc_program nfsd_acl_program = { | |||
379 | .pg_name = "nfsd", | 427 | .pg_name = "nfsd", |
380 | .pg_class = "nfsd", | 428 | .pg_class = "nfsd", |
381 | .pg_stats = &nfsd_acl_svcstats, | 429 | .pg_stats = &nfsd_acl_svcstats, |
430 | .pg_authenticate = &svc_set_client, | ||
382 | }; | 431 | }; |
383 | 432 | ||
384 | static struct svc_stat nfsd_acl_svcstats = { | 433 | static struct svc_stat nfsd_acl_svcstats = { |
@@ -389,28 +438,3 @@ static struct svc_stat nfsd_acl_svcstats = { | |||
389 | #else | 438 | #else |
390 | #define nfsd_acl_program_p NULL | 439 | #define nfsd_acl_program_p NULL |
391 | #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ | 440 | #endif /* defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) */ |
392 | |||
393 | extern struct svc_version nfsd_version2, nfsd_version3, nfsd_version4; | ||
394 | |||
395 | static struct svc_version * nfsd_version[] = { | ||
396 | [2] = &nfsd_version2, | ||
397 | #if defined(CONFIG_NFSD_V3) | ||
398 | [3] = &nfsd_version3, | ||
399 | #endif | ||
400 | #if defined(CONFIG_NFSD_V4) | ||
401 | [4] = &nfsd_version4, | ||
402 | #endif | ||
403 | }; | ||
404 | |||
405 | #define NFSD_NRVERS (sizeof(nfsd_version)/sizeof(nfsd_version[0])) | ||
406 | struct svc_program nfsd_program = { | ||
407 | .pg_next = nfsd_acl_program_p, | ||
408 | .pg_prog = NFS_PROGRAM, /* program number */ | ||
409 | .pg_nvers = NFSD_NRVERS, /* nr of entries in nfsd_version */ | ||
410 | .pg_vers = nfsd_version, /* version table */ | ||
411 | .pg_name = "nfsd", /* program name */ | ||
412 | .pg_class = "nfsd", /* authentication class */ | ||
413 | .pg_stats = &nfsd_svcstats, /* version table */ | ||
414 | .pg_authenticate = &svc_set_client, /* export authentication */ | ||
415 | |||
416 | }; | ||
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 4f2cd3d27566..af7c3c3074b0 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -254,12 +254,19 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
254 | 254 | ||
255 | /* Get inode */ | 255 | /* Get inode */ |
256 | err = fh_verify(rqstp, fhp, ftype, accmode); | 256 | err = fh_verify(rqstp, fhp, ftype, accmode); |
257 | if (err || !iap->ia_valid) | 257 | if (err) |
258 | goto out; | 258 | goto out; |
259 | 259 | ||
260 | dentry = fhp->fh_dentry; | 260 | dentry = fhp->fh_dentry; |
261 | inode = dentry->d_inode; | 261 | inode = dentry->d_inode; |
262 | 262 | ||
263 | /* Ignore any mode updates on symlinks */ | ||
264 | if (S_ISLNK(inode->i_mode)) | ||
265 | iap->ia_valid &= ~ATTR_MODE; | ||
266 | |||
267 | if (!iap->ia_valid) | ||
268 | goto out; | ||
269 | |||
263 | /* NFSv2 does not differentiate between "set-[ac]time-to-now" | 270 | /* NFSv2 does not differentiate between "set-[ac]time-to-now" |
264 | * which only requires access, and "set-[ac]time-to-X" which | 271 | * which only requires access, and "set-[ac]time-to-X" which |
265 | * requires ownership. | 272 | * requires ownership. |
@@ -194,7 +194,7 @@ out: | |||
194 | return error; | 194 | return error; |
195 | } | 195 | } |
196 | 196 | ||
197 | int do_truncate(struct dentry *dentry, loff_t length) | 197 | int do_truncate(struct dentry *dentry, loff_t length, struct file *filp) |
198 | { | 198 | { |
199 | int err; | 199 | int err; |
200 | struct iattr newattrs; | 200 | struct iattr newattrs; |
@@ -205,6 +205,10 @@ int do_truncate(struct dentry *dentry, loff_t length) | |||
205 | 205 | ||
206 | newattrs.ia_size = length; | 206 | newattrs.ia_size = length; |
207 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; | 207 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; |
208 | if (filp) { | ||
209 | newattrs.ia_file = filp; | ||
210 | newattrs.ia_valid |= ATTR_FILE; | ||
211 | } | ||
208 | 212 | ||
209 | down(&dentry->d_inode->i_sem); | 213 | down(&dentry->d_inode->i_sem); |
210 | err = notify_change(dentry, &newattrs); | 214 | err = notify_change(dentry, &newattrs); |
@@ -262,7 +266,7 @@ static inline long do_sys_truncate(const char __user * path, loff_t length) | |||
262 | error = locks_verify_truncate(inode, NULL, length); | 266 | error = locks_verify_truncate(inode, NULL, length); |
263 | if (!error) { | 267 | if (!error) { |
264 | DQUOT_INIT(inode); | 268 | DQUOT_INIT(inode); |
265 | error = do_truncate(nd.dentry, length); | 269 | error = do_truncate(nd.dentry, length, NULL); |
266 | } | 270 | } |
267 | put_write_access(inode); | 271 | put_write_access(inode); |
268 | 272 | ||
@@ -314,7 +318,7 @@ static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small) | |||
314 | 318 | ||
315 | error = locks_verify_truncate(inode, file, length); | 319 | error = locks_verify_truncate(inode, file, length); |
316 | if (!error) | 320 | if (!error) |
317 | error = do_truncate(dentry, length); | 321 | error = do_truncate(dentry, length, file); |
318 | out_putf: | 322 | out_putf: |
319 | fput(file); | 323 | fput(file); |
320 | out: | 324 | out: |
@@ -887,6 +891,10 @@ struct file *nameidata_to_filp(struct nameidata *nd, int flags) | |||
887 | return filp; | 891 | return filp; |
888 | } | 892 | } |
889 | 893 | ||
894 | /* | ||
895 | * dentry_open() will have done dput(dentry) and mntput(mnt) if it returns an | ||
896 | * error. | ||
897 | */ | ||
890 | struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) | 898 | struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) |
891 | { | 899 | { |
892 | int error; | 900 | int error; |
@@ -894,8 +902,11 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags) | |||
894 | 902 | ||
895 | error = -ENFILE; | 903 | error = -ENFILE; |
896 | f = get_empty_filp(); | 904 | f = get_empty_filp(); |
897 | if (f == NULL) | 905 | if (f == NULL) { |
906 | dput(dentry); | ||
907 | mntput(mnt); | ||
898 | return ERR_PTR(error); | 908 | return ERR_PTR(error); |
909 | } | ||
899 | 910 | ||
900 | return __dentry_open(dentry, mnt, flags, f, NULL); | 911 | return __dentry_open(dentry, mnt, flags, f, NULL); |
901 | } | 912 | } |
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index 1be11ce96b0f..aeb0106890e4 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c | |||
@@ -1088,8 +1088,7 @@ static void __exit exit_openprom_fs(void) | |||
1088 | unregister_filesystem(&openprom_fs_type); | 1088 | unregister_filesystem(&openprom_fs_type); |
1089 | free_pages ((unsigned long)nodes, alloced); | 1089 | free_pages ((unsigned long)nodes, alloced); |
1090 | for (i = 0; i < aliases_nodes; i++) | 1090 | for (i = 0; i < aliases_nodes; i++) |
1091 | if (alias_names [i]) | 1091 | kfree (alias_names [i]); |
1092 | kfree (alias_names [i]); | ||
1093 | nodes = NULL; | 1092 | nodes = NULL; |
1094 | } | 1093 | } |
1095 | 1094 | ||
diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c index d59dcbf2bd4a..6327bcb2d73d 100644 --- a/fs/partitions/ibm.c +++ b/fs/partitions/ibm.c | |||
@@ -29,7 +29,7 @@ | |||
29 | * cyl-cyl-head-head structure | 29 | * cyl-cyl-head-head structure |
30 | */ | 30 | */ |
31 | static inline int | 31 | static inline int |
32 | cchh2blk (cchh_t *ptr, struct hd_geometry *geo) { | 32 | cchh2blk (struct vtoc_cchh *ptr, struct hd_geometry *geo) { |
33 | return ptr->cc * geo->heads * geo->sectors + | 33 | return ptr->cc * geo->heads * geo->sectors + |
34 | ptr->hh * geo->sectors; | 34 | ptr->hh * geo->sectors; |
35 | } | 35 | } |
@@ -40,7 +40,7 @@ cchh2blk (cchh_t *ptr, struct hd_geometry *geo) { | |||
40 | * cyl-cyl-head-head-block structure | 40 | * cyl-cyl-head-head-block structure |
41 | */ | 41 | */ |
42 | static inline int | 42 | static inline int |
43 | cchhb2blk (cchhb_t *ptr, struct hd_geometry *geo) { | 43 | cchhb2blk (struct vtoc_cchhb *ptr, struct hd_geometry *geo) { |
44 | return ptr->cc * geo->heads * geo->sectors + | 44 | return ptr->cc * geo->heads * geo->sectors + |
45 | ptr->hh * geo->sectors + | 45 | ptr->hh * geo->sectors + |
46 | ptr->b; | 46 | ptr->b; |
@@ -56,7 +56,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
56 | struct hd_geometry *geo; | 56 | struct hd_geometry *geo; |
57 | char type[5] = {0,}; | 57 | char type[5] = {0,}; |
58 | char name[7] = {0,}; | 58 | char name[7] = {0,}; |
59 | volume_label_t *vlabel; | 59 | struct vtoc_volume_label *vlabel; |
60 | unsigned char *data; | 60 | unsigned char *data; |
61 | Sector sect; | 61 | Sector sect; |
62 | 62 | ||
@@ -64,7 +64,8 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
64 | goto out_noinfo; | 64 | goto out_noinfo; |
65 | if ((geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL)) == NULL) | 65 | if ((geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL)) == NULL) |
66 | goto out_nogeo; | 66 | goto out_nogeo; |
67 | if ((vlabel = kmalloc(sizeof(volume_label_t), GFP_KERNEL)) == NULL) | 67 | if ((vlabel = kmalloc(sizeof(struct vtoc_volume_label), |
68 | GFP_KERNEL)) == NULL) | ||
68 | goto out_novlab; | 69 | goto out_novlab; |
69 | 70 | ||
70 | if (ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)info) != 0 || | 71 | if (ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)info) != 0 || |
@@ -86,7 +87,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
86 | strncpy(name, data + 8, 6); | 87 | strncpy(name, data + 8, 6); |
87 | else | 88 | else |
88 | strncpy(name, data + 4, 6); | 89 | strncpy(name, data + 4, 6); |
89 | memcpy (vlabel, data, sizeof(volume_label_t)); | 90 | memcpy (vlabel, data, sizeof(struct vtoc_volume_label)); |
90 | put_dev_sector(sect); | 91 | put_dev_sector(sect); |
91 | 92 | ||
92 | EBCASC(type, 4); | 93 | EBCASC(type, 4); |
@@ -129,9 +130,9 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev) | |||
129 | counter = 0; | 130 | counter = 0; |
130 | while ((data = read_dev_sector(bdev, blk*(blocksize/512), | 131 | while ((data = read_dev_sector(bdev, blk*(blocksize/512), |
131 | §)) != NULL) { | 132 | §)) != NULL) { |
132 | format1_label_t f1; | 133 | struct vtoc_format1_label f1; |
133 | 134 | ||
134 | memcpy(&f1, data, sizeof(format1_label_t)); | 135 | memcpy(&f1, data, sizeof(struct vtoc_format1_label)); |
135 | put_dev_sector(sect); | 136 | put_dev_sector(sect); |
136 | 137 | ||
137 | /* skip FMT4 / FMT5 / FMT7 labels */ | 138 | /* skip FMT4 / FMT5 / FMT7 labels */ |
diff --git a/fs/quota.c b/fs/quota.c index 1df7832b4e08..612e04db4b93 100644 --- a/fs/quota.c +++ b/fs/quota.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/security.h> | 15 | #include <linux/security.h> |
16 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
17 | #include <linux/buffer_head.h> | 17 | #include <linux/buffer_head.h> |
18 | #include <linux/quotaops.h> | ||
18 | 19 | ||
19 | /* Check validity of generic quotactl commands */ | 20 | /* Check validity of generic quotactl commands */ |
20 | static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id) | 21 | static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id) |
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c index 2d85dd7415bb..a0f296d9928a 100644 --- a/fs/smbfs/request.c +++ b/fs/smbfs/request.c | |||
@@ -786,8 +786,7 @@ int smb_request_recv(struct smb_sb_info *server) | |||
786 | /* We should never be called with any of these states */ | 786 | /* We should never be called with any of these states */ |
787 | case SMB_RECV_END: | 787 | case SMB_RECV_END: |
788 | case SMB_RECV_REQUEST: | 788 | case SMB_RECV_REQUEST: |
789 | server->rstate = SMB_RECV_END; | 789 | BUG(); |
790 | break; | ||
791 | } | 790 | } |
792 | 791 | ||
793 | if (result < 0) { | 792 | if (result < 0) { |
diff --git a/fs/smbfs/symlink.c b/fs/smbfs/symlink.c index 0c64bc3a0127..cdc53c4fb381 100644 --- a/fs/smbfs/symlink.c +++ b/fs/smbfs/symlink.c | |||
@@ -45,7 +45,7 @@ static void *smb_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
45 | int len = smb_proc_read_link(server_from_dentry(dentry), | 45 | int len = smb_proc_read_link(server_from_dentry(dentry), |
46 | dentry, link, PATH_MAX - 1); | 46 | dentry, link, PATH_MAX - 1); |
47 | if (len < 0) { | 47 | if (len < 0) { |
48 | putname(link); | 48 | __putname(link); |
49 | link = ERR_PTR(len); | 49 | link = ERR_PTR(len); |
50 | } else { | 50 | } else { |
51 | link[len] = 0; | 51 | link[len] = 0; |
@@ -59,7 +59,7 @@ static void smb_put_link(struct dentry *dentry, struct nameidata *nd, void *p) | |||
59 | { | 59 | { |
60 | char *s = nd_get_link(nd); | 60 | char *s = nd_get_link(nd); |
61 | if (!IS_ERR(s)) | 61 | if (!IS_ERR(s)) |
62 | putname(s); | 62 | __putname(s); |
63 | } | 63 | } |
64 | 64 | ||
65 | struct inode_operations smb_link_inode_operations = | 65 | struct inode_operations smb_link_inode_operations = |
diff --git a/fs/super.c b/fs/super.c index f60155ec7780..eed6c3132905 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -474,8 +474,6 @@ rescan: | |||
474 | return NULL; | 474 | return NULL; |
475 | } | 475 | } |
476 | 476 | ||
477 | EXPORT_SYMBOL(user_get_super); | ||
478 | |||
479 | asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf) | 477 | asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf) |
480 | { | 478 | { |
481 | struct super_block *s; | 479 | struct super_block *s; |
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 0e54922daa09..663669810be6 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h | |||
@@ -39,8 +39,7 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb) | |||
39 | {\ | 39 | {\ |
40 | if (UDF_SB(X))\ | 40 | if (UDF_SB(X))\ |
41 | {\ | 41 | {\ |
42 | if (UDF_SB_PARTMAPS(X))\ | 42 | kfree(UDF_SB_PARTMAPS(X));\ |
43 | kfree(UDF_SB_PARTMAPS(X));\ | ||
44 | UDF_SB_PARTMAPS(X) = NULL;\ | 43 | UDF_SB_PARTMAPS(X) = NULL;\ |
45 | }\ | 44 | }\ |
46 | } | 45 | } |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index f036d694ba5a..54828ebcf1ba 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -472,13 +472,14 @@ static int ufs_read_cylinder_structures (struct super_block *sb) { | |||
472 | return 1; | 472 | return 1; |
473 | 473 | ||
474 | failed: | 474 | failed: |
475 | if (base) kfree (base); | 475 | kfree (base); |
476 | if (sbi->s_ucg) { | 476 | if (sbi->s_ucg) { |
477 | for (i = 0; i < uspi->s_ncg; i++) | 477 | for (i = 0; i < uspi->s_ncg; i++) |
478 | if (sbi->s_ucg[i]) brelse (sbi->s_ucg[i]); | 478 | if (sbi->s_ucg[i]) |
479 | brelse (sbi->s_ucg[i]); | ||
479 | kfree (sbi->s_ucg); | 480 | kfree (sbi->s_ucg); |
480 | for (i = 0; i < UFS_MAX_GROUP_LOADED; i++) | 481 | for (i = 0; i < UFS_MAX_GROUP_LOADED; i++) |
481 | if (sbi->s_ucpi[i]) kfree (sbi->s_ucpi[i]); | 482 | kfree (sbi->s_ucpi[i]); |
482 | } | 483 | } |
483 | UFSD(("EXIT (FAILED)\n")) | 484 | UFSD(("EXIT (FAILED)\n")) |
484 | return 0; | 485 | return 0; |
@@ -981,9 +982,10 @@ magic_found: | |||
981 | dalloc_failed: | 982 | dalloc_failed: |
982 | iput(inode); | 983 | iput(inode); |
983 | failed: | 984 | failed: |
984 | if (ubh) ubh_brelse_uspi (uspi); | 985 | if (ubh) |
985 | if (uspi) kfree (uspi); | 986 | ubh_brelse_uspi (uspi); |
986 | if (sbi) kfree(sbi); | 987 | kfree (uspi); |
988 | kfree(sbi); | ||
987 | sb->s_fs_info = NULL; | 989 | sb->s_fs_info = NULL; |
988 | UFSD(("EXIT (FAILED)\n")) | 990 | UFSD(("EXIT (FAILED)\n")) |
989 | return -EINVAL; | 991 | return -EINVAL; |
diff --git a/fs/xattr.c b/fs/xattr.c index f6e00c0e114f..a9db22557998 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -74,8 +74,7 @@ setxattr(struct dentry *d, char __user *name, void __user *value, | |||
74 | } | 74 | } |
75 | out: | 75 | out: |
76 | up(&d->d_inode->i_sem); | 76 | up(&d->d_inode->i_sem); |
77 | if (kvalue) | 77 | kfree(kvalue); |
78 | kfree(kvalue); | ||
79 | return error; | 78 | return error; |
80 | } | 79 | } |
81 | 80 | ||
@@ -173,8 +172,7 @@ getxattr(struct dentry *d, char __user *name, void __user *value, size_t size) | |||
173 | error = -E2BIG; | 172 | error = -E2BIG; |
174 | } | 173 | } |
175 | out: | 174 | out: |
176 | if (kvalue) | 175 | kfree(kvalue); |
177 | kfree(kvalue); | ||
178 | return error; | 176 | return error; |
179 | } | 177 | } |
180 | 178 | ||
@@ -259,8 +257,7 @@ listxattr(struct dentry *d, char __user *list, size_t size) | |||
259 | error = -E2BIG; | 257 | error = -E2BIG; |
260 | } | 258 | } |
261 | out: | 259 | out: |
262 | if (klist) | 260 | kfree(klist); |
263 | kfree(klist); | ||
264 | return error; | 261 | return error; |
265 | } | 262 | } |
266 | 263 | ||
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h index 8f82c1a20dc5..c64a29cdfff3 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/linux-2.6/kmem.h | |||
@@ -30,8 +30,8 @@ | |||
30 | #define KM_NOFS 0x0004u | 30 | #define KM_NOFS 0x0004u |
31 | #define KM_MAYFAIL 0x0008u | 31 | #define KM_MAYFAIL 0x0008u |
32 | 32 | ||
33 | #define kmem_zone kmem_cache_s | 33 | #define kmem_zone kmem_cache |
34 | #define kmem_zone_t kmem_cache_t | 34 | #define kmem_zone_t struct kmem_cache |
35 | 35 | ||
36 | typedef unsigned long xfs_pflags_t; | 36 | typedef unsigned long xfs_pflags_t; |
37 | 37 | ||