diff options
Diffstat (limited to 'fs')
115 files changed, 1242 insertions, 1070 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 61c599b4a1e3..872943004e59 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -99,12 +99,13 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
99 | * @flags: mount flags | 99 | * @flags: mount flags |
100 | * @dev_name: device name that was mounted | 100 | * @dev_name: device name that was mounted |
101 | * @data: mount options | 101 | * @data: mount options |
102 | * @mnt: mountpoint record to be instantiated | ||
102 | * | 103 | * |
103 | */ | 104 | */ |
104 | 105 | ||
105 | static struct super_block *v9fs_get_sb(struct file_system_type | 106 | static int v9fs_get_sb(struct file_system_type *fs_type, int flags, |
106 | *fs_type, int flags, | 107 | const char *dev_name, void *data, |
107 | const char *dev_name, void *data) | 108 | struct vfsmount *mnt) |
108 | { | 109 | { |
109 | struct super_block *sb = NULL; | 110 | struct super_block *sb = NULL; |
110 | struct v9fs_fcall *fcall = NULL; | 111 | struct v9fs_fcall *fcall = NULL; |
@@ -123,17 +124,19 @@ static struct super_block *v9fs_get_sb(struct file_system_type | |||
123 | 124 | ||
124 | v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); | 125 | v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL); |
125 | if (!v9ses) | 126 | if (!v9ses) |
126 | return ERR_PTR(-ENOMEM); | 127 | return -ENOMEM; |
127 | 128 | ||
128 | if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { | 129 | if ((newfid = v9fs_session_init(v9ses, dev_name, data)) < 0) { |
129 | dprintk(DEBUG_ERROR, "problem initiating session\n"); | 130 | dprintk(DEBUG_ERROR, "problem initiating session\n"); |
130 | sb = ERR_PTR(newfid); | 131 | retval = newfid; |
131 | goto out_free_session; | 132 | goto out_free_session; |
132 | } | 133 | } |
133 | 134 | ||
134 | sb = sget(fs_type, NULL, v9fs_set_super, v9ses); | 135 | sb = sget(fs_type, NULL, v9fs_set_super, v9ses); |
135 | if (IS_ERR(sb)) | 136 | if (IS_ERR(sb)) { |
137 | retval = PTR_ERR(sb); | ||
136 | goto out_close_session; | 138 | goto out_close_session; |
139 | } | ||
137 | v9fs_fill_super(sb, v9ses, flags); | 140 | v9fs_fill_super(sb, v9ses, flags); |
138 | 141 | ||
139 | inode = v9fs_get_inode(sb, S_IFDIR | mode); | 142 | inode = v9fs_get_inode(sb, S_IFDIR | mode); |
@@ -184,19 +187,19 @@ static struct super_block *v9fs_get_sb(struct file_system_type | |||
184 | goto put_back_sb; | 187 | goto put_back_sb; |
185 | } | 188 | } |
186 | 189 | ||
187 | return sb; | 190 | return simple_set_mnt(mnt, sb); |
188 | 191 | ||
189 | out_close_session: | 192 | out_close_session: |
190 | v9fs_session_close(v9ses); | 193 | v9fs_session_close(v9ses); |
191 | out_free_session: | 194 | out_free_session: |
192 | kfree(v9ses); | 195 | kfree(v9ses); |
193 | return sb; | 196 | return retval; |
194 | 197 | ||
195 | put_back_sb: | 198 | put_back_sb: |
196 | /* deactivate_super calls v9fs_kill_super which will frees the rest */ | 199 | /* deactivate_super calls v9fs_kill_super which will frees the rest */ |
197 | up_write(&sb->s_umount); | 200 | up_write(&sb->s_umount); |
198 | deactivate_super(sb); | 201 | deactivate_super(sb); |
199 | return ERR_PTR(retval); | 202 | return retval; |
200 | } | 203 | } |
201 | 204 | ||
202 | /** | 205 | /** |
diff --git a/fs/Kconfig b/fs/Kconfig index 20f9b557732d..2aa4624cc018 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -53,7 +53,7 @@ config EXT2_FS_SECURITY | |||
53 | 53 | ||
54 | config EXT2_FS_XIP | 54 | config EXT2_FS_XIP |
55 | bool "Ext2 execute in place support" | 55 | bool "Ext2 execute in place support" |
56 | depends on EXT2_FS | 56 | depends on EXT2_FS && MMU |
57 | help | 57 | help |
58 | Execute in place can be used on memory-backed block devices. If you | 58 | Execute in place can be used on memory-backed block devices. If you |
59 | enable this option, you can select to mount block devices which are | 59 | enable this option, you can select to mount block devices which are |
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 252abda0d200..ba1c88af49fe 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
@@ -196,17 +196,17 @@ static int adfs_remount(struct super_block *sb, int *flags, char *data) | |||
196 | return parse_options(sb, data); | 196 | return parse_options(sb, data); |
197 | } | 197 | } |
198 | 198 | ||
199 | static int adfs_statfs(struct super_block *sb, struct kstatfs *buf) | 199 | static int adfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
200 | { | 200 | { |
201 | struct adfs_sb_info *asb = ADFS_SB(sb); | 201 | struct adfs_sb_info *asb = ADFS_SB(dentry->d_sb); |
202 | 202 | ||
203 | buf->f_type = ADFS_SUPER_MAGIC; | 203 | buf->f_type = ADFS_SUPER_MAGIC; |
204 | buf->f_namelen = asb->s_namelen; | 204 | buf->f_namelen = asb->s_namelen; |
205 | buf->f_bsize = sb->s_blocksize; | 205 | buf->f_bsize = dentry->d_sb->s_blocksize; |
206 | buf->f_blocks = asb->s_size; | 206 | buf->f_blocks = asb->s_size; |
207 | buf->f_files = asb->s_ids_per_zone * asb->s_map_size; | 207 | buf->f_files = asb->s_ids_per_zone * asb->s_map_size; |
208 | buf->f_bavail = | 208 | buf->f_bavail = |
209 | buf->f_bfree = adfs_map_free(sb); | 209 | buf->f_bfree = adfs_map_free(dentry->d_sb); |
210 | buf->f_ffree = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks; | 210 | buf->f_ffree = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks; |
211 | 211 | ||
212 | return 0; | 212 | return 0; |
@@ -470,10 +470,11 @@ error: | |||
470 | return -EINVAL; | 470 | return -EINVAL; |
471 | } | 471 | } |
472 | 472 | ||
473 | static struct super_block *adfs_get_sb(struct file_system_type *fs_type, | 473 | static int adfs_get_sb(struct file_system_type *fs_type, |
474 | int flags, const char *dev_name, void *data) | 474 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
475 | { | 475 | { |
476 | return get_sb_bdev(fs_type, flags, dev_name, data, adfs_fill_super); | 476 | return get_sb_bdev(fs_type, flags, dev_name, data, adfs_fill_super, |
477 | mnt); | ||
477 | } | 478 | } |
478 | 479 | ||
479 | static struct file_system_type adfs_fs_type = { | 480 | static struct file_system_type adfs_fs_type = { |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 4d7e5b19e5cd..8765cba35bb9 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | extern struct timezone sys_tz; | 19 | extern struct timezone sys_tz; |
20 | 20 | ||
21 | static int affs_statfs(struct super_block *sb, struct kstatfs *buf); | 21 | static int affs_statfs(struct dentry *dentry, struct kstatfs *buf); |
22 | static int affs_remount (struct super_block *sb, int *flags, char *data); | 22 | static int affs_remount (struct super_block *sb, int *flags, char *data); |
23 | 23 | ||
24 | static void | 24 | static void |
@@ -508,8 +508,9 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
508 | } | 508 | } |
509 | 509 | ||
510 | static int | 510 | static int |
511 | affs_statfs(struct super_block *sb, struct kstatfs *buf) | 511 | affs_statfs(struct dentry *dentry, struct kstatfs *buf) |
512 | { | 512 | { |
513 | struct super_block *sb = dentry->d_sb; | ||
513 | int free; | 514 | int free; |
514 | 515 | ||
515 | pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size, | 516 | pr_debug("AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size, |
@@ -524,10 +525,11 @@ affs_statfs(struct super_block *sb, struct kstatfs *buf) | |||
524 | return 0; | 525 | return 0; |
525 | } | 526 | } |
526 | 527 | ||
527 | static struct super_block *affs_get_sb(struct file_system_type *fs_type, | 528 | static int affs_get_sb(struct file_system_type *fs_type, |
528 | int flags, const char *dev_name, void *data) | 529 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
529 | { | 530 | { |
530 | return get_sb_bdev(fs_type, flags, dev_name, data, affs_fill_super); | 531 | return get_sb_bdev(fs_type, flags, dev_name, data, affs_fill_super, |
532 | mnt); | ||
531 | } | 533 | } |
532 | 534 | ||
533 | static struct file_system_type affs_fs_type = { | 535 | static struct file_system_type affs_fs_type = { |
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index a6dff6a4f204..2fc99877cb0d 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -185,9 +185,7 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index) | |||
185 | 185 | ||
186 | _enter("{%lu},%lu", dir->i_ino, index); | 186 | _enter("{%lu},%lu", dir->i_ino, index); |
187 | 187 | ||
188 | page = read_cache_page(dir->i_mapping,index, | 188 | page = read_mapping_page(dir->i_mapping, index, NULL); |
189 | (filler_t *) dir->i_mapping->a_ops->readpage, | ||
190 | NULL); | ||
191 | if (!IS_ERR(page)) { | 189 | if (!IS_ERR(page)) { |
192 | wait_on_page_locked(page); | 190 | wait_on_page_locked(page); |
193 | kmap(page); | 191 | kmap(page); |
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index 4e6eeb59b83c..b5cf9e1205ad 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c | |||
@@ -63,7 +63,6 @@ unsigned long afs_mntpt_expiry_timeout = 20; | |||
63 | int afs_mntpt_check_symlink(struct afs_vnode *vnode) | 63 | int afs_mntpt_check_symlink(struct afs_vnode *vnode) |
64 | { | 64 | { |
65 | struct page *page; | 65 | struct page *page; |
66 | filler_t *filler; | ||
67 | size_t size; | 66 | size_t size; |
68 | char *buf; | 67 | char *buf; |
69 | int ret; | 68 | int ret; |
@@ -71,10 +70,7 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode) | |||
71 | _enter("{%u,%u}", vnode->fid.vnode, vnode->fid.unique); | 70 | _enter("{%u,%u}", vnode->fid.vnode, vnode->fid.unique); |
72 | 71 | ||
73 | /* read the contents of the symlink into the pagecache */ | 72 | /* read the contents of the symlink into the pagecache */ |
74 | filler = (filler_t *) AFS_VNODE_TO_I(vnode)->i_mapping->a_ops->readpage; | 73 | page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, NULL); |
75 | |||
76 | page = read_cache_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, | ||
77 | filler, NULL); | ||
78 | if (IS_ERR(page)) { | 74 | if (IS_ERR(page)) { |
79 | ret = PTR_ERR(page); | 75 | ret = PTR_ERR(page); |
80 | goto out; | 76 | goto out; |
@@ -160,7 +156,6 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
160 | struct page *page = NULL; | 156 | struct page *page = NULL; |
161 | size_t size; | 157 | size_t size; |
162 | char *buf, *devname = NULL, *options = NULL; | 158 | char *buf, *devname = NULL, *options = NULL; |
163 | filler_t *filler; | ||
164 | int ret; | 159 | int ret; |
165 | 160 | ||
166 | kenter("{%s}", mntpt->d_name.name); | 161 | kenter("{%s}", mntpt->d_name.name); |
@@ -182,9 +177,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt) | |||
182 | goto error; | 177 | goto error; |
183 | 178 | ||
184 | /* read the contents of the AFS special symlink */ | 179 | /* read the contents of the AFS special symlink */ |
185 | filler = (filler_t *)mntpt->d_inode->i_mapping->a_ops->readpage; | 180 | page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL); |
186 | |||
187 | page = read_cache_page(mntpt->d_inode->i_mapping, 0, filler, NULL); | ||
188 | if (IS_ERR(page)) { | 181 | if (IS_ERR(page)) { |
189 | ret = PTR_ERR(page); | 182 | ret = PTR_ERR(page); |
190 | goto error; | 183 | goto error; |
diff --git a/fs/afs/super.c b/fs/afs/super.c index 53c56e7231ab..82468df0ba54 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
@@ -38,9 +38,9 @@ struct afs_mount_params { | |||
38 | static void afs_i_init_once(void *foo, kmem_cache_t *cachep, | 38 | static void afs_i_init_once(void *foo, kmem_cache_t *cachep, |
39 | unsigned long flags); | 39 | unsigned long flags); |
40 | 40 | ||
41 | static struct super_block *afs_get_sb(struct file_system_type *fs_type, | 41 | static int afs_get_sb(struct file_system_type *fs_type, |
42 | int flags, const char *dev_name, | 42 | int flags, const char *dev_name, |
43 | void *data); | 43 | void *data, struct vfsmount *mnt); |
44 | 44 | ||
45 | static struct inode *afs_alloc_inode(struct super_block *sb); | 45 | static struct inode *afs_alloc_inode(struct super_block *sb); |
46 | 46 | ||
@@ -294,10 +294,11 @@ static int afs_fill_super(struct super_block *sb, void *data, int silent) | |||
294 | * get an AFS superblock | 294 | * get an AFS superblock |
295 | * - TODO: don't use get_sb_nodev(), but rather call sget() directly | 295 | * - TODO: don't use get_sb_nodev(), but rather call sget() directly |
296 | */ | 296 | */ |
297 | static struct super_block *afs_get_sb(struct file_system_type *fs_type, | 297 | static int afs_get_sb(struct file_system_type *fs_type, |
298 | int flags, | 298 | int flags, |
299 | const char *dev_name, | 299 | const char *dev_name, |
300 | void *options) | 300 | void *options, |
301 | struct vfsmount *mnt) | ||
301 | { | 302 | { |
302 | struct afs_mount_params params; | 303 | struct afs_mount_params params; |
303 | struct super_block *sb; | 304 | struct super_block *sb; |
@@ -311,7 +312,7 @@ static struct super_block *afs_get_sb(struct file_system_type *fs_type, | |||
311 | ret = afscm_start(); | 312 | ret = afscm_start(); |
312 | if (ret < 0) { | 313 | if (ret < 0) { |
313 | _leave(" = %d", ret); | 314 | _leave(" = %d", ret); |
314 | return ERR_PTR(ret); | 315 | return ret; |
315 | } | 316 | } |
316 | 317 | ||
317 | /* parse the options */ | 318 | /* parse the options */ |
@@ -348,18 +349,19 @@ static struct super_block *afs_get_sb(struct file_system_type *fs_type, | |||
348 | goto error; | 349 | goto error; |
349 | } | 350 | } |
350 | sb->s_flags |= MS_ACTIVE; | 351 | sb->s_flags |= MS_ACTIVE; |
352 | simple_set_mnt(mnt, sb); | ||
351 | 353 | ||
352 | afs_put_volume(params.volume); | 354 | afs_put_volume(params.volume); |
353 | afs_put_cell(params.default_cell); | 355 | afs_put_cell(params.default_cell); |
354 | _leave(" = %p", sb); | 356 | _leave(" = 0 [%p]", 0, sb); |
355 | return sb; | 357 | return 0; |
356 | 358 | ||
357 | error: | 359 | error: |
358 | afs_put_volume(params.volume); | 360 | afs_put_volume(params.volume); |
359 | afs_put_cell(params.default_cell); | 361 | afs_put_cell(params.default_cell); |
360 | afscm_stop(); | 362 | afscm_stop(); |
361 | _leave(" = %d", ret); | 363 | _leave(" = %d", ret); |
362 | return ERR_PTR(ret); | 364 | return ret; |
363 | } /* end afs_get_sb() */ | 365 | } /* end afs_get_sb() */ |
364 | 366 | ||
365 | /*****************************************************************************/ | 367 | /*****************************************************************************/ |
@@ -777,11 +777,11 @@ out: | |||
777 | static int __aio_run_iocbs(struct kioctx *ctx) | 777 | static int __aio_run_iocbs(struct kioctx *ctx) |
778 | { | 778 | { |
779 | struct kiocb *iocb; | 779 | struct kiocb *iocb; |
780 | LIST_HEAD(run_list); | 780 | struct list_head run_list; |
781 | 781 | ||
782 | assert_spin_locked(&ctx->ctx_lock); | 782 | assert_spin_locked(&ctx->ctx_lock); |
783 | 783 | ||
784 | list_splice_init(&ctx->run_list, &run_list); | 784 | list_replace_init(&ctx->run_list, &run_list); |
785 | while (!list_empty(&run_list)) { | 785 | while (!list_empty(&run_list)) { |
786 | iocb = list_entry(run_list.next, struct kiocb, | 786 | iocb = list_entry(run_list.next, struct kiocb, |
787 | ki_run_list); | 787 | ki_run_list); |
diff --git a/fs/autofs/init.c b/fs/autofs/init.c index b977ece69f0c..aca123752406 100644 --- a/fs/autofs/init.c +++ b/fs/autofs/init.c | |||
@@ -14,10 +14,10 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include "autofs_i.h" | 15 | #include "autofs_i.h" |
16 | 16 | ||
17 | static struct super_block *autofs_get_sb(struct file_system_type *fs_type, | 17 | static int autofs_get_sb(struct file_system_type *fs_type, |
18 | int flags, const char *dev_name, void *data) | 18 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
19 | { | 19 | { |
20 | return get_sb_nodev(fs_type, flags, data, autofs_fill_super); | 20 | return get_sb_nodev(fs_type, flags, data, autofs_fill_super, mnt); |
21 | } | 21 | } |
22 | 22 | ||
23 | static struct file_system_type autofs_fs_type = { | 23 | static struct file_system_type autofs_fs_type = { |
diff --git a/fs/autofs4/init.c b/fs/autofs4/init.c index acecec8578ce..5d9193332bef 100644 --- a/fs/autofs4/init.c +++ b/fs/autofs4/init.c | |||
@@ -14,10 +14,10 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include "autofs_i.h" | 15 | #include "autofs_i.h" |
16 | 16 | ||
17 | static struct super_block *autofs_get_sb(struct file_system_type *fs_type, | 17 | static int autofs_get_sb(struct file_system_type *fs_type, |
18 | int flags, const char *dev_name, void *data) | 18 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
19 | { | 19 | { |
20 | return get_sb_nodev(fs_type, flags, data, autofs4_fill_super); | 20 | return get_sb_nodev(fs_type, flags, data, autofs4_fill_super, mnt); |
21 | } | 21 | } |
22 | 22 | ||
23 | static struct file_system_type autofs_fs_type = { | 23 | static struct file_system_type autofs_fs_type = { |
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 68ebd10f345d..08201fab26cd 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -49,7 +49,7 @@ static int befs_nls2utf(struct super_block *sb, const char *in, int in_len, | |||
49 | char **out, int *out_len); | 49 | char **out, int *out_len); |
50 | static void befs_put_super(struct super_block *); | 50 | static void befs_put_super(struct super_block *); |
51 | static int befs_remount(struct super_block *, int *, char *); | 51 | static int befs_remount(struct super_block *, int *, char *); |
52 | static int befs_statfs(struct super_block *, struct kstatfs *); | 52 | static int befs_statfs(struct dentry *, struct kstatfs *); |
53 | static int parse_options(char *, befs_mount_options *); | 53 | static int parse_options(char *, befs_mount_options *); |
54 | 54 | ||
55 | static const struct super_operations befs_sops = { | 55 | static const struct super_operations befs_sops = { |
@@ -880,8 +880,9 @@ befs_remount(struct super_block *sb, int *flags, char *data) | |||
880 | } | 880 | } |
881 | 881 | ||
882 | static int | 882 | static int |
883 | befs_statfs(struct super_block *sb, struct kstatfs *buf) | 883 | befs_statfs(struct dentry *dentry, struct kstatfs *buf) |
884 | { | 884 | { |
885 | struct super_block *sb = dentry->d_sb; | ||
885 | 886 | ||
886 | befs_debug(sb, "---> befs_statfs()"); | 887 | befs_debug(sb, "---> befs_statfs()"); |
887 | 888 | ||
@@ -899,11 +900,12 @@ befs_statfs(struct super_block *sb, struct kstatfs *buf) | |||
899 | return 0; | 900 | return 0; |
900 | } | 901 | } |
901 | 902 | ||
902 | static struct super_block * | 903 | static int |
903 | befs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, | 904 | befs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, |
904 | void *data) | 905 | void *data, struct vfsmount *mnt) |
905 | { | 906 | { |
906 | return get_sb_bdev(fs_type, flags, dev_name, data, befs_fill_super); | 907 | return get_sb_bdev(fs_type, flags, dev_name, data, befs_fill_super, |
908 | mnt); | ||
907 | } | 909 | } |
908 | 910 | ||
909 | static struct file_system_type befs_fs_type = { | 911 | static struct file_system_type befs_fs_type = { |
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 55a7a78332f8..cf74f3d4d966 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -203,8 +203,9 @@ static void bfs_put_super(struct super_block *s) | |||
203 | s->s_fs_info = NULL; | 203 | s->s_fs_info = NULL; |
204 | } | 204 | } |
205 | 205 | ||
206 | static int bfs_statfs(struct super_block *s, struct kstatfs *buf) | 206 | static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
207 | { | 207 | { |
208 | struct super_block *s = dentry->d_sb; | ||
208 | struct bfs_sb_info *info = BFS_SB(s); | 209 | struct bfs_sb_info *info = BFS_SB(s); |
209 | u64 id = huge_encode_dev(s->s_bdev->bd_dev); | 210 | u64 id = huge_encode_dev(s->s_bdev->bd_dev); |
210 | buf->f_type = BFS_MAGIC; | 211 | buf->f_type = BFS_MAGIC; |
@@ -410,10 +411,10 @@ out: | |||
410 | return -EINVAL; | 411 | return -EINVAL; |
411 | } | 412 | } |
412 | 413 | ||
413 | static struct super_block *bfs_get_sb(struct file_system_type *fs_type, | 414 | static int bfs_get_sb(struct file_system_type *fs_type, |
414 | int flags, const char *dev_name, void *data) | 415 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
415 | { | 416 | { |
416 | return get_sb_bdev(fs_type, flags, dev_name, data, bfs_fill_super); | 417 | return get_sb_bdev(fs_type, flags, dev_name, data, bfs_fill_super, mnt); |
417 | } | 418 | } |
418 | 419 | ||
419 | static struct file_system_type bfs_fs_type = { | 420 | static struct file_system_type bfs_fs_type = { |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 8a04216e8b4d..d0434406eaeb 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -38,15 +38,13 @@ | |||
38 | #include <linux/security.h> | 38 | #include <linux/security.h> |
39 | #include <linux/syscalls.h> | 39 | #include <linux/syscalls.h> |
40 | #include <linux/random.h> | 40 | #include <linux/random.h> |
41 | 41 | #include <linux/elf.h> | |
42 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
43 | #include <asm/param.h> | 43 | #include <asm/param.h> |
44 | #include <asm/page.h> | 44 | #include <asm/page.h> |
45 | 45 | ||
46 | #include <linux/elf.h> | 46 | static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs); |
47 | 47 | static int load_elf_library(struct file *); | |
48 | static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs); | ||
49 | static int load_elf_library(struct file*); | ||
50 | static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int); | 48 | static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int); |
51 | extern int dump_fpu (struct pt_regs *, elf_fpregset_t *); | 49 | extern int dump_fpu (struct pt_regs *, elf_fpregset_t *); |
52 | 50 | ||
@@ -59,15 +57,15 @@ extern int dump_fpu (struct pt_regs *, elf_fpregset_t *); | |||
59 | * don't even try. | 57 | * don't even try. |
60 | */ | 58 | */ |
61 | #if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE) | 59 | #if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE) |
62 | static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file); | 60 | static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file); |
63 | #else | 61 | #else |
64 | #define elf_core_dump NULL | 62 | #define elf_core_dump NULL |
65 | #endif | 63 | #endif |
66 | 64 | ||
67 | #if ELF_EXEC_PAGESIZE > PAGE_SIZE | 65 | #if ELF_EXEC_PAGESIZE > PAGE_SIZE |
68 | # define ELF_MIN_ALIGN ELF_EXEC_PAGESIZE | 66 | #define ELF_MIN_ALIGN ELF_EXEC_PAGESIZE |
69 | #else | 67 | #else |
70 | # define ELF_MIN_ALIGN PAGE_SIZE | 68 | #define ELF_MIN_ALIGN PAGE_SIZE |
71 | #endif | 69 | #endif |
72 | 70 | ||
73 | #ifndef ELF_CORE_EFLAGS | 71 | #ifndef ELF_CORE_EFLAGS |
@@ -86,7 +84,7 @@ static struct linux_binfmt elf_format = { | |||
86 | .min_coredump = ELF_EXEC_PAGESIZE | 84 | .min_coredump = ELF_EXEC_PAGESIZE |
87 | }; | 85 | }; |
88 | 86 | ||
89 | #define BAD_ADDR(x) ((unsigned long)(x) > TASK_SIZE) | 87 | #define BAD_ADDR(x) ((unsigned long)(x) > TASK_SIZE) |
90 | 88 | ||
91 | static int set_brk(unsigned long start, unsigned long end) | 89 | static int set_brk(unsigned long start, unsigned long end) |
92 | { | 90 | { |
@@ -104,13 +102,11 @@ static int set_brk(unsigned long start, unsigned long end) | |||
104 | return 0; | 102 | return 0; |
105 | } | 103 | } |
106 | 104 | ||
107 | |||
108 | /* We need to explicitly zero any fractional pages | 105 | /* We need to explicitly zero any fractional pages |
109 | after the data section (i.e. bss). This would | 106 | after the data section (i.e. bss). This would |
110 | contain the junk from the file that should not | 107 | contain the junk from the file that should not |
111 | be in memory */ | 108 | be in memory |
112 | 109 | */ | |
113 | |||
114 | static int padzero(unsigned long elf_bss) | 110 | static int padzero(unsigned long elf_bss) |
115 | { | 111 | { |
116 | unsigned long nbyte; | 112 | unsigned long nbyte; |
@@ -129,7 +125,9 @@ static int padzero(unsigned long elf_bss) | |||
129 | #define STACK_ADD(sp, items) ((elf_addr_t __user *)(sp) + (items)) | 125 | #define STACK_ADD(sp, items) ((elf_addr_t __user *)(sp) + (items)) |
130 | #define STACK_ROUND(sp, items) \ | 126 | #define STACK_ROUND(sp, items) \ |
131 | ((15 + (unsigned long) ((sp) + (items))) &~ 15UL) | 127 | ((15 + (unsigned long) ((sp) + (items))) &~ 15UL) |
132 | #define STACK_ALLOC(sp, len) ({ elf_addr_t __user *old_sp = (elf_addr_t __user *)sp; sp += len; old_sp; }) | 128 | #define STACK_ALLOC(sp, len) ({ \ |
129 | elf_addr_t __user *old_sp = (elf_addr_t __user *)sp; sp += len; \ | ||
130 | old_sp; }) | ||
133 | #else | 131 | #else |
134 | #define STACK_ADD(sp, items) ((elf_addr_t __user *)(sp) - (items)) | 132 | #define STACK_ADD(sp, items) ((elf_addr_t __user *)(sp) - (items)) |
135 | #define STACK_ROUND(sp, items) \ | 133 | #define STACK_ROUND(sp, items) \ |
@@ -138,7 +136,7 @@ static int padzero(unsigned long elf_bss) | |||
138 | #endif | 136 | #endif |
139 | 137 | ||
140 | static int | 138 | static int |
141 | create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, | 139 | create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec, |
142 | int interp_aout, unsigned long load_addr, | 140 | int interp_aout, unsigned long load_addr, |
143 | unsigned long interp_load_addr) | 141 | unsigned long interp_load_addr) |
144 | { | 142 | { |
@@ -161,7 +159,6 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, | |||
161 | * for userspace to get any other way, in others (i386) it is | 159 | * for userspace to get any other way, in others (i386) it is |
162 | * merely difficult. | 160 | * merely difficult. |
163 | */ | 161 | */ |
164 | |||
165 | u_platform = NULL; | 162 | u_platform = NULL; |
166 | if (k_platform) { | 163 | if (k_platform) { |
167 | size_t len = strlen(k_platform) + 1; | 164 | size_t len = strlen(k_platform) + 1; |
@@ -171,7 +168,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, | |||
171 | * evictions by the processes running on the same package. One | 168 | * evictions by the processes running on the same package. One |
172 | * thing we can do is to shuffle the initial stack for them. | 169 | * thing we can do is to shuffle the initial stack for them. |
173 | */ | 170 | */ |
174 | 171 | ||
175 | p = arch_align_stack(p); | 172 | p = arch_align_stack(p); |
176 | 173 | ||
177 | u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len); | 174 | u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len); |
@@ -180,9 +177,12 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, | |||
180 | } | 177 | } |
181 | 178 | ||
182 | /* Create the ELF interpreter info */ | 179 | /* Create the ELF interpreter info */ |
183 | elf_info = (elf_addr_t *) current->mm->saved_auxv; | 180 | elf_info = (elf_addr_t *)current->mm->saved_auxv; |
184 | #define NEW_AUX_ENT(id, val) \ | 181 | #define NEW_AUX_ENT(id, val) \ |
185 | do { elf_info[ei_index++] = id; elf_info[ei_index++] = val; } while (0) | 182 | do { \ |
183 | elf_info[ei_index++] = id; \ | ||
184 | elf_info[ei_index++] = val; \ | ||
185 | } while (0) | ||
186 | 186 | ||
187 | #ifdef ARCH_DLINFO | 187 | #ifdef ARCH_DLINFO |
188 | /* | 188 | /* |
@@ -195,21 +195,22 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, | |||
195 | NEW_AUX_ENT(AT_PAGESZ, ELF_EXEC_PAGESIZE); | 195 | NEW_AUX_ENT(AT_PAGESZ, ELF_EXEC_PAGESIZE); |
196 | NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC); | 196 | NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC); |
197 | NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff); | 197 | NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff); |
198 | NEW_AUX_ENT(AT_PHENT, sizeof (struct elf_phdr)); | 198 | NEW_AUX_ENT(AT_PHENT, sizeof(struct elf_phdr)); |
199 | NEW_AUX_ENT(AT_PHNUM, exec->e_phnum); | 199 | NEW_AUX_ENT(AT_PHNUM, exec->e_phnum); |
200 | NEW_AUX_ENT(AT_BASE, interp_load_addr); | 200 | NEW_AUX_ENT(AT_BASE, interp_load_addr); |
201 | NEW_AUX_ENT(AT_FLAGS, 0); | 201 | NEW_AUX_ENT(AT_FLAGS, 0); |
202 | NEW_AUX_ENT(AT_ENTRY, exec->e_entry); | 202 | NEW_AUX_ENT(AT_ENTRY, exec->e_entry); |
203 | NEW_AUX_ENT(AT_UID, (elf_addr_t) tsk->uid); | 203 | NEW_AUX_ENT(AT_UID, tsk->uid); |
204 | NEW_AUX_ENT(AT_EUID, (elf_addr_t) tsk->euid); | 204 | NEW_AUX_ENT(AT_EUID, tsk->euid); |
205 | NEW_AUX_ENT(AT_GID, (elf_addr_t) tsk->gid); | 205 | NEW_AUX_ENT(AT_GID, tsk->gid); |
206 | NEW_AUX_ENT(AT_EGID, (elf_addr_t) tsk->egid); | 206 | NEW_AUX_ENT(AT_EGID, tsk->egid); |
207 | NEW_AUX_ENT(AT_SECURE, (elf_addr_t) security_bprm_secureexec(bprm)); | 207 | NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm)); |
208 | if (k_platform) { | 208 | if (k_platform) { |
209 | NEW_AUX_ENT(AT_PLATFORM, (elf_addr_t)(unsigned long)u_platform); | 209 | NEW_AUX_ENT(AT_PLATFORM, |
210 | (elf_addr_t)(unsigned long)u_platform); | ||
210 | } | 211 | } |
211 | if (bprm->interp_flags & BINPRM_FLAGS_EXECFD) { | 212 | if (bprm->interp_flags & BINPRM_FLAGS_EXECFD) { |
212 | NEW_AUX_ENT(AT_EXECFD, (elf_addr_t) bprm->interp_data); | 213 | NEW_AUX_ENT(AT_EXECFD, bprm->interp_data); |
213 | } | 214 | } |
214 | #undef NEW_AUX_ENT | 215 | #undef NEW_AUX_ENT |
215 | /* AT_NULL is zero; clear the rest too */ | 216 | /* AT_NULL is zero; clear the rest too */ |
@@ -232,7 +233,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, | |||
232 | /* Point sp at the lowest address on the stack */ | 233 | /* Point sp at the lowest address on the stack */ |
233 | #ifdef CONFIG_STACK_GROWSUP | 234 | #ifdef CONFIG_STACK_GROWSUP |
234 | sp = (elf_addr_t __user *)bprm->p - items - ei_index; | 235 | sp = (elf_addr_t __user *)bprm->p - items - ei_index; |
235 | bprm->exec = (unsigned long) sp; /* XXX: PARISC HACK */ | 236 | bprm->exec = (unsigned long)sp; /* XXX: PARISC HACK */ |
236 | #else | 237 | #else |
237 | sp = (elf_addr_t __user *)bprm->p; | 238 | sp = (elf_addr_t __user *)bprm->p; |
238 | #endif | 239 | #endif |
@@ -285,7 +286,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, | |||
285 | #ifndef elf_map | 286 | #ifndef elf_map |
286 | 287 | ||
287 | static unsigned long elf_map(struct file *filep, unsigned long addr, | 288 | static unsigned long elf_map(struct file *filep, unsigned long addr, |
288 | struct elf_phdr *eppnt, int prot, int type) | 289 | struct elf_phdr *eppnt, int prot, int type) |
289 | { | 290 | { |
290 | unsigned long map_addr; | 291 | unsigned long map_addr; |
291 | unsigned long pageoffset = ELF_PAGEOFFSET(eppnt->p_vaddr); | 292 | unsigned long pageoffset = ELF_PAGEOFFSET(eppnt->p_vaddr); |
@@ -310,9 +311,8 @@ static unsigned long elf_map(struct file *filep, unsigned long addr, | |||
310 | is only provided so that we can read a.out libraries that have | 311 | is only provided so that we can read a.out libraries that have |
311 | an ELF header */ | 312 | an ELF header */ |
312 | 313 | ||
313 | static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex, | 314 | static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex, |
314 | struct file * interpreter, | 315 | struct file *interpreter, unsigned long *interp_load_addr) |
315 | unsigned long *interp_load_addr) | ||
316 | { | 316 | { |
317 | struct elf_phdr *elf_phdata; | 317 | struct elf_phdr *elf_phdata; |
318 | struct elf_phdr *eppnt; | 318 | struct elf_phdr *eppnt; |
@@ -342,15 +342,15 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex, | |||
342 | goto out; | 342 | goto out; |
343 | 343 | ||
344 | /* Now read in all of the header information */ | 344 | /* Now read in all of the header information */ |
345 | |||
346 | size = sizeof(struct elf_phdr) * interp_elf_ex->e_phnum; | 345 | size = sizeof(struct elf_phdr) * interp_elf_ex->e_phnum; |
347 | if (size > ELF_MIN_ALIGN) | 346 | if (size > ELF_MIN_ALIGN) |
348 | goto out; | 347 | goto out; |
349 | elf_phdata = (struct elf_phdr *) kmalloc(size, GFP_KERNEL); | 348 | elf_phdata = kmalloc(size, GFP_KERNEL); |
350 | if (!elf_phdata) | 349 | if (!elf_phdata) |
351 | goto out; | 350 | goto out; |
352 | 351 | ||
353 | retval = kernel_read(interpreter,interp_elf_ex->e_phoff,(char *)elf_phdata,size); | 352 | retval = kernel_read(interpreter, interp_elf_ex->e_phoff, |
353 | (char *)elf_phdata,size); | ||
354 | error = -EIO; | 354 | error = -EIO; |
355 | if (retval != size) { | 355 | if (retval != size) { |
356 | if (retval < 0) | 356 | if (retval < 0) |
@@ -359,58 +359,65 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex, | |||
359 | } | 359 | } |
360 | 360 | ||
361 | eppnt = elf_phdata; | 361 | eppnt = elf_phdata; |
362 | for (i=0; i<interp_elf_ex->e_phnum; i++, eppnt++) { | 362 | for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) { |
363 | if (eppnt->p_type == PT_LOAD) { | 363 | if (eppnt->p_type == PT_LOAD) { |
364 | int elf_type = MAP_PRIVATE | MAP_DENYWRITE; | 364 | int elf_type = MAP_PRIVATE | MAP_DENYWRITE; |
365 | int elf_prot = 0; | 365 | int elf_prot = 0; |
366 | unsigned long vaddr = 0; | 366 | unsigned long vaddr = 0; |
367 | unsigned long k, map_addr; | 367 | unsigned long k, map_addr; |
368 | 368 | ||
369 | if (eppnt->p_flags & PF_R) elf_prot = PROT_READ; | 369 | if (eppnt->p_flags & PF_R) |
370 | if (eppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; | 370 | elf_prot = PROT_READ; |
371 | if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC; | 371 | if (eppnt->p_flags & PF_W) |
372 | vaddr = eppnt->p_vaddr; | 372 | elf_prot |= PROT_WRITE; |
373 | if (interp_elf_ex->e_type == ET_EXEC || load_addr_set) | 373 | if (eppnt->p_flags & PF_X) |
374 | elf_type |= MAP_FIXED; | 374 | elf_prot |= PROT_EXEC; |
375 | 375 | vaddr = eppnt->p_vaddr; | |
376 | map_addr = elf_map(interpreter, load_addr + vaddr, eppnt, elf_prot, elf_type); | 376 | if (interp_elf_ex->e_type == ET_EXEC || load_addr_set) |
377 | error = map_addr; | 377 | elf_type |= MAP_FIXED; |
378 | if (BAD_ADDR(map_addr)) | 378 | |
379 | goto out_close; | 379 | map_addr = elf_map(interpreter, load_addr + vaddr, |
380 | 380 | eppnt, elf_prot, elf_type); | |
381 | if (!load_addr_set && interp_elf_ex->e_type == ET_DYN) { | 381 | error = map_addr; |
382 | load_addr = map_addr - ELF_PAGESTART(vaddr); | 382 | if (BAD_ADDR(map_addr)) |
383 | load_addr_set = 1; | 383 | goto out_close; |
384 | } | 384 | |
385 | 385 | if (!load_addr_set && | |
386 | /* | 386 | interp_elf_ex->e_type == ET_DYN) { |
387 | * Check to see if the section's size will overflow the | 387 | load_addr = map_addr - ELF_PAGESTART(vaddr); |
388 | * allowed task size. Note that p_filesz must always be | 388 | load_addr_set = 1; |
389 | * <= p_memsize so it is only necessary to check p_memsz. | 389 | } |
390 | */ | 390 | |
391 | k = load_addr + eppnt->p_vaddr; | 391 | /* |
392 | if (k > TASK_SIZE || eppnt->p_filesz > eppnt->p_memsz || | 392 | * Check to see if the section's size will overflow the |
393 | eppnt->p_memsz > TASK_SIZE || TASK_SIZE - eppnt->p_memsz < k) { | 393 | * allowed task size. Note that p_filesz must always be |
394 | error = -ENOMEM; | 394 | * <= p_memsize so it's only necessary to check p_memsz. |
395 | goto out_close; | 395 | */ |
396 | } | 396 | k = load_addr + eppnt->p_vaddr; |
397 | 397 | if (k > TASK_SIZE || | |
398 | /* | 398 | eppnt->p_filesz > eppnt->p_memsz || |
399 | * Find the end of the file mapping for this phdr, and keep | 399 | eppnt->p_memsz > TASK_SIZE || |
400 | * track of the largest address we see for this. | 400 | TASK_SIZE - eppnt->p_memsz < k) { |
401 | */ | 401 | error = -ENOMEM; |
402 | k = load_addr + eppnt->p_vaddr + eppnt->p_filesz; | 402 | goto out_close; |
403 | if (k > elf_bss) | 403 | } |
404 | elf_bss = k; | 404 | |
405 | 405 | /* | |
406 | /* | 406 | * Find the end of the file mapping for this phdr, and |
407 | * Do the same thing for the memory mapping - between | 407 | * keep track of the largest address we see for this. |
408 | * elf_bss and last_bss is the bss section. | 408 | */ |
409 | */ | 409 | k = load_addr + eppnt->p_vaddr + eppnt->p_filesz; |
410 | k = load_addr + eppnt->p_memsz + eppnt->p_vaddr; | 410 | if (k > elf_bss) |
411 | if (k > last_bss) | 411 | elf_bss = k; |
412 | last_bss = k; | 412 | |
413 | } | 413 | /* |
414 | * Do the same thing for the memory mapping - between | ||
415 | * elf_bss and last_bss is the bss section. | ||
416 | */ | ||
417 | k = load_addr + eppnt->p_memsz + eppnt->p_vaddr; | ||
418 | if (k > last_bss) | ||
419 | last_bss = k; | ||
420 | } | ||
414 | } | 421 | } |
415 | 422 | ||
416 | /* | 423 | /* |
@@ -424,7 +431,8 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex, | |||
424 | goto out_close; | 431 | goto out_close; |
425 | } | 432 | } |
426 | 433 | ||
427 | elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); /* What we have mapped so far */ | 434 | /* What we have mapped so far */ |
435 | elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); | ||
428 | 436 | ||
429 | /* Map the last of the bss segment */ | 437 | /* Map the last of the bss segment */ |
430 | if (last_bss > elf_bss) { | 438 | if (last_bss > elf_bss) { |
@@ -436,7 +444,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex, | |||
436 | } | 444 | } |
437 | 445 | ||
438 | *interp_load_addr = load_addr; | 446 | *interp_load_addr = load_addr; |
439 | error = ((unsigned long) interp_elf_ex->e_entry) + load_addr; | 447 | error = ((unsigned long)interp_elf_ex->e_entry) + load_addr; |
440 | 448 | ||
441 | out_close: | 449 | out_close: |
442 | kfree(elf_phdata); | 450 | kfree(elf_phdata); |
@@ -444,8 +452,8 @@ out: | |||
444 | return error; | 452 | return error; |
445 | } | 453 | } |
446 | 454 | ||
447 | static unsigned long load_aout_interp(struct exec * interp_ex, | 455 | static unsigned long load_aout_interp(struct exec *interp_ex, |
448 | struct file * interpreter) | 456 | struct file *interpreter) |
449 | { | 457 | { |
450 | unsigned long text_data, elf_entry = ~0UL; | 458 | unsigned long text_data, elf_entry = ~0UL; |
451 | char __user * addr; | 459 | char __user * addr; |
@@ -464,7 +472,7 @@ static unsigned long load_aout_interp(struct exec * interp_ex, | |||
464 | case ZMAGIC: | 472 | case ZMAGIC: |
465 | case QMAGIC: | 473 | case QMAGIC: |
466 | offset = N_TXTOFF(*interp_ex); | 474 | offset = N_TXTOFF(*interp_ex); |
467 | addr = (char __user *) N_TXTADDR(*interp_ex); | 475 | addr = (char __user *)N_TXTADDR(*interp_ex); |
468 | break; | 476 | break; |
469 | default: | 477 | default: |
470 | goto out; | 478 | goto out; |
@@ -480,7 +488,6 @@ static unsigned long load_aout_interp(struct exec * interp_ex, | |||
480 | flush_icache_range((unsigned long)addr, | 488 | flush_icache_range((unsigned long)addr, |
481 | (unsigned long)addr + text_data); | 489 | (unsigned long)addr + text_data); |
482 | 490 | ||
483 | |||
484 | down_write(¤t->mm->mmap_sem); | 491 | down_write(¤t->mm->mmap_sem); |
485 | do_brk(ELF_PAGESTART(text_data + ELF_MIN_ALIGN - 1), | 492 | do_brk(ELF_PAGESTART(text_data + ELF_MIN_ALIGN - 1), |
486 | interp_ex->a_bss); | 493 | interp_ex->a_bss); |
@@ -519,7 +526,7 @@ static unsigned long randomize_stack_top(unsigned long stack_top) | |||
519 | #endif | 526 | #endif |
520 | } | 527 | } |
521 | 528 | ||
522 | static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | 529 | static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) |
523 | { | 530 | { |
524 | struct file *interpreter = NULL; /* to shut gcc up */ | 531 | struct file *interpreter = NULL; /* to shut gcc up */ |
525 | unsigned long load_addr = 0, load_bias = 0; | 532 | unsigned long load_addr = 0, load_bias = 0; |
@@ -528,7 +535,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
528 | unsigned int interpreter_type = INTERPRETER_NONE; | 535 | unsigned int interpreter_type = INTERPRETER_NONE; |
529 | unsigned char ibcs2_interpreter = 0; | 536 | unsigned char ibcs2_interpreter = 0; |
530 | unsigned long error; | 537 | unsigned long error; |
531 | struct elf_phdr * elf_ppnt, *elf_phdata; | 538 | struct elf_phdr *elf_ppnt, *elf_phdata; |
532 | unsigned long elf_bss, elf_brk; | 539 | unsigned long elf_bss, elf_brk; |
533 | int elf_exec_fileno; | 540 | int elf_exec_fileno; |
534 | int retval, i; | 541 | int retval, i; |
@@ -553,7 +560,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
553 | } | 560 | } |
554 | 561 | ||
555 | /* Get the exec-header */ | 562 | /* Get the exec-header */ |
556 | loc->elf_ex = *((struct elfhdr *) bprm->buf); | 563 | loc->elf_ex = *((struct elfhdr *)bprm->buf); |
557 | 564 | ||
558 | retval = -ENOEXEC; | 565 | retval = -ENOEXEC; |
559 | /* First of all, some simple consistency checks */ | 566 | /* First of all, some simple consistency checks */ |
@@ -568,7 +575,6 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
568 | goto out; | 575 | goto out; |
569 | 576 | ||
570 | /* Now read in all of the header information */ | 577 | /* Now read in all of the header information */ |
571 | |||
572 | if (loc->elf_ex.e_phentsize != sizeof(struct elf_phdr)) | 578 | if (loc->elf_ex.e_phentsize != sizeof(struct elf_phdr)) |
573 | goto out; | 579 | goto out; |
574 | if (loc->elf_ex.e_phnum < 1 || | 580 | if (loc->elf_ex.e_phnum < 1 || |
@@ -576,18 +582,19 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
576 | goto out; | 582 | goto out; |
577 | size = loc->elf_ex.e_phnum * sizeof(struct elf_phdr); | 583 | size = loc->elf_ex.e_phnum * sizeof(struct elf_phdr); |
578 | retval = -ENOMEM; | 584 | retval = -ENOMEM; |
579 | elf_phdata = (struct elf_phdr *) kmalloc(size, GFP_KERNEL); | 585 | elf_phdata = kmalloc(size, GFP_KERNEL); |
580 | if (!elf_phdata) | 586 | if (!elf_phdata) |
581 | goto out; | 587 | goto out; |
582 | 588 | ||
583 | retval = kernel_read(bprm->file, loc->elf_ex.e_phoff, (char *) elf_phdata, size); | 589 | retval = kernel_read(bprm->file, loc->elf_ex.e_phoff, |
590 | (char *)elf_phdata, size); | ||
584 | if (retval != size) { | 591 | if (retval != size) { |
585 | if (retval >= 0) | 592 | if (retval >= 0) |
586 | retval = -EIO; | 593 | retval = -EIO; |
587 | goto out_free_ph; | 594 | goto out_free_ph; |
588 | } | 595 | } |
589 | 596 | ||
590 | files = current->files; /* Refcounted so ok */ | 597 | files = current->files; /* Refcounted so ok */ |
591 | retval = unshare_files(); | 598 | retval = unshare_files(); |
592 | if (retval < 0) | 599 | if (retval < 0) |
593 | goto out_free_ph; | 600 | goto out_free_ph; |
@@ -598,7 +605,6 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
598 | 605 | ||
599 | /* exec will make our files private anyway, but for the a.out | 606 | /* exec will make our files private anyway, but for the a.out |
600 | loader stuff we need to do it earlier */ | 607 | loader stuff we need to do it earlier */ |
601 | |||
602 | retval = get_unused_fd(); | 608 | retval = get_unused_fd(); |
603 | if (retval < 0) | 609 | if (retval < 0) |
604 | goto out_free_fh; | 610 | goto out_free_fh; |
@@ -620,7 +626,6 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
620 | * shared libraries - for now assume that this | 626 | * shared libraries - for now assume that this |
621 | * is an a.out format binary | 627 | * is an a.out format binary |
622 | */ | 628 | */ |
623 | |||
624 | retval = -ENOEXEC; | 629 | retval = -ENOEXEC; |
625 | if (elf_ppnt->p_filesz > PATH_MAX || | 630 | if (elf_ppnt->p_filesz > PATH_MAX || |
626 | elf_ppnt->p_filesz < 2) | 631 | elf_ppnt->p_filesz < 2) |
@@ -628,13 +633,13 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
628 | 633 | ||
629 | retval = -ENOMEM; | 634 | retval = -ENOMEM; |
630 | elf_interpreter = kmalloc(elf_ppnt->p_filesz, | 635 | elf_interpreter = kmalloc(elf_ppnt->p_filesz, |
631 | GFP_KERNEL); | 636 | GFP_KERNEL); |
632 | if (!elf_interpreter) | 637 | if (!elf_interpreter) |
633 | goto out_free_file; | 638 | goto out_free_file; |
634 | 639 | ||
635 | retval = kernel_read(bprm->file, elf_ppnt->p_offset, | 640 | retval = kernel_read(bprm->file, elf_ppnt->p_offset, |
636 | elf_interpreter, | 641 | elf_interpreter, |
637 | elf_ppnt->p_filesz); | 642 | elf_ppnt->p_filesz); |
638 | if (retval != elf_ppnt->p_filesz) { | 643 | if (retval != elf_ppnt->p_filesz) { |
639 | if (retval >= 0) | 644 | if (retval >= 0) |
640 | retval = -EIO; | 645 | retval = -EIO; |
@@ -678,7 +683,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
678 | retval = PTR_ERR(interpreter); | 683 | retval = PTR_ERR(interpreter); |
679 | if (IS_ERR(interpreter)) | 684 | if (IS_ERR(interpreter)) |
680 | goto out_free_interp; | 685 | goto out_free_interp; |
681 | retval = kernel_read(interpreter, 0, bprm->buf, BINPRM_BUF_SIZE); | 686 | retval = kernel_read(interpreter, 0, bprm->buf, |
687 | BINPRM_BUF_SIZE); | ||
682 | if (retval != BINPRM_BUF_SIZE) { | 688 | if (retval != BINPRM_BUF_SIZE) { |
683 | if (retval >= 0) | 689 | if (retval >= 0) |
684 | retval = -EIO; | 690 | retval = -EIO; |
@@ -686,8 +692,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
686 | } | 692 | } |
687 | 693 | ||
688 | /* Get the exec headers */ | 694 | /* Get the exec headers */ |
689 | loc->interp_ex = *((struct exec *) bprm->buf); | 695 | loc->interp_ex = *((struct exec *)bprm->buf); |
690 | loc->interp_elf_ex = *((struct elfhdr *) bprm->buf); | 696 | loc->interp_elf_ex = *((struct elfhdr *)bprm->buf); |
691 | break; | 697 | break; |
692 | } | 698 | } |
693 | elf_ppnt++; | 699 | elf_ppnt++; |
@@ -739,7 +745,6 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
739 | 745 | ||
740 | /* OK, we are done with that, now set up the arg stuff, | 746 | /* OK, we are done with that, now set up the arg stuff, |
741 | and then start this sucker up */ | 747 | and then start this sucker up */ |
742 | |||
743 | if ((!bprm->sh_bang) && (interpreter_type == INTERPRETER_AOUT)) { | 748 | if ((!bprm->sh_bang) && (interpreter_type == INTERPRETER_AOUT)) { |
744 | char *passed_p = passed_fileno; | 749 | char *passed_p = passed_fileno; |
745 | sprintf(passed_fileno, "%d", elf_exec_fileno); | 750 | sprintf(passed_fileno, "%d", elf_exec_fileno); |
@@ -777,7 +782,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
777 | if (elf_read_implies_exec(loc->elf_ex, executable_stack)) | 782 | if (elf_read_implies_exec(loc->elf_ex, executable_stack)) |
778 | current->personality |= READ_IMPLIES_EXEC; | 783 | current->personality |= READ_IMPLIES_EXEC; |
779 | 784 | ||
780 | if ( !(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) | 785 | if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) |
781 | current->flags |= PF_RANDOMIZE; | 786 | current->flags |= PF_RANDOMIZE; |
782 | arch_pick_mmap_layout(current->mm); | 787 | arch_pick_mmap_layout(current->mm); |
783 | 788 | ||
@@ -798,8 +803,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
798 | the correct location in memory. At this point, we assume that | 803 | the correct location in memory. At this point, we assume that |
799 | the image should be loaded at fixed address, not at a variable | 804 | the image should be loaded at fixed address, not at a variable |
800 | address. */ | 805 | address. */ |
801 | 806 | for(i = 0, elf_ppnt = elf_phdata; | |
802 | for(i = 0, elf_ppnt = elf_phdata; i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { | 807 | i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { |
803 | int elf_prot = 0, elf_flags; | 808 | int elf_prot = 0, elf_flags; |
804 | unsigned long k, vaddr; | 809 | unsigned long k, vaddr; |
805 | 810 | ||
@@ -827,30 +832,35 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
827 | load_bias, nbyte)) { | 832 | load_bias, nbyte)) { |
828 | /* | 833 | /* |
829 | * This bss-zeroing can fail if the ELF | 834 | * This bss-zeroing can fail if the ELF |
830 | * file specifies odd protections. So | 835 | * file specifies odd protections. So |
831 | * we don't check the return value | 836 | * we don't check the return value |
832 | */ | 837 | */ |
833 | } | 838 | } |
834 | } | 839 | } |
835 | } | 840 | } |
836 | 841 | ||
837 | if (elf_ppnt->p_flags & PF_R) elf_prot |= PROT_READ; | 842 | if (elf_ppnt->p_flags & PF_R) |
838 | if (elf_ppnt->p_flags & PF_W) elf_prot |= PROT_WRITE; | 843 | elf_prot |= PROT_READ; |
839 | if (elf_ppnt->p_flags & PF_X) elf_prot |= PROT_EXEC; | 844 | if (elf_ppnt->p_flags & PF_W) |
845 | elf_prot |= PROT_WRITE; | ||
846 | if (elf_ppnt->p_flags & PF_X) | ||
847 | elf_prot |= PROT_EXEC; | ||
840 | 848 | ||
841 | elf_flags = MAP_PRIVATE|MAP_DENYWRITE|MAP_EXECUTABLE; | 849 | elf_flags = MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE; |
842 | 850 | ||
843 | vaddr = elf_ppnt->p_vaddr; | 851 | vaddr = elf_ppnt->p_vaddr; |
844 | if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) { | 852 | if (loc->elf_ex.e_type == ET_EXEC || load_addr_set) { |
845 | elf_flags |= MAP_FIXED; | 853 | elf_flags |= MAP_FIXED; |
846 | } else if (loc->elf_ex.e_type == ET_DYN) { | 854 | } else if (loc->elf_ex.e_type == ET_DYN) { |
847 | /* Try and get dynamic programs out of the way of the default mmap | 855 | /* Try and get dynamic programs out of the way of the |
848 | base, as well as whatever program they might try to exec. This | 856 | * default mmap base, as well as whatever program they |
849 | is because the brk will follow the loader, and is not movable. */ | 857 | * might try to exec. This is because the brk will |
858 | * follow the loader, and is not movable. */ | ||
850 | load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); | 859 | load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); |
851 | } | 860 | } |
852 | 861 | ||
853 | error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, elf_prot, elf_flags); | 862 | error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, |
863 | elf_prot, elf_flags); | ||
854 | if (BAD_ADDR(error)) { | 864 | if (BAD_ADDR(error)) { |
855 | send_sig(SIGKILL, current, 0); | 865 | send_sig(SIGKILL, current, 0); |
856 | goto out_free_dentry; | 866 | goto out_free_dentry; |
@@ -867,8 +877,10 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
867 | } | 877 | } |
868 | } | 878 | } |
869 | k = elf_ppnt->p_vaddr; | 879 | k = elf_ppnt->p_vaddr; |
870 | if (k < start_code) start_code = k; | 880 | if (k < start_code) |
871 | if (start_data < k) start_data = k; | 881 | start_code = k; |
882 | if (start_data < k) | ||
883 | start_data = k; | ||
872 | 884 | ||
873 | /* | 885 | /* |
874 | * Check to see if the section's size will overflow the | 886 | * Check to see if the section's size will overflow the |
@@ -878,7 +890,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
878 | if (k > TASK_SIZE || elf_ppnt->p_filesz > elf_ppnt->p_memsz || | 890 | if (k > TASK_SIZE || elf_ppnt->p_filesz > elf_ppnt->p_memsz || |
879 | elf_ppnt->p_memsz > TASK_SIZE || | 891 | elf_ppnt->p_memsz > TASK_SIZE || |
880 | TASK_SIZE - elf_ppnt->p_memsz < k) { | 892 | TASK_SIZE - elf_ppnt->p_memsz < k) { |
881 | /* set_brk can never work. Avoid overflows. */ | 893 | /* set_brk can never work. Avoid overflows. */ |
882 | send_sig(SIGKILL, current, 0); | 894 | send_sig(SIGKILL, current, 0); |
883 | goto out_free_dentry; | 895 | goto out_free_dentry; |
884 | } | 896 | } |
@@ -966,8 +978,9 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
966 | 978 | ||
967 | compute_creds(bprm); | 979 | compute_creds(bprm); |
968 | current->flags &= ~PF_FORKNOEXEC; | 980 | current->flags &= ~PF_FORKNOEXEC; |
969 | create_elf_tables(bprm, &loc->elf_ex, (interpreter_type == INTERPRETER_AOUT), | 981 | create_elf_tables(bprm, &loc->elf_ex, |
970 | load_addr, interp_load_addr); | 982 | (interpreter_type == INTERPRETER_AOUT), |
983 | load_addr, interp_load_addr); | ||
971 | /* N.B. passed_fileno might not be initialized? */ | 984 | /* N.B. passed_fileno might not be initialized? */ |
972 | if (interpreter_type == INTERPRETER_AOUT) | 985 | if (interpreter_type == INTERPRETER_AOUT) |
973 | current->mm->arg_start += strlen(passed_fileno) + 1; | 986 | current->mm->arg_start += strlen(passed_fileno) + 1; |
@@ -981,7 +994,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
981 | /* Why this, you ask??? Well SVr4 maps page 0 as read-only, | 994 | /* Why this, you ask??? Well SVr4 maps page 0 as read-only, |
982 | and some applications "depend" upon this behavior. | 995 | and some applications "depend" upon this behavior. |
983 | Since we do not have the power to recompile these, we | 996 | Since we do not have the power to recompile these, we |
984 | emulate the SVr4 behavior. Sigh. */ | 997 | emulate the SVr4 behavior. Sigh. */ |
985 | down_write(¤t->mm->mmap_sem); | 998 | down_write(¤t->mm->mmap_sem); |
986 | error = do_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC, | 999 | error = do_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC, |
987 | MAP_FIXED | MAP_PRIVATE, 0); | 1000 | MAP_FIXED | MAP_PRIVATE, 0); |
@@ -1036,7 +1049,6 @@ out_free_ph: | |||
1036 | 1049 | ||
1037 | /* This is really simpleminded and specialized - we are loading an | 1050 | /* This is really simpleminded and specialized - we are loading an |
1038 | a.out library that is given an ELF header. */ | 1051 | a.out library that is given an ELF header. */ |
1039 | |||
1040 | static int load_elf_library(struct file *file) | 1052 | static int load_elf_library(struct file *file) |
1041 | { | 1053 | { |
1042 | struct elf_phdr *elf_phdata; | 1054 | struct elf_phdr *elf_phdata; |
@@ -1046,7 +1058,7 @@ static int load_elf_library(struct file *file) | |||
1046 | struct elfhdr elf_ex; | 1058 | struct elfhdr elf_ex; |
1047 | 1059 | ||
1048 | error = -ENOEXEC; | 1060 | error = -ENOEXEC; |
1049 | retval = kernel_read(file, 0, (char *) &elf_ex, sizeof(elf_ex)); | 1061 | retval = kernel_read(file, 0, (char *)&elf_ex, sizeof(elf_ex)); |
1050 | if (retval != sizeof(elf_ex)) | 1062 | if (retval != sizeof(elf_ex)) |
1051 | goto out; | 1063 | goto out; |
1052 | 1064 | ||
@@ -1055,7 +1067,7 @@ static int load_elf_library(struct file *file) | |||
1055 | 1067 | ||
1056 | /* First of all, some simple consistency checks */ | 1068 | /* First of all, some simple consistency checks */ |
1057 | if (elf_ex.e_type != ET_EXEC || elf_ex.e_phnum > 2 || | 1069 | if (elf_ex.e_type != ET_EXEC || elf_ex.e_phnum > 2 || |
1058 | !elf_check_arch(&elf_ex) || !file->f_op || !file->f_op->mmap) | 1070 | !elf_check_arch(&elf_ex) || !file->f_op || !file->f_op->mmap) |
1059 | goto out; | 1071 | goto out; |
1060 | 1072 | ||
1061 | /* Now read in all of the header information */ | 1073 | /* Now read in all of the header information */ |
@@ -1103,7 +1115,8 @@ static int load_elf_library(struct file *file) | |||
1103 | goto out_free_ph; | 1115 | goto out_free_ph; |
1104 | } | 1116 | } |
1105 | 1117 | ||
1106 | len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + ELF_MIN_ALIGN - 1); | 1118 | len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + |
1119 | ELF_MIN_ALIGN - 1); | ||
1107 | bss = eppnt->p_memsz + eppnt->p_vaddr; | 1120 | bss = eppnt->p_memsz + eppnt->p_vaddr; |
1108 | if (bss > len) { | 1121 | if (bss > len) { |
1109 | down_write(¤t->mm->mmap_sem); | 1122 | down_write(¤t->mm->mmap_sem); |
@@ -1162,7 +1175,7 @@ static int maydump(struct vm_area_struct *vma) | |||
1162 | if (vma->vm_flags & (VM_IO | VM_RESERVED)) | 1175 | if (vma->vm_flags & (VM_IO | VM_RESERVED)) |
1163 | return 0; | 1176 | return 0; |
1164 | 1177 | ||
1165 | /* Dump shared memory only if mapped from an anonymous file. */ | 1178 | /* Dump shared memory only if mapped from an anonymous file. */ |
1166 | if (vma->vm_flags & VM_SHARED) | 1179 | if (vma->vm_flags & VM_SHARED) |
1167 | return vma->vm_file->f_dentry->d_inode->i_nlink == 0; | 1180 | return vma->vm_file->f_dentry->d_inode->i_nlink == 0; |
1168 | 1181 | ||
@@ -1173,7 +1186,7 @@ static int maydump(struct vm_area_struct *vma) | |||
1173 | return 1; | 1186 | return 1; |
1174 | } | 1187 | } |
1175 | 1188 | ||
1176 | #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) | 1189 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
1177 | 1190 | ||
1178 | /* An ELF note in memory */ | 1191 | /* An ELF note in memory */ |
1179 | struct memelfnote | 1192 | struct memelfnote |
@@ -1276,11 +1289,11 @@ static void fill_note(struct memelfnote *note, const char *name, int type, | |||
1276 | } | 1289 | } |
1277 | 1290 | ||
1278 | /* | 1291 | /* |
1279 | * fill up all the fields in prstatus from the given task struct, except registers | 1292 | * fill up all the fields in prstatus from the given task struct, except |
1280 | * which need to be filled up separately. | 1293 | * registers which need to be filled up separately. |
1281 | */ | 1294 | */ |
1282 | static void fill_prstatus(struct elf_prstatus *prstatus, | 1295 | static void fill_prstatus(struct elf_prstatus *prstatus, |
1283 | struct task_struct *p, long signr) | 1296 | struct task_struct *p, long signr) |
1284 | { | 1297 | { |
1285 | prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; | 1298 | prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; |
1286 | prstatus->pr_sigpend = p->pending.signal.sig[0]; | 1299 | prstatus->pr_sigpend = p->pending.signal.sig[0]; |
@@ -1365,8 +1378,8 @@ struct elf_thread_status | |||
1365 | 1378 | ||
1366 | /* | 1379 | /* |
1367 | * In order to add the specific thread information for the elf file format, | 1380 | * In order to add the specific thread information for the elf file format, |
1368 | * we need to keep a linked list of every threads pr_status and then | 1381 | * we need to keep a linked list of every threads pr_status and then create |
1369 | * create a single section for them in the final core file. | 1382 | * a single section for them in the final core file. |
1370 | */ | 1383 | */ |
1371 | static int elf_dump_thread_status(long signr, struct elf_thread_status *t) | 1384 | static int elf_dump_thread_status(long signr, struct elf_thread_status *t) |
1372 | { | 1385 | { |
@@ -1377,19 +1390,23 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t) | |||
1377 | fill_prstatus(&t->prstatus, p, signr); | 1390 | fill_prstatus(&t->prstatus, p, signr); |
1378 | elf_core_copy_task_regs(p, &t->prstatus.pr_reg); | 1391 | elf_core_copy_task_regs(p, &t->prstatus.pr_reg); |
1379 | 1392 | ||
1380 | fill_note(&t->notes[0], "CORE", NT_PRSTATUS, sizeof(t->prstatus), &(t->prstatus)); | 1393 | fill_note(&t->notes[0], "CORE", NT_PRSTATUS, sizeof(t->prstatus), |
1394 | &(t->prstatus)); | ||
1381 | t->num_notes++; | 1395 | t->num_notes++; |
1382 | sz += notesize(&t->notes[0]); | 1396 | sz += notesize(&t->notes[0]); |
1383 | 1397 | ||
1384 | if ((t->prstatus.pr_fpvalid = elf_core_copy_task_fpregs(p, NULL, &t->fpu))) { | 1398 | if ((t->prstatus.pr_fpvalid = elf_core_copy_task_fpregs(p, NULL, |
1385 | fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(t->fpu), &(t->fpu)); | 1399 | &t->fpu))) { |
1400 | fill_note(&t->notes[1], "CORE", NT_PRFPREG, sizeof(t->fpu), | ||
1401 | &(t->fpu)); | ||
1386 | t->num_notes++; | 1402 | t->num_notes++; |
1387 | sz += notesize(&t->notes[1]); | 1403 | sz += notesize(&t->notes[1]); |
1388 | } | 1404 | } |
1389 | 1405 | ||
1390 | #ifdef ELF_CORE_COPY_XFPREGS | 1406 | #ifdef ELF_CORE_COPY_XFPREGS |
1391 | if (elf_core_copy_task_xfpregs(p, &t->xfpu)) { | 1407 | if (elf_core_copy_task_xfpregs(p, &t->xfpu)) { |
1392 | fill_note(&t->notes[2], "LINUX", NT_PRXFPREG, sizeof(t->xfpu), &t->xfpu); | 1408 | fill_note(&t->notes[2], "LINUX", NT_PRXFPREG, sizeof(t->xfpu), |
1409 | &t->xfpu); | ||
1393 | t->num_notes++; | 1410 | t->num_notes++; |
1394 | sz += notesize(&t->notes[2]); | 1411 | sz += notesize(&t->notes[2]); |
1395 | } | 1412 | } |
@@ -1404,7 +1421,7 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t) | |||
1404 | * and then they are actually written out. If we run out of core limit | 1421 | * and then they are actually written out. If we run out of core limit |
1405 | * we just truncate. | 1422 | * we just truncate. |
1406 | */ | 1423 | */ |
1407 | static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | 1424 | static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) |
1408 | { | 1425 | { |
1409 | #define NUM_NOTES 6 | 1426 | #define NUM_NOTES 6 |
1410 | int has_dumped = 0; | 1427 | int has_dumped = 0; |
@@ -1433,12 +1450,12 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1433 | /* | 1450 | /* |
1434 | * We no longer stop all VM operations. | 1451 | * We no longer stop all VM operations. |
1435 | * | 1452 | * |
1436 | * This is because those proceses that could possibly change map_count or | 1453 | * This is because those proceses that could possibly change map_count |
1437 | * the mmap / vma pages are now blocked in do_exit on current finishing | 1454 | * or the mmap / vma pages are now blocked in do_exit on current |
1438 | * this core dump. | 1455 | * finishing this core dump. |
1439 | * | 1456 | * |
1440 | * Only ptrace can touch these memory addresses, but it doesn't change | 1457 | * Only ptrace can touch these memory addresses, but it doesn't change |
1441 | * the map_count or the pages allocated. So no possibility of crashing | 1458 | * the map_count or the pages allocated. So no possibility of crashing |
1442 | * exists while dumping the mm->vm_next areas to the core file. | 1459 | * exists while dumping the mm->vm_next areas to the core file. |
1443 | */ | 1460 | */ |
1444 | 1461 | ||
@@ -1500,7 +1517,7 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1500 | #endif | 1517 | #endif |
1501 | 1518 | ||
1502 | /* Set up header */ | 1519 | /* Set up header */ |
1503 | fill_elf_header(elf, segs+1); /* including notes section */ | 1520 | fill_elf_header(elf, segs + 1); /* including notes section */ |
1504 | 1521 | ||
1505 | has_dumped = 1; | 1522 | has_dumped = 1; |
1506 | current->flags |= PF_DUMPCORE; | 1523 | current->flags |= PF_DUMPCORE; |
@@ -1510,24 +1527,24 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1510 | * with info from their /proc. | 1527 | * with info from their /proc. |
1511 | */ | 1528 | */ |
1512 | 1529 | ||
1513 | fill_note(notes +0, "CORE", NT_PRSTATUS, sizeof(*prstatus), prstatus); | 1530 | fill_note(notes + 0, "CORE", NT_PRSTATUS, sizeof(*prstatus), prstatus); |
1514 | |||
1515 | fill_psinfo(psinfo, current->group_leader, current->mm); | 1531 | fill_psinfo(psinfo, current->group_leader, current->mm); |
1516 | fill_note(notes +1, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); | 1532 | fill_note(notes + 1, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); |
1517 | 1533 | ||
1518 | numnote = 2; | 1534 | numnote = 2; |
1519 | 1535 | ||
1520 | auxv = (elf_addr_t *) current->mm->saved_auxv; | 1536 | auxv = (elf_addr_t *)current->mm->saved_auxv; |
1521 | 1537 | ||
1522 | i = 0; | 1538 | i = 0; |
1523 | do | 1539 | do |
1524 | i += 2; | 1540 | i += 2; |
1525 | while (auxv[i - 2] != AT_NULL); | 1541 | while (auxv[i - 2] != AT_NULL); |
1526 | fill_note(¬es[numnote++], "CORE", NT_AUXV, | 1542 | fill_note(¬es[numnote++], "CORE", NT_AUXV, |
1527 | i * sizeof (elf_addr_t), auxv); | 1543 | i * sizeof(elf_addr_t), auxv); |
1528 | 1544 | ||
1529 | /* Try to dump the FPU. */ | 1545 | /* Try to dump the FPU. */ |
1530 | if ((prstatus->pr_fpvalid = elf_core_copy_task_fpregs(current, regs, fpu))) | 1546 | if ((prstatus->pr_fpvalid = |
1547 | elf_core_copy_task_fpregs(current, regs, fpu))) | ||
1531 | fill_note(notes + numnote++, | 1548 | fill_note(notes + numnote++, |
1532 | "CORE", NT_PRFPREG, sizeof(*fpu), fpu); | 1549 | "CORE", NT_PRFPREG, sizeof(*fpu), fpu); |
1533 | #ifdef ELF_CORE_COPY_XFPREGS | 1550 | #ifdef ELF_CORE_COPY_XFPREGS |
@@ -1576,8 +1593,10 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1576 | phdr.p_memsz = sz; | 1593 | phdr.p_memsz = sz; |
1577 | offset += phdr.p_filesz; | 1594 | offset += phdr.p_filesz; |
1578 | phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0; | 1595 | phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0; |
1579 | if (vma->vm_flags & VM_WRITE) phdr.p_flags |= PF_W; | 1596 | if (vma->vm_flags & VM_WRITE) |
1580 | if (vma->vm_flags & VM_EXEC) phdr.p_flags |= PF_X; | 1597 | phdr.p_flags |= PF_W; |
1598 | if (vma->vm_flags & VM_EXEC) | ||
1599 | phdr.p_flags |= PF_X; | ||
1581 | phdr.p_align = ELF_EXEC_PAGESIZE; | 1600 | phdr.p_align = ELF_EXEC_PAGESIZE; |
1582 | 1601 | ||
1583 | DUMP_WRITE(&phdr, sizeof(phdr)); | 1602 | DUMP_WRITE(&phdr, sizeof(phdr)); |
@@ -1594,7 +1613,9 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1594 | 1613 | ||
1595 | /* write out the thread status notes section */ | 1614 | /* write out the thread status notes section */ |
1596 | list_for_each(t, &thread_list) { | 1615 | list_for_each(t, &thread_list) { |
1597 | struct elf_thread_status *tmp = list_entry(t, struct elf_thread_status, list); | 1616 | struct elf_thread_status *tmp = |
1617 | list_entry(t, struct elf_thread_status, list); | ||
1618 | |||
1598 | for (i = 0; i < tmp->num_notes; i++) | 1619 | for (i = 0; i < tmp->num_notes; i++) |
1599 | if (!writenote(&tmp->notes[i], file)) | 1620 | if (!writenote(&tmp->notes[i], file)) |
1600 | goto end_coredump; | 1621 | goto end_coredump; |
@@ -1611,18 +1632,19 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1611 | for (addr = vma->vm_start; | 1632 | for (addr = vma->vm_start; |
1612 | addr < vma->vm_end; | 1633 | addr < vma->vm_end; |
1613 | addr += PAGE_SIZE) { | 1634 | addr += PAGE_SIZE) { |
1614 | struct page* page; | 1635 | struct page *page; |
1615 | struct vm_area_struct *vma; | 1636 | struct vm_area_struct *vma; |
1616 | 1637 | ||
1617 | if (get_user_pages(current, current->mm, addr, 1, 0, 1, | 1638 | if (get_user_pages(current, current->mm, addr, 1, 0, 1, |
1618 | &page, &vma) <= 0) { | 1639 | &page, &vma) <= 0) { |
1619 | DUMP_SEEK (file->f_pos + PAGE_SIZE); | 1640 | DUMP_SEEK(file->f_pos + PAGE_SIZE); |
1620 | } else { | 1641 | } else { |
1621 | if (page == ZERO_PAGE(addr)) { | 1642 | if (page == ZERO_PAGE(addr)) { |
1622 | DUMP_SEEK (file->f_pos + PAGE_SIZE); | 1643 | DUMP_SEEK(file->f_pos + PAGE_SIZE); |
1623 | } else { | 1644 | } else { |
1624 | void *kaddr; | 1645 | void *kaddr; |
1625 | flush_cache_page(vma, addr, page_to_pfn(page)); | 1646 | flush_cache_page(vma, addr, |
1647 | page_to_pfn(page)); | ||
1626 | kaddr = kmap(page); | 1648 | kaddr = kmap(page); |
1627 | if ((size += PAGE_SIZE) > limit || | 1649 | if ((size += PAGE_SIZE) > limit || |
1628 | !dump_write(file, kaddr, | 1650 | !dump_write(file, kaddr, |
@@ -1644,7 +1666,8 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1644 | 1666 | ||
1645 | if ((off_t)file->f_pos != offset) { | 1667 | if ((off_t)file->f_pos != offset) { |
1646 | /* Sanity check */ | 1668 | /* Sanity check */ |
1647 | printk(KERN_WARNING "elf_core_dump: file->f_pos (%ld) != offset (%ld)\n", | 1669 | printk(KERN_WARNING |
1670 | "elf_core_dump: file->f_pos (%ld) != offset (%ld)\n", | ||
1648 | (off_t)file->f_pos, offset); | 1671 | (off_t)file->f_pos, offset); |
1649 | } | 1672 | } |
1650 | 1673 | ||
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index a2e48c999c24..eba4e23b9ca0 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -435,9 +435,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, | |||
435 | struct elf_fdpic_params *interp_params) | 435 | struct elf_fdpic_params *interp_params) |
436 | { | 436 | { |
437 | unsigned long sp, csp, nitems; | 437 | unsigned long sp, csp, nitems; |
438 | elf_caddr_t *argv, *envp; | 438 | elf_caddr_t __user *argv, *envp; |
439 | size_t platform_len = 0, len; | 439 | size_t platform_len = 0, len; |
440 | char *k_platform, *u_platform, *p; | 440 | char *k_platform; |
441 | char __user *u_platform, *p; | ||
441 | long hwcap; | 442 | long hwcap; |
442 | int loop; | 443 | int loop; |
443 | 444 | ||
@@ -462,12 +463,11 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, | |||
462 | if (k_platform) { | 463 | if (k_platform) { |
463 | platform_len = strlen(k_platform) + 1; | 464 | platform_len = strlen(k_platform) + 1; |
464 | sp -= platform_len; | 465 | sp -= platform_len; |
466 | u_platform = (char __user *) sp; | ||
465 | if (__copy_to_user(u_platform, k_platform, platform_len) != 0) | 467 | if (__copy_to_user(u_platform, k_platform, platform_len) != 0) |
466 | return -EFAULT; | 468 | return -EFAULT; |
467 | } | 469 | } |
468 | 470 | ||
469 | u_platform = (char *) sp; | ||
470 | |||
471 | #if defined(__i386__) && defined(CONFIG_SMP) | 471 | #if defined(__i386__) && defined(CONFIG_SMP) |
472 | /* in some cases (e.g. Hyper-Threading), we want to avoid L1 evictions | 472 | /* in some cases (e.g. Hyper-Threading), we want to avoid L1 evictions |
473 | * by the processes running on the same package. One thing we can do | 473 | * by the processes running on the same package. One thing we can do |
@@ -490,7 +490,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, | |||
490 | sp = (sp - len) & ~7UL; | 490 | sp = (sp - len) & ~7UL; |
491 | exec_params->map_addr = sp; | 491 | exec_params->map_addr = sp; |
492 | 492 | ||
493 | if (copy_to_user((void *) sp, exec_params->loadmap, len) != 0) | 493 | if (copy_to_user((void __user *) sp, exec_params->loadmap, len) != 0) |
494 | return -EFAULT; | 494 | return -EFAULT; |
495 | 495 | ||
496 | current->mm->context.exec_fdpic_loadmap = (unsigned long) sp; | 496 | current->mm->context.exec_fdpic_loadmap = (unsigned long) sp; |
@@ -501,7 +501,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, | |||
501 | sp = (sp - len) & ~7UL; | 501 | sp = (sp - len) & ~7UL; |
502 | interp_params->map_addr = sp; | 502 | interp_params->map_addr = sp; |
503 | 503 | ||
504 | if (copy_to_user((void *) sp, interp_params->loadmap, len) != 0) | 504 | if (copy_to_user((void __user *) sp, interp_params->loadmap, len) != 0) |
505 | return -EFAULT; | 505 | return -EFAULT; |
506 | 506 | ||
507 | current->mm->context.interp_fdpic_loadmap = (unsigned long) sp; | 507 | current->mm->context.interp_fdpic_loadmap = (unsigned long) sp; |
@@ -527,7 +527,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, | |||
527 | /* put the ELF interpreter info on the stack */ | 527 | /* put the ELF interpreter info on the stack */ |
528 | #define NEW_AUX_ENT(nr, id, val) \ | 528 | #define NEW_AUX_ENT(nr, id, val) \ |
529 | do { \ | 529 | do { \ |
530 | struct { unsigned long _id, _val; } *ent = (void *) csp; \ | 530 | struct { unsigned long _id, _val; } __user *ent = (void __user *) csp; \ |
531 | __put_user((id), &ent[nr]._id); \ | 531 | __put_user((id), &ent[nr]._id); \ |
532 | __put_user((val), &ent[nr]._val); \ | 532 | __put_user((val), &ent[nr]._val); \ |
533 | } while (0) | 533 | } while (0) |
@@ -564,13 +564,13 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, | |||
564 | 564 | ||
565 | /* allocate room for argv[] and envv[] */ | 565 | /* allocate room for argv[] and envv[] */ |
566 | csp -= (bprm->envc + 1) * sizeof(elf_caddr_t); | 566 | csp -= (bprm->envc + 1) * sizeof(elf_caddr_t); |
567 | envp = (elf_caddr_t *) csp; | 567 | envp = (elf_caddr_t __user *) csp; |
568 | csp -= (bprm->argc + 1) * sizeof(elf_caddr_t); | 568 | csp -= (bprm->argc + 1) * sizeof(elf_caddr_t); |
569 | argv = (elf_caddr_t *) csp; | 569 | argv = (elf_caddr_t __user *) csp; |
570 | 570 | ||
571 | /* stack argc */ | 571 | /* stack argc */ |
572 | csp -= sizeof(unsigned long); | 572 | csp -= sizeof(unsigned long); |
573 | __put_user(bprm->argc, (unsigned long *) csp); | 573 | __put_user(bprm->argc, (unsigned long __user *) csp); |
574 | 574 | ||
575 | BUG_ON(csp != sp); | 575 | BUG_ON(csp != sp); |
576 | 576 | ||
@@ -581,7 +581,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm, | |||
581 | current->mm->arg_start = current->mm->start_stack - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p); | 581 | current->mm->arg_start = current->mm->start_stack - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p); |
582 | #endif | 582 | #endif |
583 | 583 | ||
584 | p = (char *) current->mm->arg_start; | 584 | p = (char __user *) current->mm->arg_start; |
585 | for (loop = bprm->argc; loop > 0; loop--) { | 585 | for (loop = bprm->argc; loop > 0; loop--) { |
586 | __put_user((elf_caddr_t) p, argv++); | 586 | __put_user((elf_caddr_t) p, argv++); |
587 | len = strnlen_user(p, PAGE_SIZE * MAX_ARG_PAGES); | 587 | len = strnlen_user(p, PAGE_SIZE * MAX_ARG_PAGES); |
@@ -1025,7 +1025,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, | |||
1025 | /* clear the bit between beginning of mapping and beginning of PT_LOAD */ | 1025 | /* clear the bit between beginning of mapping and beginning of PT_LOAD */ |
1026 | if (prot & PROT_WRITE && disp > 0) { | 1026 | if (prot & PROT_WRITE && disp > 0) { |
1027 | kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr, disp); | 1027 | kdebug("clear[%d] ad=%lx sz=%lx", loop, maddr, disp); |
1028 | clear_user((void *) maddr, disp); | 1028 | clear_user((void __user *) maddr, disp); |
1029 | maddr += disp; | 1029 | maddr += disp; |
1030 | } | 1030 | } |
1031 | 1031 | ||
@@ -1059,7 +1059,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, | |||
1059 | if (prot & PROT_WRITE && excess1 > 0) { | 1059 | if (prot & PROT_WRITE && excess1 > 0) { |
1060 | kdebug("clear[%d] ad=%lx sz=%lx", | 1060 | kdebug("clear[%d] ad=%lx sz=%lx", |
1061 | loop, maddr + phdr->p_filesz, excess1); | 1061 | loop, maddr + phdr->p_filesz, excess1); |
1062 | clear_user((void *) maddr + phdr->p_filesz, excess1); | 1062 | clear_user((void __user *) maddr + phdr->p_filesz, excess1); |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | #else | 1065 | #else |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 599f36fd0f67..07a4996cca3f 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -739,10 +739,10 @@ static int bm_fill_super(struct super_block * sb, void * data, int silent) | |||
739 | return err; | 739 | return err; |
740 | } | 740 | } |
741 | 741 | ||
742 | static struct super_block *bm_get_sb(struct file_system_type *fs_type, | 742 | static int bm_get_sb(struct file_system_type *fs_type, |
743 | int flags, const char *dev_name, void *data) | 743 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
744 | { | 744 | { |
745 | return get_sb_single(fs_type, flags, data, bm_fill_super); | 745 | return get_sb_single(fs_type, flags, data, bm_fill_super, mnt); |
746 | } | 746 | } |
747 | 747 | ||
748 | static struct linux_binfmt misc_format = { | 748 | static struct linux_binfmt misc_format = { |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 44aaba202f78..028d9fb9c2d5 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -300,10 +300,10 @@ static struct super_operations bdev_sops = { | |||
300 | .clear_inode = bdev_clear_inode, | 300 | .clear_inode = bdev_clear_inode, |
301 | }; | 301 | }; |
302 | 302 | ||
303 | static struct super_block *bd_get_sb(struct file_system_type *fs_type, | 303 | static int bd_get_sb(struct file_system_type *fs_type, |
304 | int flags, const char *dev_name, void *data) | 304 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
305 | { | 305 | { |
306 | return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576); | 306 | return get_sb_pseudo(fs_type, "bdev:", &bdev_sops, 0x62646576, mnt); |
307 | } | 307 | } |
308 | 308 | ||
309 | static struct file_system_type bd_type = { | 309 | static struct file_system_type bd_type = { |
diff --git a/fs/buffer.c b/fs/buffer.c index 23f1f3a68077..373bb6292bdc 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -331,7 +331,6 @@ long do_fsync(struct file *file, int datasync) | |||
331 | goto out; | 331 | goto out; |
332 | } | 332 | } |
333 | 333 | ||
334 | current->flags |= PF_SYNCWRITE; | ||
335 | ret = filemap_fdatawrite(mapping); | 334 | ret = filemap_fdatawrite(mapping); |
336 | 335 | ||
337 | /* | 336 | /* |
@@ -346,7 +345,6 @@ long do_fsync(struct file *file, int datasync) | |||
346 | err = filemap_fdatawait(mapping); | 345 | err = filemap_fdatawait(mapping); |
347 | if (!ret) | 346 | if (!ret) |
348 | ret = err; | 347 | ret = err; |
349 | current->flags &= ~PF_SYNCWRITE; | ||
350 | out: | 348 | out: |
351 | return ret; | 349 | return ret; |
352 | } | 350 | } |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index c262d8874ce9..7520f4687158 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -166,8 +166,9 @@ cifs_put_super(struct super_block *sb) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | static int | 168 | static int |
169 | cifs_statfs(struct super_block *sb, struct kstatfs *buf) | 169 | cifs_statfs(struct dentry *dentry, struct kstatfs *buf) |
170 | { | 170 | { |
171 | struct super_block *sb = dentry->d_sb; | ||
171 | int xid; | 172 | int xid; |
172 | int rc = -EOPNOTSUPP; | 173 | int rc = -EOPNOTSUPP; |
173 | struct cifs_sb_info *cifs_sb; | 174 | struct cifs_sb_info *cifs_sb; |
@@ -460,9 +461,9 @@ struct super_operations cifs_super_ops = { | |||
460 | .remount_fs = cifs_remount, | 461 | .remount_fs = cifs_remount, |
461 | }; | 462 | }; |
462 | 463 | ||
463 | static struct super_block * | 464 | static int |
464 | cifs_get_sb(struct file_system_type *fs_type, | 465 | cifs_get_sb(struct file_system_type *fs_type, |
465 | int flags, const char *dev_name, void *data) | 466 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
466 | { | 467 | { |
467 | int rc; | 468 | int rc; |
468 | struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL); | 469 | struct super_block *sb = sget(fs_type, NULL, set_anon_super, NULL); |
@@ -470,7 +471,7 @@ cifs_get_sb(struct file_system_type *fs_type, | |||
470 | cFYI(1, ("Devname: %s flags: %d ", dev_name, flags)); | 471 | cFYI(1, ("Devname: %s flags: %d ", dev_name, flags)); |
471 | 472 | ||
472 | if (IS_ERR(sb)) | 473 | if (IS_ERR(sb)) |
473 | return sb; | 474 | return PTR_ERR(sb); |
474 | 475 | ||
475 | sb->s_flags = flags; | 476 | sb->s_flags = flags; |
476 | 477 | ||
@@ -478,10 +479,10 @@ cifs_get_sb(struct file_system_type *fs_type, | |||
478 | if (rc) { | 479 | if (rc) { |
479 | up_write(&sb->s_umount); | 480 | up_write(&sb->s_umount); |
480 | deactivate_super(sb); | 481 | deactivate_super(sb); |
481 | return ERR_PTR(rc); | 482 | return rc; |
482 | } | 483 | } |
483 | sb->s_flags |= MS_ACTIVE; | 484 | sb->s_flags |= MS_ACTIVE; |
484 | return sb; | 485 | return simple_set_mnt(mnt, sb); |
485 | } | 486 | } |
486 | 487 | ||
487 | static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov, | 488 | static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov, |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index c98755dca868..d56c0577c710 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -74,7 +74,7 @@ extern ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
74 | size_t write_size, loff_t * poffset); | 74 | size_t write_size, loff_t * poffset); |
75 | extern int cifs_lock(struct file *, int, struct file_lock *); | 75 | extern int cifs_lock(struct file *, int, struct file_lock *); |
76 | extern int cifs_fsync(struct file *, struct dentry *, int); | 76 | extern int cifs_fsync(struct file *, struct dentry *, int); |
77 | extern int cifs_flush(struct file *); | 77 | extern int cifs_flush(struct file *, fl_owner_t id); |
78 | extern int cifs_file_mmap(struct file * , struct vm_area_struct *); | 78 | extern int cifs_file_mmap(struct file * , struct vm_area_struct *); |
79 | extern const struct file_operations cifs_dir_ops; | 79 | extern const struct file_operations cifs_dir_ops; |
80 | extern int cifs_dir_open(struct inode *inode, struct file *file); | 80 | extern int cifs_dir_open(struct inode *inode, struct file *file); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e2b4ce1dad66..b4a18c1cab0a 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1079,9 +1079,9 @@ static int cifs_writepages(struct address_space *mapping, | |||
1079 | unsigned int bytes_written; | 1079 | unsigned int bytes_written; |
1080 | struct cifs_sb_info *cifs_sb; | 1080 | struct cifs_sb_info *cifs_sb; |
1081 | int done = 0; | 1081 | int done = 0; |
1082 | pgoff_t end = -1; | 1082 | pgoff_t end; |
1083 | pgoff_t index; | 1083 | pgoff_t index; |
1084 | int is_range = 0; | 1084 | int range_whole = 0; |
1085 | struct kvec iov[32]; | 1085 | struct kvec iov[32]; |
1086 | int len; | 1086 | int len; |
1087 | int n_iov = 0; | 1087 | int n_iov = 0; |
@@ -1122,16 +1122,14 @@ static int cifs_writepages(struct address_space *mapping, | |||
1122 | xid = GetXid(); | 1122 | xid = GetXid(); |
1123 | 1123 | ||
1124 | pagevec_init(&pvec, 0); | 1124 | pagevec_init(&pvec, 0); |
1125 | if (wbc->sync_mode == WB_SYNC_NONE) | 1125 | if (wbc->range_cyclic) { |
1126 | index = mapping->writeback_index; /* Start from prev offset */ | 1126 | index = mapping->writeback_index; /* Start from prev offset */ |
1127 | else { | 1127 | end = -1; |
1128 | index = 0; | 1128 | } else { |
1129 | scanned = 1; | 1129 | index = wbc->range_start >> PAGE_CACHE_SHIFT; |
1130 | } | 1130 | end = wbc->range_end >> PAGE_CACHE_SHIFT; |
1131 | if (wbc->start || wbc->end) { | 1131 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) |
1132 | index = wbc->start >> PAGE_CACHE_SHIFT; | 1132 | range_whole = 1; |
1133 | end = wbc->end >> PAGE_CACHE_SHIFT; | ||
1134 | is_range = 1; | ||
1135 | scanned = 1; | 1133 | scanned = 1; |
1136 | } | 1134 | } |
1137 | retry: | 1135 | retry: |
@@ -1167,7 +1165,7 @@ retry: | |||
1167 | break; | 1165 | break; |
1168 | } | 1166 | } |
1169 | 1167 | ||
1170 | if (unlikely(is_range) && (page->index > end)) { | 1168 | if (!wbc->range_cyclic && page->index > end) { |
1171 | done = 1; | 1169 | done = 1; |
1172 | unlock_page(page); | 1170 | unlock_page(page); |
1173 | break; | 1171 | break; |
@@ -1271,7 +1269,7 @@ retry: | |||
1271 | index = 0; | 1269 | index = 0; |
1272 | goto retry; | 1270 | goto retry; |
1273 | } | 1271 | } |
1274 | if (!is_range) | 1272 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) |
1275 | mapping->writeback_index = index; | 1273 | mapping->writeback_index = index; |
1276 | 1274 | ||
1277 | FreeXid(xid); | 1275 | FreeXid(xid); |
@@ -1419,7 +1417,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
1419 | * As file closes, flush all cached write data for this inode checking | 1417 | * As file closes, flush all cached write data for this inode checking |
1420 | * for write behind errors. | 1418 | * for write behind errors. |
1421 | */ | 1419 | */ |
1422 | int cifs_flush(struct file *file) | 1420 | int cifs_flush(struct file *file, fl_owner_t id) |
1423 | { | 1421 | { |
1424 | struct inode * inode = file->f_dentry->d_inode; | 1422 | struct inode * inode = file->f_dentry->d_inode; |
1425 | int rc = 0; | 1423 | int rc = 0; |
diff --git a/fs/coda/file.c b/fs/coda/file.c index 7c2642431fa5..cc66c681bd11 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
@@ -164,7 +164,7 @@ int coda_open(struct inode *coda_inode, struct file *coda_file) | |||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | int coda_flush(struct file *coda_file) | 167 | int coda_flush(struct file *coda_file, fl_owner_t id) |
168 | { | 168 | { |
169 | unsigned short flags = coda_file->f_flags & ~O_EXCL; | 169 | unsigned short flags = coda_file->f_flags & ~O_EXCL; |
170 | unsigned short coda_flags = coda_flags_to_cflags(flags); | 170 | unsigned short coda_flags = coda_flags_to_cflags(flags); |
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index ada1a81df6bd..87f1dc8aa24b 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
@@ -36,7 +36,7 @@ | |||
36 | /* VFS super_block ops */ | 36 | /* VFS super_block ops */ |
37 | static void coda_clear_inode(struct inode *); | 37 | static void coda_clear_inode(struct inode *); |
38 | static void coda_put_super(struct super_block *); | 38 | static void coda_put_super(struct super_block *); |
39 | static int coda_statfs(struct super_block *sb, struct kstatfs *buf); | 39 | static int coda_statfs(struct dentry *dentry, struct kstatfs *buf); |
40 | 40 | ||
41 | static kmem_cache_t * coda_inode_cachep; | 41 | static kmem_cache_t * coda_inode_cachep; |
42 | 42 | ||
@@ -278,13 +278,13 @@ struct inode_operations coda_file_inode_operations = { | |||
278 | .setattr = coda_setattr, | 278 | .setattr = coda_setattr, |
279 | }; | 279 | }; |
280 | 280 | ||
281 | static int coda_statfs(struct super_block *sb, struct kstatfs *buf) | 281 | static int coda_statfs(struct dentry *dentry, struct kstatfs *buf) |
282 | { | 282 | { |
283 | int error; | 283 | int error; |
284 | 284 | ||
285 | lock_kernel(); | 285 | lock_kernel(); |
286 | 286 | ||
287 | error = venus_statfs(sb, buf); | 287 | error = venus_statfs(dentry, buf); |
288 | 288 | ||
289 | unlock_kernel(); | 289 | unlock_kernel(); |
290 | 290 | ||
@@ -307,10 +307,10 @@ static int coda_statfs(struct super_block *sb, struct kstatfs *buf) | |||
307 | 307 | ||
308 | /* init_coda: used by filesystems.c to register coda */ | 308 | /* init_coda: used by filesystems.c to register coda */ |
309 | 309 | ||
310 | static struct super_block *coda_get_sb(struct file_system_type *fs_type, | 310 | static int coda_get_sb(struct file_system_type *fs_type, |
311 | int flags, const char *dev_name, void *data) | 311 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
312 | { | 312 | { |
313 | return get_sb_nodev(fs_type, flags, data, coda_fill_super); | 313 | return get_sb_nodev(fs_type, flags, data, coda_fill_super, mnt); |
314 | } | 314 | } |
315 | 315 | ||
316 | struct file_system_type coda_fs_type = { | 316 | struct file_system_type coda_fs_type = { |
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index 1bae99650a91..b040eba13a7d 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
@@ -611,7 +611,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid, | |||
611 | return error; | 611 | return error; |
612 | } | 612 | } |
613 | 613 | ||
614 | int venus_statfs(struct super_block *sb, struct kstatfs *sfs) | 614 | int venus_statfs(struct dentry *dentry, struct kstatfs *sfs) |
615 | { | 615 | { |
616 | union inputArgs *inp; | 616 | union inputArgs *inp; |
617 | union outputArgs *outp; | 617 | union outputArgs *outp; |
@@ -620,7 +620,7 @@ int venus_statfs(struct super_block *sb, struct kstatfs *sfs) | |||
620 | insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); | 620 | insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); |
621 | UPARG(CODA_STATFS); | 621 | UPARG(CODA_STATFS); |
622 | 622 | ||
623 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); | 623 | error = coda_upcall(coda_sbp(dentry->d_sb), insize, &outsize, inp); |
624 | 624 | ||
625 | if (!error) { | 625 | if (!error) { |
626 | sfs->f_blocks = outp->coda_statfs.stat.f_blocks; | 626 | sfs->f_blocks = outp->coda_statfs.stat.f_blocks; |
diff --git a/fs/compat.c b/fs/compat.c index b1f64786a613..7e7e5bc4f3cf 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -197,7 +197,7 @@ asmlinkage long compat_sys_statfs(const char __user *path, struct compat_statfs | |||
197 | error = user_path_walk(path, &nd); | 197 | error = user_path_walk(path, &nd); |
198 | if (!error) { | 198 | if (!error) { |
199 | struct kstatfs tmp; | 199 | struct kstatfs tmp; |
200 | error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); | 200 | error = vfs_statfs(nd.dentry, &tmp); |
201 | if (!error) | 201 | if (!error) |
202 | error = put_compat_statfs(buf, &tmp); | 202 | error = put_compat_statfs(buf, &tmp); |
203 | path_release(&nd); | 203 | path_release(&nd); |
@@ -215,7 +215,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user | |||
215 | file = fget(fd); | 215 | file = fget(fd); |
216 | if (!file) | 216 | if (!file) |
217 | goto out; | 217 | goto out; |
218 | error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); | 218 | error = vfs_statfs(file->f_dentry, &tmp); |
219 | if (!error) | 219 | if (!error) |
220 | error = put_compat_statfs(buf, &tmp); | 220 | error = put_compat_statfs(buf, &tmp); |
221 | fput(file); | 221 | fput(file); |
@@ -265,7 +265,7 @@ asmlinkage long compat_sys_statfs64(const char __user *path, compat_size_t sz, s | |||
265 | error = user_path_walk(path, &nd); | 265 | error = user_path_walk(path, &nd); |
266 | if (!error) { | 266 | if (!error) { |
267 | struct kstatfs tmp; | 267 | struct kstatfs tmp; |
268 | error = vfs_statfs(nd.dentry->d_inode->i_sb, &tmp); | 268 | error = vfs_statfs(nd.dentry, &tmp); |
269 | if (!error) | 269 | if (!error) |
270 | error = put_compat_statfs64(buf, &tmp); | 270 | error = put_compat_statfs64(buf, &tmp); |
271 | path_release(&nd); | 271 | path_release(&nd); |
@@ -286,7 +286,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c | |||
286 | file = fget(fd); | 286 | file = fget(fd); |
287 | if (!file) | 287 | if (!file) |
288 | goto out; | 288 | goto out; |
289 | error = vfs_statfs(file->f_dentry->d_inode->i_sb, &tmp); | 289 | error = vfs_statfs(file->f_dentry, &tmp); |
290 | if (!error) | 290 | if (!error) |
291 | error = put_compat_statfs64(buf, &tmp); | 291 | error = put_compat_statfs64(buf, &tmp); |
292 | fput(file); | 292 | fput(file); |
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index f920d30478e5..94dab7bdd851 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
@@ -103,10 +103,10 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent) | |||
103 | return 0; | 103 | return 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | static struct super_block *configfs_get_sb(struct file_system_type *fs_type, | 106 | static int configfs_get_sb(struct file_system_type *fs_type, |
107 | int flags, const char *dev_name, void *data) | 107 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
108 | { | 108 | { |
109 | return get_sb_single(fs_type, flags, data, configfs_fill_super); | 109 | return get_sb_single(fs_type, flags, data, configfs_fill_super, mnt); |
110 | } | 110 | } |
111 | 111 | ||
112 | static struct file_system_type configfs_fs_type = { | 112 | static struct file_system_type configfs_fs_type = { |
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 9efcc3a164e8..c45d73860803 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c | |||
@@ -181,9 +181,7 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i | |||
181 | struct page *page = NULL; | 181 | struct page *page = NULL; |
182 | 182 | ||
183 | if (blocknr + i < devsize) { | 183 | if (blocknr + i < devsize) { |
184 | page = read_cache_page(mapping, blocknr + i, | 184 | page = read_mapping_page(mapping, blocknr + i, NULL); |
185 | (filler_t *)mapping->a_ops->readpage, | ||
186 | NULL); | ||
187 | /* synchronous error? */ | 185 | /* synchronous error? */ |
188 | if (IS_ERR(page)) | 186 | if (IS_ERR(page)) |
189 | page = NULL; | 187 | page = NULL; |
@@ -322,8 +320,10 @@ out: | |||
322 | return -EINVAL; | 320 | return -EINVAL; |
323 | } | 321 | } |
324 | 322 | ||
325 | static int cramfs_statfs(struct super_block *sb, struct kstatfs *buf) | 323 | static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
326 | { | 324 | { |
325 | struct super_block *sb = dentry->d_sb; | ||
326 | |||
327 | buf->f_type = CRAMFS_MAGIC; | 327 | buf->f_type = CRAMFS_MAGIC; |
328 | buf->f_bsize = PAGE_CACHE_SIZE; | 328 | buf->f_bsize = PAGE_CACHE_SIZE; |
329 | buf->f_blocks = CRAMFS_SB(sb)->blocks; | 329 | buf->f_blocks = CRAMFS_SB(sb)->blocks; |
@@ -528,10 +528,11 @@ static struct super_operations cramfs_ops = { | |||
528 | .statfs = cramfs_statfs, | 528 | .statfs = cramfs_statfs, |
529 | }; | 529 | }; |
530 | 530 | ||
531 | static struct super_block *cramfs_get_sb(struct file_system_type *fs_type, | 531 | static int cramfs_get_sb(struct file_system_type *fs_type, |
532 | int flags, const char *dev_name, void *data) | 532 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
533 | { | 533 | { |
534 | return get_sb_bdev(fs_type, flags, dev_name, data, cramfs_fill_super); | 534 | return get_sb_bdev(fs_type, flags, dev_name, data, cramfs_fill_super, |
535 | mnt); | ||
535 | } | 536 | } |
536 | 537 | ||
537 | static struct file_system_type cramfs_fs_type = { | 538 | static struct file_system_type cramfs_fs_type = { |
diff --git a/fs/dcache.c b/fs/dcache.c index 59dbc92c2079..313b54b2b8f2 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -687,46 +687,6 @@ void shrink_dcache_parent(struct dentry * parent) | |||
687 | prune_dcache(found, parent->d_sb); | 687 | prune_dcache(found, parent->d_sb); |
688 | } | 688 | } |
689 | 689 | ||
690 | /** | ||
691 | * shrink_dcache_anon - further prune the cache | ||
692 | * @head: head of d_hash list of dentries to prune | ||
693 | * | ||
694 | * Prune the dentries that are anonymous | ||
695 | * | ||
696 | * parsing d_hash list does not hlist_for_each_entry_rcu() as it | ||
697 | * done under dcache_lock. | ||
698 | * | ||
699 | */ | ||
700 | void shrink_dcache_anon(struct super_block *sb) | ||
701 | { | ||
702 | struct hlist_node *lp; | ||
703 | struct hlist_head *head = &sb->s_anon; | ||
704 | int found; | ||
705 | do { | ||
706 | found = 0; | ||
707 | spin_lock(&dcache_lock); | ||
708 | hlist_for_each(lp, head) { | ||
709 | struct dentry *this = hlist_entry(lp, struct dentry, d_hash); | ||
710 | if (!list_empty(&this->d_lru)) { | ||
711 | dentry_stat.nr_unused--; | ||
712 | list_del_init(&this->d_lru); | ||
713 | } | ||
714 | |||
715 | /* | ||
716 | * move only zero ref count dentries to the end | ||
717 | * of the unused list for prune_dcache | ||
718 | */ | ||
719 | if (!atomic_read(&this->d_count)) { | ||
720 | list_add_tail(&this->d_lru, &dentry_unused); | ||
721 | dentry_stat.nr_unused++; | ||
722 | found++; | ||
723 | } | ||
724 | } | ||
725 | spin_unlock(&dcache_lock); | ||
726 | prune_dcache(found, sb); | ||
727 | } while(found); | ||
728 | } | ||
729 | |||
730 | /* | 690 | /* |
731 | * Scan `nr' dentries and return the number which remain. | 691 | * Scan `nr' dentries and return the number which remain. |
732 | * | 692 | * |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index b55b4ea9a676..440128ebef3b 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -111,11 +111,11 @@ static int debug_fill_super(struct super_block *sb, void *data, int silent) | |||
111 | return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); | 111 | return simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); |
112 | } | 112 | } |
113 | 113 | ||
114 | static struct super_block *debug_get_sb(struct file_system_type *fs_type, | 114 | static int debug_get_sb(struct file_system_type *fs_type, |
115 | int flags, const char *dev_name, | 115 | int flags, const char *dev_name, |
116 | void *data) | 116 | void *data, struct vfsmount *mnt) |
117 | { | 117 | { |
118 | return get_sb_single(fs_type, flags, data, debug_fill_super); | 118 | return get_sb_single(fs_type, flags, data, debug_fill_super, mnt); |
119 | } | 119 | } |
120 | 120 | ||
121 | static struct file_system_type debug_fs_type = { | 121 | static struct file_system_type debug_fs_type = { |
diff --git a/fs/devfs/base.c b/fs/devfs/base.c index 52f5059c4f31..51a97f132745 100644 --- a/fs/devfs/base.c +++ b/fs/devfs/base.c | |||
@@ -2549,11 +2549,11 @@ static int devfs_fill_super(struct super_block *sb, void *data, int silent) | |||
2549 | return -EINVAL; | 2549 | return -EINVAL; |
2550 | } /* End Function devfs_fill_super */ | 2550 | } /* End Function devfs_fill_super */ |
2551 | 2551 | ||
2552 | static struct super_block *devfs_get_sb(struct file_system_type *fs_type, | 2552 | static int devfs_get_sb(struct file_system_type *fs_type, |
2553 | int flags, const char *dev_name, | 2553 | int flags, const char *dev_name, |
2554 | void *data) | 2554 | void *data, struct vfsmount *mnt) |
2555 | { | 2555 | { |
2556 | return get_sb_single(fs_type, flags, data, devfs_fill_super); | 2556 | return get_sb_single(fs_type, flags, data, devfs_fill_super, mnt); |
2557 | } | 2557 | } |
2558 | 2558 | ||
2559 | static struct file_system_type devfs_fs_type = { | 2559 | static struct file_system_type devfs_fs_type = { |
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 14c5620b5cab..f7aef5bb584a 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
@@ -130,10 +130,10 @@ fail: | |||
130 | return -ENOMEM; | 130 | return -ENOMEM; |
131 | } | 131 | } |
132 | 132 | ||
133 | static struct super_block *devpts_get_sb(struct file_system_type *fs_type, | 133 | static int devpts_get_sb(struct file_system_type *fs_type, |
134 | int flags, const char *dev_name, void *data) | 134 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
135 | { | 135 | { |
136 | return get_sb_single(fs_type, flags, data, devpts_fill_super); | 136 | return get_sb_single(fs_type, flags, data, devpts_fill_super, mnt); |
137 | } | 137 | } |
138 | 138 | ||
139 | static struct file_system_type devpts_fs_type = { | 139 | static struct file_system_type devpts_fs_type = { |
diff --git a/fs/direct-io.c b/fs/direct-io.c index b05d1b218776..538fb0418fba 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -162,7 +162,7 @@ static int dio_refill_pages(struct dio *dio) | |||
162 | NULL); /* vmas */ | 162 | NULL); /* vmas */ |
163 | up_read(¤t->mm->mmap_sem); | 163 | up_read(¤t->mm->mmap_sem); |
164 | 164 | ||
165 | if (ret < 0 && dio->blocks_available && (dio->rw == WRITE)) { | 165 | if (ret < 0 && dio->blocks_available && (dio->rw & WRITE)) { |
166 | struct page *page = ZERO_PAGE(dio->curr_user_address); | 166 | struct page *page = ZERO_PAGE(dio->curr_user_address); |
167 | /* | 167 | /* |
168 | * A memory fault, but the filesystem has some outstanding | 168 | * A memory fault, but the filesystem has some outstanding |
@@ -535,7 +535,7 @@ static int get_more_blocks(struct dio *dio) | |||
535 | map_bh->b_state = 0; | 535 | map_bh->b_state = 0; |
536 | map_bh->b_size = fs_count << dio->inode->i_blkbits; | 536 | map_bh->b_size = fs_count << dio->inode->i_blkbits; |
537 | 537 | ||
538 | create = dio->rw == WRITE; | 538 | create = dio->rw & WRITE; |
539 | if (dio->lock_type == DIO_LOCKING) { | 539 | if (dio->lock_type == DIO_LOCKING) { |
540 | if (dio->block_in_file < (i_size_read(dio->inode) >> | 540 | if (dio->block_in_file < (i_size_read(dio->inode) >> |
541 | dio->blkbits)) | 541 | dio->blkbits)) |
@@ -867,7 +867,7 @@ do_holes: | |||
867 | loff_t i_size_aligned; | 867 | loff_t i_size_aligned; |
868 | 868 | ||
869 | /* AKPM: eargh, -ENOTBLK is a hack */ | 869 | /* AKPM: eargh, -ENOTBLK is a hack */ |
870 | if (dio->rw == WRITE) { | 870 | if (dio->rw & WRITE) { |
871 | page_cache_release(page); | 871 | page_cache_release(page); |
872 | return -ENOTBLK; | 872 | return -ENOTBLK; |
873 | } | 873 | } |
@@ -1045,7 +1045,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, | |||
1045 | } | 1045 | } |
1046 | } /* end iovec loop */ | 1046 | } /* end iovec loop */ |
1047 | 1047 | ||
1048 | if (ret == -ENOTBLK && rw == WRITE) { | 1048 | if (ret == -ENOTBLK && (rw & WRITE)) { |
1049 | /* | 1049 | /* |
1050 | * The remaining part of the request will be | 1050 | * The remaining part of the request will be |
1051 | * be handled by buffered I/O when we return | 1051 | * be handled by buffered I/O when we return |
@@ -1089,7 +1089,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, | |||
1089 | if (dio->is_async) { | 1089 | if (dio->is_async) { |
1090 | int should_wait = 0; | 1090 | int should_wait = 0; |
1091 | 1091 | ||
1092 | if (dio->result < dio->size && rw == WRITE) { | 1092 | if (dio->result < dio->size && (rw & WRITE)) { |
1093 | dio->waiter = current; | 1093 | dio->waiter = current; |
1094 | should_wait = 1; | 1094 | should_wait = 1; |
1095 | } | 1095 | } |
@@ -1142,7 +1142,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, | |||
1142 | ret = transferred; | 1142 | ret = transferred; |
1143 | 1143 | ||
1144 | /* We could have also come here on an AIO file extend */ | 1144 | /* We could have also come here on an AIO file extend */ |
1145 | if (!is_sync_kiocb(iocb) && rw == WRITE && | 1145 | if (!is_sync_kiocb(iocb) && (rw & WRITE) && |
1146 | ret >= 0 && dio->result == dio->size) | 1146 | ret >= 0 && dio->result == dio->size) |
1147 | /* | 1147 | /* |
1148 | * For AIO writes where we have completed the | 1148 | * For AIO writes where we have completed the |
@@ -1194,7 +1194,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1194 | int acquire_i_mutex = 0; | 1194 | int acquire_i_mutex = 0; |
1195 | 1195 | ||
1196 | if (rw & WRITE) | 1196 | if (rw & WRITE) |
1197 | current->flags |= PF_SYNCWRITE; | 1197 | rw = WRITE_SYNC; |
1198 | 1198 | ||
1199 | if (bdev) | 1199 | if (bdev) |
1200 | bdev_blkbits = blksize_bits(bdev_hardsect_size(bdev)); | 1200 | bdev_blkbits = blksize_bits(bdev_hardsect_size(bdev)); |
@@ -1270,7 +1270,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1270 | * even for AIO, we need to wait for i/o to complete before | 1270 | * even for AIO, we need to wait for i/o to complete before |
1271 | * returning in this case. | 1271 | * returning in this case. |
1272 | */ | 1272 | */ |
1273 | dio->is_async = !is_sync_kiocb(iocb) && !((rw == WRITE) && | 1273 | dio->is_async = !is_sync_kiocb(iocb) && !((rw & WRITE) && |
1274 | (end > i_size_read(inode))); | 1274 | (end > i_size_read(inode))); |
1275 | 1275 | ||
1276 | retval = direct_io_worker(rw, iocb, inode, iov, offset, | 1276 | retval = direct_io_worker(rw, iocb, inode, iov, offset, |
@@ -1284,8 +1284,6 @@ out: | |||
1284 | mutex_unlock(&inode->i_mutex); | 1284 | mutex_unlock(&inode->i_mutex); |
1285 | else if (acquire_i_mutex) | 1285 | else if (acquire_i_mutex) |
1286 | mutex_lock(&inode->i_mutex); | 1286 | mutex_lock(&inode->i_mutex); |
1287 | if (rw & WRITE) | ||
1288 | current->flags &= ~PF_SYNCWRITE; | ||
1289 | return retval; | 1287 | return retval; |
1290 | } | 1288 | } |
1291 | EXPORT_SYMBOL(__blockdev_direct_IO); | 1289 | EXPORT_SYMBOL(__blockdev_direct_IO); |
diff --git a/fs/efs/super.c b/fs/efs/super.c index dff623e3ddbf..8ac2462ae5dd 100644 --- a/fs/efs/super.c +++ b/fs/efs/super.c | |||
@@ -15,13 +15,13 @@ | |||
15 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
16 | #include <linux/vfs.h> | 16 | #include <linux/vfs.h> |
17 | 17 | ||
18 | static int efs_statfs(struct super_block *s, struct kstatfs *buf); | 18 | static int efs_statfs(struct dentry *dentry, struct kstatfs *buf); |
19 | static int efs_fill_super(struct super_block *s, void *d, int silent); | 19 | static int efs_fill_super(struct super_block *s, void *d, int silent); |
20 | 20 | ||
21 | static struct super_block *efs_get_sb(struct file_system_type *fs_type, | 21 | static int efs_get_sb(struct file_system_type *fs_type, |
22 | int flags, const char *dev_name, void *data) | 22 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
23 | { | 23 | { |
24 | return get_sb_bdev(fs_type, flags, dev_name, data, efs_fill_super); | 24 | return get_sb_bdev(fs_type, flags, dev_name, data, efs_fill_super, mnt); |
25 | } | 25 | } |
26 | 26 | ||
27 | static struct file_system_type efs_fs_type = { | 27 | static struct file_system_type efs_fs_type = { |
@@ -322,8 +322,8 @@ out_no_fs: | |||
322 | return -EINVAL; | 322 | return -EINVAL; |
323 | } | 323 | } |
324 | 324 | ||
325 | static int efs_statfs(struct super_block *s, struct kstatfs *buf) { | 325 | static int efs_statfs(struct dentry *dentry, struct kstatfs *buf) { |
326 | struct efs_sb_info *sb = SUPER_INFO(s); | 326 | struct efs_sb_info *sb = SUPER_INFO(dentry->d_sb); |
327 | 327 | ||
328 | buf->f_type = EFS_SUPER_MAGIC; /* efs magic number */ | 328 | buf->f_type = EFS_SUPER_MAGIC; /* efs magic number */ |
329 | buf->f_bsize = EFS_BLOCKSIZE; /* blocksize */ | 329 | buf->f_bsize = EFS_BLOCKSIZE; /* blocksize */ |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 2695337d4d64..08e7e6a555ca 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -268,9 +268,9 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, | |||
268 | int maxevents, long timeout); | 268 | int maxevents, long timeout); |
269 | static int eventpollfs_delete_dentry(struct dentry *dentry); | 269 | static int eventpollfs_delete_dentry(struct dentry *dentry); |
270 | static struct inode *ep_eventpoll_inode(void); | 270 | static struct inode *ep_eventpoll_inode(void); |
271 | static struct super_block *eventpollfs_get_sb(struct file_system_type *fs_type, | 271 | static int eventpollfs_get_sb(struct file_system_type *fs_type, |
272 | int flags, const char *dev_name, | 272 | int flags, const char *dev_name, |
273 | void *data); | 273 | void *data, struct vfsmount *mnt); |
274 | 274 | ||
275 | /* | 275 | /* |
276 | * This semaphore is used to serialize ep_free() and eventpoll_release_file(). | 276 | * This semaphore is used to serialize ep_free() and eventpoll_release_file(). |
@@ -1595,11 +1595,12 @@ eexit_1: | |||
1595 | } | 1595 | } |
1596 | 1596 | ||
1597 | 1597 | ||
1598 | static struct super_block * | 1598 | static int |
1599 | eventpollfs_get_sb(struct file_system_type *fs_type, int flags, | 1599 | eventpollfs_get_sb(struct file_system_type *fs_type, int flags, |
1600 | const char *dev_name, void *data) | 1600 | const char *dev_name, void *data, struct vfsmount *mnt) |
1601 | { | 1601 | { |
1602 | return get_sb_pseudo(fs_type, "eventpoll:", NULL, EVENTPOLLFS_MAGIC); | 1602 | return get_sb_pseudo(fs_type, "eventpoll:", NULL, EVENTPOLLFS_MAGIC, |
1603 | mnt); | ||
1603 | } | 1604 | } |
1604 | 1605 | ||
1605 | 1606 | ||
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index d672aa9f4061..3c1c9aaaca6b 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
@@ -159,8 +159,7 @@ fail: | |||
159 | static struct page * ext2_get_page(struct inode *dir, unsigned long n) | 159 | static struct page * ext2_get_page(struct inode *dir, unsigned long n) |
160 | { | 160 | { |
161 | struct address_space *mapping = dir->i_mapping; | 161 | struct address_space *mapping = dir->i_mapping; |
162 | struct page *page = read_cache_page(mapping, n, | 162 | struct page *page = read_mapping_page(mapping, n, NULL); |
163 | (filler_t*)mapping->a_ops->readpage, NULL); | ||
164 | if (!IS_ERR(page)) { | 163 | if (!IS_ERR(page)) { |
165 | wait_on_page_locked(page); | 164 | wait_on_page_locked(page); |
166 | kmap(page); | 165 | kmap(page); |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 7e30bae174ed..ee4ba759581e 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -39,7 +39,7 @@ | |||
39 | static void ext2_sync_super(struct super_block *sb, | 39 | static void ext2_sync_super(struct super_block *sb, |
40 | struct ext2_super_block *es); | 40 | struct ext2_super_block *es); |
41 | static int ext2_remount (struct super_block * sb, int * flags, char * data); | 41 | static int ext2_remount (struct super_block * sb, int * flags, char * data); |
42 | static int ext2_statfs (struct super_block * sb, struct kstatfs * buf); | 42 | static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf); |
43 | 43 | ||
44 | void ext2_error (struct super_block * sb, const char * function, | 44 | void ext2_error (struct super_block * sb, const char * function, |
45 | const char * fmt, ...) | 45 | const char * fmt, ...) |
@@ -834,9 +834,6 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
834 | printk ("EXT2-fs: not enough memory\n"); | 834 | printk ("EXT2-fs: not enough memory\n"); |
835 | goto failed_mount; | 835 | goto failed_mount; |
836 | } | 836 | } |
837 | percpu_counter_init(&sbi->s_freeblocks_counter); | ||
838 | percpu_counter_init(&sbi->s_freeinodes_counter); | ||
839 | percpu_counter_init(&sbi->s_dirs_counter); | ||
840 | bgl_lock_init(&sbi->s_blockgroup_lock); | 837 | bgl_lock_init(&sbi->s_blockgroup_lock); |
841 | sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts), | 838 | sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts), |
842 | GFP_KERNEL); | 839 | GFP_KERNEL); |
@@ -863,6 +860,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
863 | sbi->s_gdb_count = db_count; | 860 | sbi->s_gdb_count = db_count; |
864 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); | 861 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |
865 | spin_lock_init(&sbi->s_next_gen_lock); | 862 | spin_lock_init(&sbi->s_next_gen_lock); |
863 | |||
864 | percpu_counter_init(&sbi->s_freeblocks_counter, | ||
865 | ext2_count_free_blocks(sb)); | ||
866 | percpu_counter_init(&sbi->s_freeinodes_counter, | ||
867 | ext2_count_free_inodes(sb)); | ||
868 | percpu_counter_init(&sbi->s_dirs_counter, | ||
869 | ext2_count_dirs(sb)); | ||
866 | /* | 870 | /* |
867 | * set up enough so that it can read an inode | 871 | * set up enough so that it can read an inode |
868 | */ | 872 | */ |
@@ -874,24 +878,18 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
874 | if (!sb->s_root) { | 878 | if (!sb->s_root) { |
875 | iput(root); | 879 | iput(root); |
876 | printk(KERN_ERR "EXT2-fs: get root inode failed\n"); | 880 | printk(KERN_ERR "EXT2-fs: get root inode failed\n"); |
877 | goto failed_mount2; | 881 | goto failed_mount3; |
878 | } | 882 | } |
879 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { | 883 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { |
880 | dput(sb->s_root); | 884 | dput(sb->s_root); |
881 | sb->s_root = NULL; | 885 | sb->s_root = NULL; |
882 | printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n"); | 886 | printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n"); |
883 | goto failed_mount2; | 887 | goto failed_mount3; |
884 | } | 888 | } |
885 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) | 889 | if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) |
886 | ext2_warning(sb, __FUNCTION__, | 890 | ext2_warning(sb, __FUNCTION__, |
887 | "mounting ext3 filesystem as ext2"); | 891 | "mounting ext3 filesystem as ext2"); |
888 | ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); | 892 | ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); |
889 | percpu_counter_mod(&sbi->s_freeblocks_counter, | ||
890 | ext2_count_free_blocks(sb)); | ||
891 | percpu_counter_mod(&sbi->s_freeinodes_counter, | ||
892 | ext2_count_free_inodes(sb)); | ||
893 | percpu_counter_mod(&sbi->s_dirs_counter, | ||
894 | ext2_count_dirs(sb)); | ||
895 | return 0; | 893 | return 0; |
896 | 894 | ||
897 | cantfind_ext2: | 895 | cantfind_ext2: |
@@ -899,7 +897,10 @@ cantfind_ext2: | |||
899 | printk("VFS: Can't find an ext2 filesystem on dev %s.\n", | 897 | printk("VFS: Can't find an ext2 filesystem on dev %s.\n", |
900 | sb->s_id); | 898 | sb->s_id); |
901 | goto failed_mount; | 899 | goto failed_mount; |
902 | 900 | failed_mount3: | |
901 | percpu_counter_destroy(&sbi->s_freeblocks_counter); | ||
902 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | ||
903 | percpu_counter_destroy(&sbi->s_dirs_counter); | ||
903 | failed_mount2: | 904 | failed_mount2: |
904 | for (i = 0; i < db_count; i++) | 905 | for (i = 0; i < db_count; i++) |
905 | brelse(sbi->s_group_desc[i]); | 906 | brelse(sbi->s_group_desc[i]); |
@@ -1038,8 +1039,9 @@ restore_opts: | |||
1038 | return err; | 1039 | return err; |
1039 | } | 1040 | } |
1040 | 1041 | ||
1041 | static int ext2_statfs (struct super_block * sb, struct kstatfs * buf) | 1042 | static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf) |
1042 | { | 1043 | { |
1044 | struct super_block *sb = dentry->d_sb; | ||
1043 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 1045 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
1044 | unsigned long overhead; | 1046 | unsigned long overhead; |
1045 | int i; | 1047 | int i; |
@@ -1087,10 +1089,10 @@ static int ext2_statfs (struct super_block * sb, struct kstatfs * buf) | |||
1087 | return 0; | 1089 | return 0; |
1088 | } | 1090 | } |
1089 | 1091 | ||
1090 | static struct super_block *ext2_get_sb(struct file_system_type *fs_type, | 1092 | static int ext2_get_sb(struct file_system_type *fs_type, |
1091 | int flags, const char *dev_name, void *data) | 1093 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
1092 | { | 1094 | { |
1093 | return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super); | 1095 | return get_sb_bdev(fs_type, flags, dev_name, data, ext2_fill_super, mnt); |
1094 | } | 1096 | } |
1095 | 1097 | ||
1096 | #ifdef CONFIG_QUOTA | 1098 | #ifdef CONFIG_QUOTA |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index f8a5266ea1ff..a60cc6ec130f 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -58,7 +58,7 @@ static int ext3_sync_fs(struct super_block *sb, int wait); | |||
58 | static const char *ext3_decode_error(struct super_block * sb, int errno, | 58 | static const char *ext3_decode_error(struct super_block * sb, int errno, |
59 | char nbuf[16]); | 59 | char nbuf[16]); |
60 | static int ext3_remount (struct super_block * sb, int * flags, char * data); | 60 | static int ext3_remount (struct super_block * sb, int * flags, char * data); |
61 | static int ext3_statfs (struct super_block * sb, struct kstatfs * buf); | 61 | static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf); |
62 | static void ext3_unlockfs(struct super_block *sb); | 62 | static void ext3_unlockfs(struct super_block *sb); |
63 | static void ext3_write_super (struct super_block * sb); | 63 | static void ext3_write_super (struct super_block * sb); |
64 | static void ext3_write_super_lockfs(struct super_block *sb); | 64 | static void ext3_write_super_lockfs(struct super_block *sb); |
@@ -499,20 +499,21 @@ static void ext3_clear_inode(struct inode *inode) | |||
499 | { | 499 | { |
500 | struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; | 500 | struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; |
501 | #ifdef CONFIG_EXT3_FS_POSIX_ACL | 501 | #ifdef CONFIG_EXT3_FS_POSIX_ACL |
502 | if (EXT3_I(inode)->i_acl && | 502 | if (EXT3_I(inode)->i_acl && |
503 | EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { | 503 | EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { |
504 | posix_acl_release(EXT3_I(inode)->i_acl); | 504 | posix_acl_release(EXT3_I(inode)->i_acl); |
505 | EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; | 505 | EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; |
506 | } | 506 | } |
507 | if (EXT3_I(inode)->i_default_acl && | 507 | if (EXT3_I(inode)->i_default_acl && |
508 | EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { | 508 | EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { |
509 | posix_acl_release(EXT3_I(inode)->i_default_acl); | 509 | posix_acl_release(EXT3_I(inode)->i_default_acl); |
510 | EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; | 510 | EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; |
511 | } | 511 | } |
512 | #endif | 512 | #endif |
513 | ext3_discard_reservation(inode); | 513 | ext3_discard_reservation(inode); |
514 | EXT3_I(inode)->i_block_alloc_info = NULL; | 514 | EXT3_I(inode)->i_block_alloc_info = NULL; |
515 | kfree(rsv); | 515 | if (unlikely(rsv)) |
516 | kfree(rsv); | ||
516 | } | 517 | } |
517 | 518 | ||
518 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) | 519 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) |
@@ -1579,9 +1580,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1579 | goto failed_mount; | 1580 | goto failed_mount; |
1580 | } | 1581 | } |
1581 | 1582 | ||
1582 | percpu_counter_init(&sbi->s_freeblocks_counter); | ||
1583 | percpu_counter_init(&sbi->s_freeinodes_counter); | ||
1584 | percpu_counter_init(&sbi->s_dirs_counter); | ||
1585 | bgl_lock_init(&sbi->s_blockgroup_lock); | 1583 | bgl_lock_init(&sbi->s_blockgroup_lock); |
1586 | 1584 | ||
1587 | for (i = 0; i < db_count; i++) { | 1585 | for (i = 0; i < db_count; i++) { |
@@ -1601,6 +1599,14 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1601 | sbi->s_gdb_count = db_count; | 1599 | sbi->s_gdb_count = db_count; |
1602 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); | 1600 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |
1603 | spin_lock_init(&sbi->s_next_gen_lock); | 1601 | spin_lock_init(&sbi->s_next_gen_lock); |
1602 | |||
1603 | percpu_counter_init(&sbi->s_freeblocks_counter, | ||
1604 | ext3_count_free_blocks(sb)); | ||
1605 | percpu_counter_init(&sbi->s_freeinodes_counter, | ||
1606 | ext3_count_free_inodes(sb)); | ||
1607 | percpu_counter_init(&sbi->s_dirs_counter, | ||
1608 | ext3_count_dirs(sb)); | ||
1609 | |||
1604 | /* per fileystem reservation list head & lock */ | 1610 | /* per fileystem reservation list head & lock */ |
1605 | spin_lock_init(&sbi->s_rsv_window_lock); | 1611 | spin_lock_init(&sbi->s_rsv_window_lock); |
1606 | sbi->s_rsv_window_root = RB_ROOT; | 1612 | sbi->s_rsv_window_root = RB_ROOT; |
@@ -1639,16 +1645,16 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1639 | if (!test_opt(sb, NOLOAD) && | 1645 | if (!test_opt(sb, NOLOAD) && |
1640 | EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { | 1646 | EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { |
1641 | if (ext3_load_journal(sb, es, journal_devnum)) | 1647 | if (ext3_load_journal(sb, es, journal_devnum)) |
1642 | goto failed_mount2; | 1648 | goto failed_mount3; |
1643 | } else if (journal_inum) { | 1649 | } else if (journal_inum) { |
1644 | if (ext3_create_journal(sb, es, journal_inum)) | 1650 | if (ext3_create_journal(sb, es, journal_inum)) |
1645 | goto failed_mount2; | 1651 | goto failed_mount3; |
1646 | } else { | 1652 | } else { |
1647 | if (!silent) | 1653 | if (!silent) |
1648 | printk (KERN_ERR | 1654 | printk (KERN_ERR |
1649 | "ext3: No journal on filesystem on %s\n", | 1655 | "ext3: No journal on filesystem on %s\n", |
1650 | sb->s_id); | 1656 | sb->s_id); |
1651 | goto failed_mount2; | 1657 | goto failed_mount3; |
1652 | } | 1658 | } |
1653 | 1659 | ||
1654 | /* We have now updated the journal if required, so we can | 1660 | /* We have now updated the journal if required, so we can |
@@ -1671,7 +1677,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1671 | (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { | 1677 | (sbi->s_journal, 0, 0, JFS_FEATURE_INCOMPAT_REVOKE)) { |
1672 | printk(KERN_ERR "EXT3-fs: Journal does not support " | 1678 | printk(KERN_ERR "EXT3-fs: Journal does not support " |
1673 | "requested data journaling mode\n"); | 1679 | "requested data journaling mode\n"); |
1674 | goto failed_mount3; | 1680 | goto failed_mount4; |
1675 | } | 1681 | } |
1676 | default: | 1682 | default: |
1677 | break; | 1683 | break; |
@@ -1694,13 +1700,13 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1694 | if (!sb->s_root) { | 1700 | if (!sb->s_root) { |
1695 | printk(KERN_ERR "EXT3-fs: get root inode failed\n"); | 1701 | printk(KERN_ERR "EXT3-fs: get root inode failed\n"); |
1696 | iput(root); | 1702 | iput(root); |
1697 | goto failed_mount3; | 1703 | goto failed_mount4; |
1698 | } | 1704 | } |
1699 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { | 1705 | if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { |
1700 | dput(sb->s_root); | 1706 | dput(sb->s_root); |
1701 | sb->s_root = NULL; | 1707 | sb->s_root = NULL; |
1702 | printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); | 1708 | printk(KERN_ERR "EXT3-fs: corrupt root inode, run e2fsck\n"); |
1703 | goto failed_mount3; | 1709 | goto failed_mount4; |
1704 | } | 1710 | } |
1705 | 1711 | ||
1706 | ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); | 1712 | ext3_setup_super (sb, es, sb->s_flags & MS_RDONLY); |
@@ -1723,13 +1729,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1723 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": | 1729 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": |
1724 | "writeback"); | 1730 | "writeback"); |
1725 | 1731 | ||
1726 | percpu_counter_mod(&sbi->s_freeblocks_counter, | ||
1727 | ext3_count_free_blocks(sb)); | ||
1728 | percpu_counter_mod(&sbi->s_freeinodes_counter, | ||
1729 | ext3_count_free_inodes(sb)); | ||
1730 | percpu_counter_mod(&sbi->s_dirs_counter, | ||
1731 | ext3_count_dirs(sb)); | ||
1732 | |||
1733 | lock_kernel(); | 1732 | lock_kernel(); |
1734 | return 0; | 1733 | return 0; |
1735 | 1734 | ||
@@ -1739,8 +1738,12 @@ cantfind_ext3: | |||
1739 | sb->s_id); | 1738 | sb->s_id); |
1740 | goto failed_mount; | 1739 | goto failed_mount; |
1741 | 1740 | ||
1742 | failed_mount3: | 1741 | failed_mount4: |
1743 | journal_destroy(sbi->s_journal); | 1742 | journal_destroy(sbi->s_journal); |
1743 | failed_mount3: | ||
1744 | percpu_counter_destroy(&sbi->s_freeblocks_counter); | ||
1745 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | ||
1746 | percpu_counter_destroy(&sbi->s_dirs_counter); | ||
1744 | failed_mount2: | 1747 | failed_mount2: |
1745 | for (i = 0; i < db_count; i++) | 1748 | for (i = 0; i < db_count; i++) |
1746 | brelse(sbi->s_group_desc[i]); | 1749 | brelse(sbi->s_group_desc[i]); |
@@ -2318,8 +2321,9 @@ restore_opts: | |||
2318 | return err; | 2321 | return err; |
2319 | } | 2322 | } |
2320 | 2323 | ||
2321 | static int ext3_statfs (struct super_block * sb, struct kstatfs * buf) | 2324 | static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf) |
2322 | { | 2325 | { |
2326 | struct super_block *sb = dentry->d_sb; | ||
2323 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 2327 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
2324 | struct ext3_super_block *es = sbi->s_es; | 2328 | struct ext3_super_block *es = sbi->s_es; |
2325 | unsigned long overhead; | 2329 | unsigned long overhead; |
@@ -2646,10 +2650,10 @@ out: | |||
2646 | 2650 | ||
2647 | #endif | 2651 | #endif |
2648 | 2652 | ||
2649 | static struct super_block *ext3_get_sb(struct file_system_type *fs_type, | 2653 | static int ext3_get_sb(struct file_system_type *fs_type, |
2650 | int flags, const char *dev_name, void *data) | 2654 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
2651 | { | 2655 | { |
2652 | return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super); | 2656 | return get_sb_bdev(fs_type, flags, dev_name, data, ext3_fill_super, mnt); |
2653 | } | 2657 | } |
2654 | 2658 | ||
2655 | static struct file_system_type ext3_fs_type = { | 2659 | static struct file_system_type ext3_fs_type = { |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index c1ce284f8a94..7c35d582ec10 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -539,18 +539,18 @@ static int fat_remount(struct super_block *sb, int *flags, char *data) | |||
539 | return 0; | 539 | return 0; |
540 | } | 540 | } |
541 | 541 | ||
542 | static int fat_statfs(struct super_block *sb, struct kstatfs *buf) | 542 | static int fat_statfs(struct dentry *dentry, struct kstatfs *buf) |
543 | { | 543 | { |
544 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | 544 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); |
545 | 545 | ||
546 | /* If the count of free cluster is still unknown, counts it here. */ | 546 | /* If the count of free cluster is still unknown, counts it here. */ |
547 | if (sbi->free_clusters == -1) { | 547 | if (sbi->free_clusters == -1) { |
548 | int err = fat_count_free_clusters(sb); | 548 | int err = fat_count_free_clusters(dentry->d_sb); |
549 | if (err) | 549 | if (err) |
550 | return err; | 550 | return err; |
551 | } | 551 | } |
552 | 552 | ||
553 | buf->f_type = sb->s_magic; | 553 | buf->f_type = dentry->d_sb->s_magic; |
554 | buf->f_bsize = sbi->cluster_size; | 554 | buf->f_bsize = sbi->cluster_size; |
555 | buf->f_blocks = sbi->max_cluster - FAT_START_ENT; | 555 | buf->f_blocks = sbi->max_cluster - FAT_START_ENT; |
556 | buf->f_bfree = sbi->free_clusters; | 556 | buf->f_bfree = sbi->free_clusters; |
diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 944652e9dde1..308f2b6b5026 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c | |||
@@ -210,4 +210,3 @@ int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs) | |||
210 | return err; | 210 | return err; |
211 | } | 211 | } |
212 | 212 | ||
213 | EXPORT_SYMBOL_GPL(fat_sync_bhs); | ||
diff --git a/fs/file_table.c b/fs/file_table.c index bcea1998b4de..506d5307108d 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -300,5 +300,5 @@ void __init files_init(unsigned long mempages) | |||
300 | if (files_stat.max_files < NR_FILE) | 300 | if (files_stat.max_files < NR_FILE) |
301 | files_stat.max_files = NR_FILE; | 301 | files_stat.max_files = NR_FILE; |
302 | files_defer_init(); | 302 | files_defer_init(); |
303 | percpu_counter_init(&nr_files); | 303 | percpu_counter_init(&nr_files, 0); |
304 | } | 304 | } |
diff --git a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c index 50aae77651b2..c1be118fc067 100644 --- a/fs/freevxfs/vxfs_subr.c +++ b/fs/freevxfs/vxfs_subr.c | |||
@@ -71,8 +71,7 @@ vxfs_get_page(struct address_space *mapping, u_long n) | |||
71 | { | 71 | { |
72 | struct page * pp; | 72 | struct page * pp; |
73 | 73 | ||
74 | pp = read_cache_page(mapping, n, | 74 | pp = read_mapping_page(mapping, n, NULL); |
75 | (filler_t*)mapping->a_ops->readpage, NULL); | ||
76 | 75 | ||
77 | if (!IS_ERR(pp)) { | 76 | if (!IS_ERR(pp)) { |
78 | wait_on_page_locked(pp); | 77 | wait_on_page_locked(pp); |
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index b44c916d24a1..b74b791fc23b 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/stat.h> | 41 | #include <linux/stat.h> |
42 | #include <linux/vfs.h> | 42 | #include <linux/vfs.h> |
43 | #include <linux/mount.h> | ||
43 | 44 | ||
44 | #include "vxfs.h" | 45 | #include "vxfs.h" |
45 | #include "vxfs_extern.h" | 46 | #include "vxfs_extern.h" |
@@ -55,7 +56,7 @@ MODULE_ALIAS("vxfs"); /* makes mount -t vxfs autoload the module */ | |||
55 | 56 | ||
56 | 57 | ||
57 | static void vxfs_put_super(struct super_block *); | 58 | static void vxfs_put_super(struct super_block *); |
58 | static int vxfs_statfs(struct super_block *, struct kstatfs *); | 59 | static int vxfs_statfs(struct dentry *, struct kstatfs *); |
59 | static int vxfs_remount(struct super_block *, int *, char *); | 60 | static int vxfs_remount(struct super_block *, int *, char *); |
60 | 61 | ||
61 | static struct super_operations vxfs_super_ops = { | 62 | static struct super_operations vxfs_super_ops = { |
@@ -90,12 +91,12 @@ vxfs_put_super(struct super_block *sbp) | |||
90 | 91 | ||
91 | /** | 92 | /** |
92 | * vxfs_statfs - get filesystem information | 93 | * vxfs_statfs - get filesystem information |
93 | * @sbp: VFS superblock | 94 | * @dentry: VFS dentry to locate superblock |
94 | * @bufp: output buffer | 95 | * @bufp: output buffer |
95 | * | 96 | * |
96 | * Description: | 97 | * Description: |
97 | * vxfs_statfs fills the statfs buffer @bufp with information | 98 | * vxfs_statfs fills the statfs buffer @bufp with information |
98 | * about the filesystem described by @sbp. | 99 | * about the filesystem described by @dentry. |
99 | * | 100 | * |
100 | * Returns: | 101 | * Returns: |
101 | * Zero. | 102 | * Zero. |
@@ -107,12 +108,12 @@ vxfs_put_super(struct super_block *sbp) | |||
107 | * This is everything but complete... | 108 | * This is everything but complete... |
108 | */ | 109 | */ |
109 | static int | 110 | static int |
110 | vxfs_statfs(struct super_block *sbp, struct kstatfs *bufp) | 111 | vxfs_statfs(struct dentry *dentry, struct kstatfs *bufp) |
111 | { | 112 | { |
112 | struct vxfs_sb_info *infp = VXFS_SBI(sbp); | 113 | struct vxfs_sb_info *infp = VXFS_SBI(dentry->d_sb); |
113 | 114 | ||
114 | bufp->f_type = VXFS_SUPER_MAGIC; | 115 | bufp->f_type = VXFS_SUPER_MAGIC; |
115 | bufp->f_bsize = sbp->s_blocksize; | 116 | bufp->f_bsize = dentry->d_sb->s_blocksize; |
116 | bufp->f_blocks = infp->vsi_raw->vs_dsize; | 117 | bufp->f_blocks = infp->vsi_raw->vs_dsize; |
117 | bufp->f_bfree = infp->vsi_raw->vs_free; | 118 | bufp->f_bfree = infp->vsi_raw->vs_free; |
118 | bufp->f_bavail = 0; | 119 | bufp->f_bavail = 0; |
@@ -241,10 +242,11 @@ out: | |||
241 | /* | 242 | /* |
242 | * The usual module blurb. | 243 | * The usual module blurb. |
243 | */ | 244 | */ |
244 | static struct super_block *vxfs_get_sb(struct file_system_type *fs_type, | 245 | static int vxfs_get_sb(struct file_system_type *fs_type, |
245 | int flags, const char *dev_name, void *data) | 246 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
246 | { | 247 | { |
247 | return get_sb_bdev(fs_type, flags, dev_name, data, vxfs_fill_super); | 248 | return get_sb_bdev(fs_type, flags, dev_name, data, vxfs_fill_super, |
249 | mnt); | ||
248 | } | 250 | } |
249 | 251 | ||
250 | static struct file_system_type vxfs_fs_type = { | 252 | static struct file_system_type vxfs_fs_type = { |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index f3fbe2d030f4..031b27a4bc9a 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -461,6 +461,8 @@ void sync_inodes_sb(struct super_block *sb, int wait) | |||
461 | { | 461 | { |
462 | struct writeback_control wbc = { | 462 | struct writeback_control wbc = { |
463 | .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD, | 463 | .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_HOLD, |
464 | .range_start = 0, | ||
465 | .range_end = LLONG_MAX, | ||
464 | }; | 466 | }; |
465 | unsigned long nr_dirty = read_page_state(nr_dirty); | 467 | unsigned long nr_dirty = read_page_state(nr_dirty); |
466 | unsigned long nr_unstable = read_page_state(nr_unstable); | 468 | unsigned long nr_unstable = read_page_state(nr_unstable); |
@@ -559,6 +561,8 @@ int write_inode_now(struct inode *inode, int sync) | |||
559 | struct writeback_control wbc = { | 561 | struct writeback_control wbc = { |
560 | .nr_to_write = LONG_MAX, | 562 | .nr_to_write = LONG_MAX, |
561 | .sync_mode = WB_SYNC_ALL, | 563 | .sync_mode = WB_SYNC_ALL, |
564 | .range_start = 0, | ||
565 | .range_end = LLONG_MAX, | ||
562 | }; | 566 | }; |
563 | 567 | ||
564 | if (!mapping_cap_writeback_dirty(inode->i_mapping)) | 568 | if (!mapping_cap_writeback_dirty(inode->i_mapping)) |
@@ -619,7 +623,6 @@ int generic_osync_inode(struct inode *inode, struct address_space *mapping, int | |||
619 | int need_write_inode_now = 0; | 623 | int need_write_inode_now = 0; |
620 | int err2; | 624 | int err2; |
621 | 625 | ||
622 | current->flags |= PF_SYNCWRITE; | ||
623 | if (what & OSYNC_DATA) | 626 | if (what & OSYNC_DATA) |
624 | err = filemap_fdatawrite(mapping); | 627 | err = filemap_fdatawrite(mapping); |
625 | if (what & (OSYNC_METADATA|OSYNC_DATA)) { | 628 | if (what & (OSYNC_METADATA|OSYNC_DATA)) { |
@@ -632,7 +635,6 @@ int generic_osync_inode(struct inode *inode, struct address_space *mapping, int | |||
632 | if (!err) | 635 | if (!err) |
633 | err = err2; | 636 | err = err2; |
634 | } | 637 | } |
635 | current->flags &= ~PF_SYNCWRITE; | ||
636 | 638 | ||
637 | spin_lock(&inode_lock); | 639 | spin_lock(&inode_lock); |
638 | if ((inode->i_state & I_DIRTY) && | 640 | if ((inode->i_state & I_DIRTY) && |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index fc342cf7c2cc..087f3b734f40 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -169,7 +169,7 @@ static int fuse_release(struct inode *inode, struct file *file) | |||
169 | return fuse_release_common(inode, file, 0); | 169 | return fuse_release_common(inode, file, 0); |
170 | } | 170 | } |
171 | 171 | ||
172 | static int fuse_flush(struct file *file) | 172 | static int fuse_flush(struct file *file, fl_owner_t id) |
173 | { | 173 | { |
174 | struct inode *inode = file->f_dentry->d_inode; | 174 | struct inode *inode = file->f_dentry->d_inode; |
175 | struct fuse_conn *fc = get_fuse_conn(inode); | 175 | struct fuse_conn *fc = get_fuse_conn(inode); |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 7627022446b2..a13c0f529058 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -236,8 +236,9 @@ static void convert_fuse_statfs(struct kstatfs *stbuf, struct fuse_kstatfs *attr | |||
236 | /* fsid is left zero */ | 236 | /* fsid is left zero */ |
237 | } | 237 | } |
238 | 238 | ||
239 | static int fuse_statfs(struct super_block *sb, struct kstatfs *buf) | 239 | static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf) |
240 | { | 240 | { |
241 | struct super_block *sb = dentry->d_sb; | ||
241 | struct fuse_conn *fc = get_fuse_conn_super(sb); | 242 | struct fuse_conn *fc = get_fuse_conn_super(sb); |
242 | struct fuse_req *req; | 243 | struct fuse_req *req; |
243 | struct fuse_statfs_out outarg; | 244 | struct fuse_statfs_out outarg; |
@@ -569,11 +570,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
569 | return err; | 570 | return err; |
570 | } | 571 | } |
571 | 572 | ||
572 | static struct super_block *fuse_get_sb(struct file_system_type *fs_type, | 573 | static int fuse_get_sb(struct file_system_type *fs_type, |
573 | int flags, const char *dev_name, | 574 | int flags, const char *dev_name, |
574 | void *raw_data) | 575 | void *raw_data, struct vfsmount *mnt) |
575 | { | 576 | { |
576 | return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super); | 577 | return get_sb_nodev(fs_type, flags, raw_data, fuse_fill_super, mnt); |
577 | } | 578 | } |
578 | 579 | ||
579 | static struct file_system_type fuse_fs_type = { | 580 | static struct file_system_type fuse_fs_type = { |
diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c index 1e44dcfe49c4..13231dd5ce66 100644 --- a/fs/hfs/bnode.c +++ b/fs/hfs/bnode.c | |||
@@ -280,7 +280,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) | |||
280 | block = off >> PAGE_CACHE_SHIFT; | 280 | block = off >> PAGE_CACHE_SHIFT; |
281 | node->page_offset = off & ~PAGE_CACHE_MASK; | 281 | node->page_offset = off & ~PAGE_CACHE_MASK; |
282 | for (i = 0; i < tree->pages_per_bnode; i++) { | 282 | for (i = 0; i < tree->pages_per_bnode; i++) { |
283 | page = read_cache_page(mapping, block++, (filler_t *)mapping->a_ops->readpage, NULL); | 283 | page = read_mapping_page(mapping, block++, NULL); |
284 | if (IS_ERR(page)) | 284 | if (IS_ERR(page)) |
285 | goto fail; | 285 | goto fail; |
286 | if (PageError(page)) { | 286 | if (PageError(page)) { |
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index d20131ce4b95..400357994319 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c | |||
@@ -59,7 +59,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke | |||
59 | unlock_new_inode(tree->inode); | 59 | unlock_new_inode(tree->inode); |
60 | 60 | ||
61 | mapping = tree->inode->i_mapping; | 61 | mapping = tree->inode->i_mapping; |
62 | page = read_cache_page(mapping, 0, (filler_t *)mapping->a_ops->readpage, NULL); | 62 | page = read_mapping_page(mapping, 0, NULL); |
63 | if (IS_ERR(page)) | 63 | if (IS_ERR(page)) |
64 | goto free_tree; | 64 | goto free_tree; |
65 | 65 | ||
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 1181d116117d..d9227bf14e86 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -80,8 +80,10 @@ static void hfs_put_super(struct super_block *sb) | |||
80 | * | 80 | * |
81 | * changed f_files/f_ffree to reflect the fs_ablock/free_ablocks. | 81 | * changed f_files/f_ffree to reflect the fs_ablock/free_ablocks. |
82 | */ | 82 | */ |
83 | static int hfs_statfs(struct super_block *sb, struct kstatfs *buf) | 83 | static int hfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
84 | { | 84 | { |
85 | struct super_block *sb = dentry->d_sb; | ||
86 | |||
85 | buf->f_type = HFS_SUPER_MAGIC; | 87 | buf->f_type = HFS_SUPER_MAGIC; |
86 | buf->f_bsize = sb->s_blocksize; | 88 | buf->f_bsize = sb->s_blocksize; |
87 | buf->f_blocks = (u32)HFS_SB(sb)->fs_ablocks * HFS_SB(sb)->fs_div; | 89 | buf->f_blocks = (u32)HFS_SB(sb)->fs_ablocks * HFS_SB(sb)->fs_div; |
@@ -413,10 +415,11 @@ bail: | |||
413 | return res; | 415 | return res; |
414 | } | 416 | } |
415 | 417 | ||
416 | static struct super_block *hfs_get_sb(struct file_system_type *fs_type, | 418 | static int hfs_get_sb(struct file_system_type *fs_type, |
417 | int flags, const char *dev_name, void *data) | 419 | int flags, const char *dev_name, void *data, |
420 | struct vfsmount *mnt) | ||
418 | { | 421 | { |
419 | return get_sb_bdev(fs_type, flags, dev_name, data, hfs_fill_super); | 422 | return get_sb_bdev(fs_type, flags, dev_name, data, hfs_fill_super, mnt); |
420 | } | 423 | } |
421 | 424 | ||
422 | static struct file_system_type hfs_fs_type = { | 425 | static struct file_system_type hfs_fs_type = { |
diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c index 9fb51632303c..d128a25b74d2 100644 --- a/fs/hfsplus/bitmap.c +++ b/fs/hfsplus/bitmap.c | |||
@@ -31,8 +31,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma | |||
31 | dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); | 31 | dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); |
32 | mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex); | 32 | mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex); |
33 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; | 33 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; |
34 | page = read_cache_page(mapping, offset / PAGE_CACHE_BITS, | 34 | page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL); |
35 | (filler_t *)mapping->a_ops->readpage, NULL); | ||
36 | pptr = kmap(page); | 35 | pptr = kmap(page); |
37 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; | 36 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; |
38 | i = offset % 32; | 37 | i = offset % 32; |
@@ -72,8 +71,8 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma | |||
72 | offset += PAGE_CACHE_BITS; | 71 | offset += PAGE_CACHE_BITS; |
73 | if (offset >= size) | 72 | if (offset >= size) |
74 | break; | 73 | break; |
75 | page = read_cache_page(mapping, offset / PAGE_CACHE_BITS, | 74 | page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, |
76 | (filler_t *)mapping->a_ops->readpage, NULL); | 75 | NULL); |
77 | curr = pptr = kmap(page); | 76 | curr = pptr = kmap(page); |
78 | if ((size ^ offset) / PAGE_CACHE_BITS) | 77 | if ((size ^ offset) / PAGE_CACHE_BITS) |
79 | end = pptr + PAGE_CACHE_BITS / 32; | 78 | end = pptr + PAGE_CACHE_BITS / 32; |
@@ -119,8 +118,8 @@ found: | |||
119 | set_page_dirty(page); | 118 | set_page_dirty(page); |
120 | kunmap(page); | 119 | kunmap(page); |
121 | offset += PAGE_CACHE_BITS; | 120 | offset += PAGE_CACHE_BITS; |
122 | page = read_cache_page(mapping, offset / PAGE_CACHE_BITS, | 121 | page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, |
123 | (filler_t *)mapping->a_ops->readpage, NULL); | 122 | NULL); |
124 | pptr = kmap(page); | 123 | pptr = kmap(page); |
125 | curr = pptr; | 124 | curr = pptr; |
126 | end = pptr + PAGE_CACHE_BITS / 32; | 125 | end = pptr + PAGE_CACHE_BITS / 32; |
@@ -167,7 +166,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) | |||
167 | mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex); | 166 | mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex); |
168 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; | 167 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; |
169 | pnr = offset / PAGE_CACHE_BITS; | 168 | pnr = offset / PAGE_CACHE_BITS; |
170 | page = read_cache_page(mapping, pnr, (filler_t *)mapping->a_ops->readpage, NULL); | 169 | page = read_mapping_page(mapping, pnr, NULL); |
171 | pptr = kmap(page); | 170 | pptr = kmap(page); |
172 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; | 171 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; |
173 | end = pptr + PAGE_CACHE_BITS / 32; | 172 | end = pptr + PAGE_CACHE_BITS / 32; |
@@ -199,7 +198,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) | |||
199 | break; | 198 | break; |
200 | set_page_dirty(page); | 199 | set_page_dirty(page); |
201 | kunmap(page); | 200 | kunmap(page); |
202 | page = read_cache_page(mapping, ++pnr, (filler_t *)mapping->a_ops->readpage, NULL); | 201 | page = read_mapping_page(mapping, ++pnr, NULL); |
203 | pptr = kmap(page); | 202 | pptr = kmap(page); |
204 | curr = pptr; | 203 | curr = pptr; |
205 | end = pptr + PAGE_CACHE_BITS / 32; | 204 | end = pptr + PAGE_CACHE_BITS / 32; |
diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c index 746abc9ecf70..77bf434da679 100644 --- a/fs/hfsplus/bnode.c +++ b/fs/hfsplus/bnode.c | |||
@@ -440,7 +440,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) | |||
440 | block = off >> PAGE_CACHE_SHIFT; | 440 | block = off >> PAGE_CACHE_SHIFT; |
441 | node->page_offset = off & ~PAGE_CACHE_MASK; | 441 | node->page_offset = off & ~PAGE_CACHE_MASK; |
442 | for (i = 0; i < tree->pages_per_bnode; block++, i++) { | 442 | for (i = 0; i < tree->pages_per_bnode; block++, i++) { |
443 | page = read_cache_page(mapping, block, (filler_t *)mapping->a_ops->readpage, NULL); | 443 | page = read_mapping_page(mapping, block, NULL); |
444 | if (IS_ERR(page)) | 444 | if (IS_ERR(page)) |
445 | goto fail; | 445 | goto fail; |
446 | if (PageError(page)) { | 446 | if (PageError(page)) { |
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c index effa8991999c..cfc852fdd1b5 100644 --- a/fs/hfsplus/btree.c +++ b/fs/hfsplus/btree.c | |||
@@ -38,7 +38,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) | |||
38 | goto free_tree; | 38 | goto free_tree; |
39 | 39 | ||
40 | mapping = tree->inode->i_mapping; | 40 | mapping = tree->inode->i_mapping; |
41 | page = read_cache_page(mapping, 0, (filler_t *)mapping->a_ops->readpage, NULL); | 41 | page = read_mapping_page(mapping, 0, NULL); |
42 | if (IS_ERR(page)) | 42 | if (IS_ERR(page)) |
43 | goto free_tree; | 43 | goto free_tree; |
44 | 44 | ||
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 7843f792a4b7..0a92fa2336a2 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -212,8 +212,10 @@ static void hfsplus_put_super(struct super_block *sb) | |||
212 | sb->s_fs_info = NULL; | 212 | sb->s_fs_info = NULL; |
213 | } | 213 | } |
214 | 214 | ||
215 | static int hfsplus_statfs(struct super_block *sb, struct kstatfs *buf) | 215 | static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf) |
216 | { | 216 | { |
217 | struct super_block *sb = dentry->d_sb; | ||
218 | |||
217 | buf->f_type = HFSPLUS_SUPER_MAGIC; | 219 | buf->f_type = HFSPLUS_SUPER_MAGIC; |
218 | buf->f_bsize = sb->s_blocksize; | 220 | buf->f_bsize = sb->s_blocksize; |
219 | buf->f_blocks = HFSPLUS_SB(sb).total_blocks << HFSPLUS_SB(sb).fs_shift; | 221 | buf->f_blocks = HFSPLUS_SB(sb).total_blocks << HFSPLUS_SB(sb).fs_shift; |
@@ -450,10 +452,12 @@ static void hfsplus_destroy_inode(struct inode *inode) | |||
450 | 452 | ||
451 | #define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info) | 453 | #define HFSPLUS_INODE_SIZE sizeof(struct hfsplus_inode_info) |
452 | 454 | ||
453 | static struct super_block *hfsplus_get_sb(struct file_system_type *fs_type, | 455 | static int hfsplus_get_sb(struct file_system_type *fs_type, |
454 | int flags, const char *dev_name, void *data) | 456 | int flags, const char *dev_name, void *data, |
457 | struct vfsmount *mnt) | ||
455 | { | 458 | { |
456 | return get_sb_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super); | 459 | return get_sb_bdev(fs_type, flags, dev_name, data, hfsplus_fill_super, |
460 | mnt); | ||
457 | } | 461 | } |
458 | 462 | ||
459 | static struct file_system_type hfsplus_fs_type = { | 463 | static struct file_system_type hfsplus_fs_type = { |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index bf0f8e16e433..8e0d37743e7c 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -239,7 +239,7 @@ static int read_inode(struct inode *ino) | |||
239 | return(err); | 239 | return(err); |
240 | } | 240 | } |
241 | 241 | ||
242 | int hostfs_statfs(struct super_block *sb, struct kstatfs *sf) | 242 | int hostfs_statfs(struct dentry *dentry, struct kstatfs *sf) |
243 | { | 243 | { |
244 | /* do_statfs uses struct statfs64 internally, but the linux kernel | 244 | /* do_statfs uses struct statfs64 internally, but the linux kernel |
245 | * struct statfs still has 32-bit versions for most of these fields, | 245 | * struct statfs still has 32-bit versions for most of these fields, |
@@ -252,7 +252,7 @@ int hostfs_statfs(struct super_block *sb, struct kstatfs *sf) | |||
252 | long long f_files; | 252 | long long f_files; |
253 | long long f_ffree; | 253 | long long f_ffree; |
254 | 254 | ||
255 | err = do_statfs(HOSTFS_I(sb->s_root->d_inode)->host_filename, | 255 | err = do_statfs(HOSTFS_I(dentry->d_sb->s_root->d_inode)->host_filename, |
256 | &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, | 256 | &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, |
257 | &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), | 257 | &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), |
258 | &sf->f_namelen, sf->f_spare); | 258 | &sf->f_namelen, sf->f_spare); |
@@ -993,11 +993,11 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
993 | return(err); | 993 | return(err); |
994 | } | 994 | } |
995 | 995 | ||
996 | static struct super_block *hostfs_read_sb(struct file_system_type *type, | 996 | static int hostfs_read_sb(struct file_system_type *type, |
997 | int flags, const char *dev_name, | 997 | int flags, const char *dev_name, |
998 | void *data) | 998 | void *data, struct vfsmount *mnt) |
999 | { | 999 | { |
1000 | return(get_sb_nodev(type, flags, data, hostfs_fill_sb_common)); | 1000 | return get_sb_nodev(type, flags, data, hostfs_fill_sb_common, mnt); |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | static struct file_system_type hostfs_type = { | 1003 | static struct file_system_type hostfs_type = { |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index d72d8c87c996..f798480a363f 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -135,8 +135,9 @@ static unsigned count_bitmaps(struct super_block *s) | |||
135 | return count; | 135 | return count; |
136 | } | 136 | } |
137 | 137 | ||
138 | static int hpfs_statfs(struct super_block *s, struct kstatfs *buf) | 138 | static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
139 | { | 139 | { |
140 | struct super_block *s = dentry->d_sb; | ||
140 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 141 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
141 | lock_kernel(); | 142 | lock_kernel(); |
142 | 143 | ||
@@ -662,10 +663,11 @@ bail0: | |||
662 | return -EINVAL; | 663 | return -EINVAL; |
663 | } | 664 | } |
664 | 665 | ||
665 | static struct super_block *hpfs_get_sb(struct file_system_type *fs_type, | 666 | static int hpfs_get_sb(struct file_system_type *fs_type, |
666 | int flags, const char *dev_name, void *data) | 667 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
667 | { | 668 | { |
668 | return get_sb_bdev(fs_type, flags, dev_name, data, hpfs_fill_super); | 669 | return get_sb_bdev(fs_type, flags, dev_name, data, hpfs_fill_super, |
670 | mnt); | ||
669 | } | 671 | } |
670 | 672 | ||
671 | static struct file_system_type hpfs_fs_type = { | 673 | static struct file_system_type hpfs_fs_type = { |
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c index 5e6363be246f..3a9bdf58166f 100644 --- a/fs/hppfs/hppfs_kern.c +++ b/fs/hppfs/hppfs_kern.c | |||
@@ -616,7 +616,7 @@ static const struct file_operations hppfs_dir_fops = { | |||
616 | .fsync = hppfs_fsync, | 616 | .fsync = hppfs_fsync, |
617 | }; | 617 | }; |
618 | 618 | ||
619 | static int hppfs_statfs(struct super_block *sb, struct kstatfs *sf) | 619 | static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf) |
620 | { | 620 | { |
621 | sf->f_blocks = 0; | 621 | sf->f_blocks = 0; |
622 | sf->f_bfree = 0; | 622 | sf->f_bfree = 0; |
@@ -769,11 +769,11 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent) | |||
769 | return(err); | 769 | return(err); |
770 | } | 770 | } |
771 | 771 | ||
772 | static struct super_block *hppfs_read_super(struct file_system_type *type, | 772 | static int hppfs_read_super(struct file_system_type *type, |
773 | int flags, const char *dev_name, | 773 | int flags, const char *dev_name, |
774 | void *data) | 774 | void *data, struct vfsmount *mnt) |
775 | { | 775 | { |
776 | return(get_sb_nodev(type, flags, data, hppfs_fill_super)); | 776 | return get_sb_nodev(type, flags, data, hppfs_fill_super, mnt); |
777 | } | 777 | } |
778 | 778 | ||
779 | static struct file_system_type hppfs_type = { | 779 | static struct file_system_type hppfs_type = { |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 3a5b4e923455..e6410d8edd0e 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -59,7 +59,6 @@ static void huge_pagevec_release(struct pagevec *pvec) | |||
59 | static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | 59 | static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) |
60 | { | 60 | { |
61 | struct inode *inode = file->f_dentry->d_inode; | 61 | struct inode *inode = file->f_dentry->d_inode; |
62 | struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode); | ||
63 | loff_t len, vma_len; | 62 | loff_t len, vma_len; |
64 | int ret; | 63 | int ret; |
65 | 64 | ||
@@ -87,9 +86,10 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
87 | if (!(vma->vm_flags & VM_WRITE) && len > inode->i_size) | 86 | if (!(vma->vm_flags & VM_WRITE) && len > inode->i_size) |
88 | goto out; | 87 | goto out; |
89 | 88 | ||
90 | if (vma->vm_flags & VM_MAYSHARE) | 89 | if (vma->vm_flags & VM_MAYSHARE && |
91 | if (hugetlb_extend_reservation(info, len >> HPAGE_SHIFT) != 0) | 90 | hugetlb_reserve_pages(inode, vma->vm_pgoff >> (HPAGE_SHIFT-PAGE_SHIFT), |
92 | goto out; | 91 | len >> HPAGE_SHIFT)) |
92 | goto out; | ||
93 | 93 | ||
94 | ret = 0; | 94 | ret = 0; |
95 | hugetlb_prefault_arch_hook(vma->vm_mm); | 95 | hugetlb_prefault_arch_hook(vma->vm_mm); |
@@ -195,12 +195,8 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart) | |||
195 | const pgoff_t start = lstart >> HPAGE_SHIFT; | 195 | const pgoff_t start = lstart >> HPAGE_SHIFT; |
196 | struct pagevec pvec; | 196 | struct pagevec pvec; |
197 | pgoff_t next; | 197 | pgoff_t next; |
198 | int i; | 198 | int i, freed = 0; |
199 | 199 | ||
200 | hugetlb_truncate_reservation(HUGETLBFS_I(inode), | ||
201 | lstart >> HPAGE_SHIFT); | ||
202 | if (!mapping->nrpages) | ||
203 | return; | ||
204 | pagevec_init(&pvec, 0); | 200 | pagevec_init(&pvec, 0); |
205 | next = start; | 201 | next = start; |
206 | while (1) { | 202 | while (1) { |
@@ -221,10 +217,12 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart) | |||
221 | truncate_huge_page(page); | 217 | truncate_huge_page(page); |
222 | unlock_page(page); | 218 | unlock_page(page); |
223 | hugetlb_put_quota(mapping); | 219 | hugetlb_put_quota(mapping); |
220 | freed++; | ||
224 | } | 221 | } |
225 | huge_pagevec_release(&pvec); | 222 | huge_pagevec_release(&pvec); |
226 | } | 223 | } |
227 | BUG_ON(!lstart && mapping->nrpages); | 224 | BUG_ON(!lstart && mapping->nrpages); |
225 | hugetlb_unreserve_pages(inode, start, freed); | ||
228 | } | 226 | } |
229 | 227 | ||
230 | static void hugetlbfs_delete_inode(struct inode *inode) | 228 | static void hugetlbfs_delete_inode(struct inode *inode) |
@@ -366,6 +364,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
366 | inode->i_mapping->a_ops = &hugetlbfs_aops; | 364 | inode->i_mapping->a_ops = &hugetlbfs_aops; |
367 | inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; | 365 | inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; |
368 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 366 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
367 | INIT_LIST_HEAD(&inode->i_mapping->private_list); | ||
369 | info = HUGETLBFS_I(inode); | 368 | info = HUGETLBFS_I(inode); |
370 | mpol_shared_policy_init(&info->policy, MPOL_DEFAULT, NULL); | 369 | mpol_shared_policy_init(&info->policy, MPOL_DEFAULT, NULL); |
371 | switch (mode & S_IFMT) { | 370 | switch (mode & S_IFMT) { |
@@ -467,9 +466,9 @@ static int hugetlbfs_set_page_dirty(struct page *page) | |||
467 | return 0; | 466 | return 0; |
468 | } | 467 | } |
469 | 468 | ||
470 | static int hugetlbfs_statfs(struct super_block *sb, struct kstatfs *buf) | 469 | static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
471 | { | 470 | { |
472 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(sb); | 471 | struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(dentry->d_sb); |
473 | 472 | ||
474 | buf->f_type = HUGETLBFS_MAGIC; | 473 | buf->f_type = HUGETLBFS_MAGIC; |
475 | buf->f_bsize = HPAGE_SIZE; | 474 | buf->f_bsize = HPAGE_SIZE; |
@@ -538,7 +537,6 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) | |||
538 | hugetlbfs_inc_free_inodes(sbinfo); | 537 | hugetlbfs_inc_free_inodes(sbinfo); |
539 | return NULL; | 538 | return NULL; |
540 | } | 539 | } |
541 | p->prereserved_hpages = 0; | ||
542 | return &p->vfs_inode; | 540 | return &p->vfs_inode; |
543 | } | 541 | } |
544 | 542 | ||
@@ -723,10 +721,10 @@ void hugetlb_put_quota(struct address_space *mapping) | |||
723 | } | 721 | } |
724 | } | 722 | } |
725 | 723 | ||
726 | static struct super_block *hugetlbfs_get_sb(struct file_system_type *fs_type, | 724 | static int hugetlbfs_get_sb(struct file_system_type *fs_type, |
727 | int flags, const char *dev_name, void *data) | 725 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
728 | { | 726 | { |
729 | return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super); | 727 | return get_sb_nodev(fs_type, flags, data, hugetlbfs_fill_super, mnt); |
730 | } | 728 | } |
731 | 729 | ||
732 | static struct file_system_type hugetlbfs_fs_type = { | 730 | static struct file_system_type hugetlbfs_fs_type = { |
@@ -781,8 +779,7 @@ struct file *hugetlb_zero_setup(size_t size) | |||
781 | goto out_file; | 779 | goto out_file; |
782 | 780 | ||
783 | error = -ENOMEM; | 781 | error = -ENOMEM; |
784 | if (hugetlb_extend_reservation(HUGETLBFS_I(inode), | 782 | if (hugetlb_reserve_pages(inode, 0, size >> HPAGE_SHIFT)) |
785 | size >> HPAGE_SHIFT) != 0) | ||
786 | goto out_inode; | 783 | goto out_inode; |
787 | 784 | ||
788 | d_instantiate(dentry, inode); | 785 | d_instantiate(dentry, inode); |
diff --git a/fs/inotify_user.c b/fs/inotify_user.c index 9e9931e2badd..f2386442adee 100644 --- a/fs/inotify_user.c +++ b/fs/inotify_user.c | |||
@@ -672,11 +672,11 @@ out: | |||
672 | return ret; | 672 | return ret; |
673 | } | 673 | } |
674 | 674 | ||
675 | static struct super_block * | 675 | static int |
676 | inotify_get_sb(struct file_system_type *fs_type, int flags, | 676 | inotify_get_sb(struct file_system_type *fs_type, int flags, |
677 | const char *dev_name, void *data) | 677 | const char *dev_name, void *data, struct vfsmount *mnt) |
678 | { | 678 | { |
679 | return get_sb_pseudo(fs_type, "inotify", NULL, 0xBAD1DEA); | 679 | return get_sb_pseudo(fs_type, "inotify", NULL, 0xBAD1DEA, mnt); |
680 | } | 680 | } |
681 | 681 | ||
682 | static struct file_system_type inotify_fs_type = { | 682 | static struct file_system_type inotify_fs_type = { |
diff --git a/fs/ioprio.c b/fs/ioprio.c index ca77008146c0..7fa76ed53c10 100644 --- a/fs/ioprio.c +++ b/fs/ioprio.c | |||
@@ -24,15 +24,21 @@ | |||
24 | #include <linux/blkdev.h> | 24 | #include <linux/blkdev.h> |
25 | #include <linux/capability.h> | 25 | #include <linux/capability.h> |
26 | #include <linux/syscalls.h> | 26 | #include <linux/syscalls.h> |
27 | #include <linux/security.h> | ||
27 | 28 | ||
28 | static int set_task_ioprio(struct task_struct *task, int ioprio) | 29 | static int set_task_ioprio(struct task_struct *task, int ioprio) |
29 | { | 30 | { |
31 | int err; | ||
30 | struct io_context *ioc; | 32 | struct io_context *ioc; |
31 | 33 | ||
32 | if (task->uid != current->euid && | 34 | if (task->uid != current->euid && |
33 | task->uid != current->uid && !capable(CAP_SYS_NICE)) | 35 | task->uid != current->uid && !capable(CAP_SYS_NICE)) |
34 | return -EPERM; | 36 | return -EPERM; |
35 | 37 | ||
38 | err = security_task_setioprio(task, ioprio); | ||
39 | if (err) | ||
40 | return err; | ||
41 | |||
36 | task_lock(task); | 42 | task_lock(task); |
37 | 43 | ||
38 | task->ioprio = ioprio; | 44 | task->ioprio = ioprio; |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 70adbb98bad1..3f9c8ba1fa1f 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -56,7 +56,7 @@ static void isofs_put_super(struct super_block *sb) | |||
56 | } | 56 | } |
57 | 57 | ||
58 | static void isofs_read_inode(struct inode *); | 58 | static void isofs_read_inode(struct inode *); |
59 | static int isofs_statfs (struct super_block *, struct kstatfs *); | 59 | static int isofs_statfs (struct dentry *, struct kstatfs *); |
60 | 60 | ||
61 | static kmem_cache_t *isofs_inode_cachep; | 61 | static kmem_cache_t *isofs_inode_cachep; |
62 | 62 | ||
@@ -901,8 +901,10 @@ out_freesbi: | |||
901 | return -EINVAL; | 901 | return -EINVAL; |
902 | } | 902 | } |
903 | 903 | ||
904 | static int isofs_statfs (struct super_block *sb, struct kstatfs *buf) | 904 | static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf) |
905 | { | 905 | { |
906 | struct super_block *sb = dentry->d_sb; | ||
907 | |||
906 | buf->f_type = ISOFS_SUPER_MAGIC; | 908 | buf->f_type = ISOFS_SUPER_MAGIC; |
907 | buf->f_bsize = sb->s_blocksize; | 909 | buf->f_bsize = sb->s_blocksize; |
908 | buf->f_blocks = (ISOFS_SB(sb)->s_nzones | 910 | buf->f_blocks = (ISOFS_SB(sb)->s_nzones |
@@ -1399,10 +1401,11 @@ struct inode *isofs_iget(struct super_block *sb, | |||
1399 | return inode; | 1401 | return inode; |
1400 | } | 1402 | } |
1401 | 1403 | ||
1402 | static struct super_block *isofs_get_sb(struct file_system_type *fs_type, | 1404 | static int isofs_get_sb(struct file_system_type *fs_type, |
1403 | int flags, const char *dev_name, void *data) | 1405 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
1404 | { | 1406 | { |
1405 | return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super); | 1407 | return get_sb_bdev(fs_type, flags, dev_name, data, isofs_fill_super, |
1408 | mnt); | ||
1406 | } | 1409 | } |
1407 | 1410 | ||
1408 | static struct file_system_type iso9660_fs_type = { | 1411 | static struct file_system_type iso9660_fs_type = { |
diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c index 3f5102b069db..47678a26c13b 100644 --- a/fs/jbd/checkpoint.c +++ b/fs/jbd/checkpoint.c | |||
@@ -24,29 +24,67 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * Unlink a buffer from a transaction. | 27 | * Unlink a buffer from a transaction checkpoint list. |
28 | * | 28 | * |
29 | * Called with j_list_lock held. | 29 | * Called with j_list_lock held. |
30 | */ | 30 | */ |
31 | 31 | static inline void __buffer_unlink_first(struct journal_head *jh) | |
32 | static inline void __buffer_unlink(struct journal_head *jh) | ||
33 | { | 32 | { |
34 | transaction_t *transaction; | 33 | transaction_t *transaction = jh->b_cp_transaction; |
35 | |||
36 | transaction = jh->b_cp_transaction; | ||
37 | jh->b_cp_transaction = NULL; | ||
38 | 34 | ||
39 | jh->b_cpnext->b_cpprev = jh->b_cpprev; | 35 | jh->b_cpnext->b_cpprev = jh->b_cpprev; |
40 | jh->b_cpprev->b_cpnext = jh->b_cpnext; | 36 | jh->b_cpprev->b_cpnext = jh->b_cpnext; |
41 | if (transaction->t_checkpoint_list == jh) | 37 | if (transaction->t_checkpoint_list == jh) { |
42 | transaction->t_checkpoint_list = jh->b_cpnext; | 38 | transaction->t_checkpoint_list = jh->b_cpnext; |
43 | if (transaction->t_checkpoint_list == jh) | 39 | if (transaction->t_checkpoint_list == jh) |
44 | transaction->t_checkpoint_list = NULL; | 40 | transaction->t_checkpoint_list = NULL; |
41 | } | ||
42 | } | ||
43 | |||
44 | /* | ||
45 | * Unlink a buffer from a transaction checkpoint(io) list. | ||
46 | * | ||
47 | * Called with j_list_lock held. | ||
48 | */ | ||
49 | static inline void __buffer_unlink(struct journal_head *jh) | ||
50 | { | ||
51 | transaction_t *transaction = jh->b_cp_transaction; | ||
52 | |||
53 | __buffer_unlink_first(jh); | ||
54 | if (transaction->t_checkpoint_io_list == jh) { | ||
55 | transaction->t_checkpoint_io_list = jh->b_cpnext; | ||
56 | if (transaction->t_checkpoint_io_list == jh) | ||
57 | transaction->t_checkpoint_io_list = NULL; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * Move a buffer from the checkpoint list to the checkpoint io list | ||
63 | * | ||
64 | * Called with j_list_lock held | ||
65 | */ | ||
66 | static inline void __buffer_relink_io(struct journal_head *jh) | ||
67 | { | ||
68 | transaction_t *transaction = jh->b_cp_transaction; | ||
69 | |||
70 | __buffer_unlink_first(jh); | ||
71 | |||
72 | if (!transaction->t_checkpoint_io_list) { | ||
73 | jh->b_cpnext = jh->b_cpprev = jh; | ||
74 | } else { | ||
75 | jh->b_cpnext = transaction->t_checkpoint_io_list; | ||
76 | jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev; | ||
77 | jh->b_cpprev->b_cpnext = jh; | ||
78 | jh->b_cpnext->b_cpprev = jh; | ||
79 | } | ||
80 | transaction->t_checkpoint_io_list = jh; | ||
45 | } | 81 | } |
46 | 82 | ||
47 | /* | 83 | /* |
48 | * Try to release a checkpointed buffer from its transaction. | 84 | * Try to release a checkpointed buffer from its transaction. |
49 | * Returns 1 if we released it. | 85 | * Returns 1 if we released it and 2 if we also released the |
86 | * whole transaction. | ||
87 | * | ||
50 | * Requires j_list_lock | 88 | * Requires j_list_lock |
51 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it | 89 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it |
52 | */ | 90 | */ |
@@ -57,12 +95,11 @@ static int __try_to_free_cp_buf(struct journal_head *jh) | |||
57 | 95 | ||
58 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) { | 96 | if (jh->b_jlist == BJ_None && !buffer_locked(bh) && !buffer_dirty(bh)) { |
59 | JBUFFER_TRACE(jh, "remove from checkpoint list"); | 97 | JBUFFER_TRACE(jh, "remove from checkpoint list"); |
60 | __journal_remove_checkpoint(jh); | 98 | ret = __journal_remove_checkpoint(jh) + 1; |
61 | jbd_unlock_bh_state(bh); | 99 | jbd_unlock_bh_state(bh); |
62 | journal_remove_journal_head(bh); | 100 | journal_remove_journal_head(bh); |
63 | BUFFER_TRACE(bh, "release"); | 101 | BUFFER_TRACE(bh, "release"); |
64 | __brelse(bh); | 102 | __brelse(bh); |
65 | ret = 1; | ||
66 | } else { | 103 | } else { |
67 | jbd_unlock_bh_state(bh); | 104 | jbd_unlock_bh_state(bh); |
68 | } | 105 | } |
@@ -117,83 +154,54 @@ static void jbd_sync_bh(journal_t *journal, struct buffer_head *bh) | |||
117 | } | 154 | } |
118 | 155 | ||
119 | /* | 156 | /* |
120 | * Clean up a transaction's checkpoint list. | 157 | * Clean up transaction's list of buffers submitted for io. |
121 | * | 158 | * We wait for any pending IO to complete and remove any clean |
122 | * We wait for any pending IO to complete and make sure any clean | 159 | * buffers. Note that we take the buffers in the opposite ordering |
123 | * buffers are removed from the transaction. | 160 | * from the one in which they were submitted for IO. |
124 | * | ||
125 | * Return 1 if we performed any actions which might have destroyed the | ||
126 | * checkpoint. (journal_remove_checkpoint() deletes the transaction when | ||
127 | * the last checkpoint buffer is cleansed) | ||
128 | * | 161 | * |
129 | * Called with j_list_lock held. | 162 | * Called with j_list_lock held. |
130 | */ | 163 | */ |
131 | static int __cleanup_transaction(journal_t *journal, transaction_t *transaction) | 164 | static void __wait_cp_io(journal_t *journal, transaction_t *transaction) |
132 | { | 165 | { |
133 | struct journal_head *jh, *next_jh, *last_jh; | 166 | struct journal_head *jh; |
134 | struct buffer_head *bh; | 167 | struct buffer_head *bh; |
135 | int ret = 0; | 168 | tid_t this_tid; |
136 | 169 | int released = 0; | |
137 | assert_spin_locked(&journal->j_list_lock); | 170 | |
138 | jh = transaction->t_checkpoint_list; | 171 | this_tid = transaction->t_tid; |
139 | if (!jh) | 172 | restart: |
140 | return 0; | 173 | /* Did somebody clean up the transaction in the meanwhile? */ |
141 | 174 | if (journal->j_checkpoint_transactions != transaction || | |
142 | last_jh = jh->b_cpprev; | 175 | transaction->t_tid != this_tid) |
143 | next_jh = jh; | 176 | return; |
144 | do { | 177 | while (!released && transaction->t_checkpoint_io_list) { |
145 | jh = next_jh; | 178 | jh = transaction->t_checkpoint_io_list; |
146 | bh = jh2bh(jh); | 179 | bh = jh2bh(jh); |
180 | if (!jbd_trylock_bh_state(bh)) { | ||
181 | jbd_sync_bh(journal, bh); | ||
182 | spin_lock(&journal->j_list_lock); | ||
183 | goto restart; | ||
184 | } | ||
147 | if (buffer_locked(bh)) { | 185 | if (buffer_locked(bh)) { |
148 | atomic_inc(&bh->b_count); | 186 | atomic_inc(&bh->b_count); |
149 | spin_unlock(&journal->j_list_lock); | 187 | spin_unlock(&journal->j_list_lock); |
188 | jbd_unlock_bh_state(bh); | ||
150 | wait_on_buffer(bh); | 189 | wait_on_buffer(bh); |
151 | /* the journal_head may have gone by now */ | 190 | /* the journal_head may have gone by now */ |
152 | BUFFER_TRACE(bh, "brelse"); | 191 | BUFFER_TRACE(bh, "brelse"); |
153 | __brelse(bh); | 192 | __brelse(bh); |
154 | goto out_return_1; | 193 | spin_lock(&journal->j_list_lock); |
194 | goto restart; | ||
155 | } | 195 | } |
156 | |||
157 | /* | 196 | /* |
158 | * This is foul | 197 | * Now in whatever state the buffer currently is, we know that |
198 | * it has been written out and so we can drop it from the list | ||
159 | */ | 199 | */ |
160 | if (!jbd_trylock_bh_state(bh)) { | 200 | released = __journal_remove_checkpoint(jh); |
161 | jbd_sync_bh(journal, bh); | 201 | jbd_unlock_bh_state(bh); |
162 | goto out_return_1; | 202 | journal_remove_journal_head(bh); |
163 | } | 203 | __brelse(bh); |
164 | 204 | } | |
165 | if (jh->b_transaction != NULL) { | ||
166 | transaction_t *t = jh->b_transaction; | ||
167 | tid_t tid = t->t_tid; | ||
168 | |||
169 | spin_unlock(&journal->j_list_lock); | ||
170 | jbd_unlock_bh_state(bh); | ||
171 | log_start_commit(journal, tid); | ||
172 | log_wait_commit(journal, tid); | ||
173 | goto out_return_1; | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * AKPM: I think the buffer_jbddirty test is redundant - it | ||
178 | * shouldn't have NULL b_transaction? | ||
179 | */ | ||
180 | next_jh = jh->b_cpnext; | ||
181 | if (!buffer_dirty(bh) && !buffer_jbddirty(bh)) { | ||
182 | BUFFER_TRACE(bh, "remove from checkpoint"); | ||
183 | __journal_remove_checkpoint(jh); | ||
184 | jbd_unlock_bh_state(bh); | ||
185 | journal_remove_journal_head(bh); | ||
186 | __brelse(bh); | ||
187 | ret = 1; | ||
188 | } else { | ||
189 | jbd_unlock_bh_state(bh); | ||
190 | } | ||
191 | } while (jh != last_jh); | ||
192 | |||
193 | return ret; | ||
194 | out_return_1: | ||
195 | spin_lock(&journal->j_list_lock); | ||
196 | return 1; | ||
197 | } | 205 | } |
198 | 206 | ||
199 | #define NR_BATCH 64 | 207 | #define NR_BATCH 64 |
@@ -203,9 +211,7 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count) | |||
203 | { | 211 | { |
204 | int i; | 212 | int i; |
205 | 213 | ||
206 | spin_unlock(&journal->j_list_lock); | ||
207 | ll_rw_block(SWRITE, *batch_count, bhs); | 214 | ll_rw_block(SWRITE, *batch_count, bhs); |
208 | spin_lock(&journal->j_list_lock); | ||
209 | for (i = 0; i < *batch_count; i++) { | 215 | for (i = 0; i < *batch_count; i++) { |
210 | struct buffer_head *bh = bhs[i]; | 216 | struct buffer_head *bh = bhs[i]; |
211 | clear_buffer_jwrite(bh); | 217 | clear_buffer_jwrite(bh); |
@@ -221,19 +227,43 @@ __flush_batch(journal_t *journal, struct buffer_head **bhs, int *batch_count) | |||
221 | * Return 1 if something happened which requires us to abort the current | 227 | * Return 1 if something happened which requires us to abort the current |
222 | * scan of the checkpoint list. | 228 | * scan of the checkpoint list. |
223 | * | 229 | * |
224 | * Called with j_list_lock held. | 230 | * Called with j_list_lock held and drops it if 1 is returned |
225 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it | 231 | * Called under jbd_lock_bh_state(jh2bh(jh)), and drops it |
226 | */ | 232 | */ |
227 | static int __flush_buffer(journal_t *journal, struct journal_head *jh, | 233 | static int __process_buffer(journal_t *journal, struct journal_head *jh, |
228 | struct buffer_head **bhs, int *batch_count, | 234 | struct buffer_head **bhs, int *batch_count) |
229 | int *drop_count) | ||
230 | { | 235 | { |
231 | struct buffer_head *bh = jh2bh(jh); | 236 | struct buffer_head *bh = jh2bh(jh); |
232 | int ret = 0; | 237 | int ret = 0; |
233 | 238 | ||
234 | if (buffer_dirty(bh) && !buffer_locked(bh) && jh->b_jlist == BJ_None) { | 239 | if (buffer_locked(bh)) { |
235 | J_ASSERT_JH(jh, jh->b_transaction == NULL); | 240 | atomic_inc(&bh->b_count); |
241 | spin_unlock(&journal->j_list_lock); | ||
242 | jbd_unlock_bh_state(bh); | ||
243 | wait_on_buffer(bh); | ||
244 | /* the journal_head may have gone by now */ | ||
245 | BUFFER_TRACE(bh, "brelse"); | ||
246 | __brelse(bh); | ||
247 | ret = 1; | ||
248 | } else if (jh->b_transaction != NULL) { | ||
249 | transaction_t *t = jh->b_transaction; | ||
250 | tid_t tid = t->t_tid; | ||
236 | 251 | ||
252 | spin_unlock(&journal->j_list_lock); | ||
253 | jbd_unlock_bh_state(bh); | ||
254 | log_start_commit(journal, tid); | ||
255 | log_wait_commit(journal, tid); | ||
256 | ret = 1; | ||
257 | } else if (!buffer_dirty(bh)) { | ||
258 | J_ASSERT_JH(jh, !buffer_jbddirty(bh)); | ||
259 | BUFFER_TRACE(bh, "remove from checkpoint"); | ||
260 | __journal_remove_checkpoint(jh); | ||
261 | spin_unlock(&journal->j_list_lock); | ||
262 | jbd_unlock_bh_state(bh); | ||
263 | journal_remove_journal_head(bh); | ||
264 | __brelse(bh); | ||
265 | ret = 1; | ||
266 | } else { | ||
237 | /* | 267 | /* |
238 | * Important: we are about to write the buffer, and | 268 | * Important: we are about to write the buffer, and |
239 | * possibly block, while still holding the journal lock. | 269 | * possibly block, while still holding the journal lock. |
@@ -246,45 +276,30 @@ static int __flush_buffer(journal_t *journal, struct journal_head *jh, | |||
246 | J_ASSERT_BH(bh, !buffer_jwrite(bh)); | 276 | J_ASSERT_BH(bh, !buffer_jwrite(bh)); |
247 | set_buffer_jwrite(bh); | 277 | set_buffer_jwrite(bh); |
248 | bhs[*batch_count] = bh; | 278 | bhs[*batch_count] = bh; |
279 | __buffer_relink_io(jh); | ||
249 | jbd_unlock_bh_state(bh); | 280 | jbd_unlock_bh_state(bh); |
250 | (*batch_count)++; | 281 | (*batch_count)++; |
251 | if (*batch_count == NR_BATCH) { | 282 | if (*batch_count == NR_BATCH) { |
283 | spin_unlock(&journal->j_list_lock); | ||
252 | __flush_batch(journal, bhs, batch_count); | 284 | __flush_batch(journal, bhs, batch_count); |
253 | ret = 1; | 285 | ret = 1; |
254 | } | 286 | } |
255 | } else { | ||
256 | int last_buffer = 0; | ||
257 | if (jh->b_cpnext == jh) { | ||
258 | /* We may be about to drop the transaction. Tell the | ||
259 | * caller that the lists have changed. | ||
260 | */ | ||
261 | last_buffer = 1; | ||
262 | } | ||
263 | if (__try_to_free_cp_buf(jh)) { | ||
264 | (*drop_count)++; | ||
265 | ret = last_buffer; | ||
266 | } | ||
267 | } | 287 | } |
268 | return ret; | 288 | return ret; |
269 | } | 289 | } |
270 | 290 | ||
271 | /* | 291 | /* |
272 | * Perform an actual checkpoint. We don't write out only enough to | 292 | * Perform an actual checkpoint. We take the first transaction on the |
273 | * satisfy the current blocked requests: rather we submit a reasonably | 293 | * list of transactions to be checkpointed and send all its buffers |
274 | * sized chunk of the outstanding data to disk at once for | 294 | * to disk. We submit larger chunks of data at once. |
275 | * efficiency. __log_wait_for_space() will retry if we didn't free enough. | ||
276 | * | 295 | * |
277 | * However, we _do_ take into account the amount requested so that once | ||
278 | * the IO has been queued, we can return as soon as enough of it has | ||
279 | * completed to disk. | ||
280 | * | ||
281 | * The journal should be locked before calling this function. | 296 | * The journal should be locked before calling this function. |
282 | */ | 297 | */ |
283 | int log_do_checkpoint(journal_t *journal) | 298 | int log_do_checkpoint(journal_t *journal) |
284 | { | 299 | { |
300 | transaction_t *transaction; | ||
301 | tid_t this_tid; | ||
285 | int result; | 302 | int result; |
286 | int batch_count = 0; | ||
287 | struct buffer_head *bhs[NR_BATCH]; | ||
288 | 303 | ||
289 | jbd_debug(1, "Start checkpoint\n"); | 304 | jbd_debug(1, "Start checkpoint\n"); |
290 | 305 | ||
@@ -299,79 +314,68 @@ int log_do_checkpoint(journal_t *journal) | |||
299 | return result; | 314 | return result; |
300 | 315 | ||
301 | /* | 316 | /* |
302 | * OK, we need to start writing disk blocks. Try to free up a | 317 | * OK, we need to start writing disk blocks. Take one transaction |
303 | * quarter of the log in a single checkpoint if we can. | 318 | * and write it. |
304 | */ | 319 | */ |
320 | spin_lock(&journal->j_list_lock); | ||
321 | if (!journal->j_checkpoint_transactions) | ||
322 | goto out; | ||
323 | transaction = journal->j_checkpoint_transactions; | ||
324 | this_tid = transaction->t_tid; | ||
325 | restart: | ||
305 | /* | 326 | /* |
306 | * AKPM: check this code. I had a feeling a while back that it | 327 | * If someone cleaned up this transaction while we slept, we're |
307 | * degenerates into a busy loop at unmount time. | 328 | * done (maybe it's a new transaction, but it fell at the same |
329 | * address). | ||
308 | */ | 330 | */ |
309 | spin_lock(&journal->j_list_lock); | 331 | if (journal->j_checkpoint_transactions == transaction && |
310 | while (journal->j_checkpoint_transactions) { | 332 | transaction->t_tid == this_tid) { |
311 | transaction_t *transaction; | 333 | int batch_count = 0; |
312 | struct journal_head *jh, *last_jh, *next_jh; | 334 | struct buffer_head *bhs[NR_BATCH]; |
313 | int drop_count = 0; | 335 | struct journal_head *jh; |
314 | int cleanup_ret, retry = 0; | 336 | int retry = 0; |
315 | tid_t this_tid; | 337 | |
316 | 338 | while (!retry && transaction->t_checkpoint_list) { | |
317 | transaction = journal->j_checkpoint_transactions; | ||
318 | this_tid = transaction->t_tid; | ||
319 | jh = transaction->t_checkpoint_list; | ||
320 | last_jh = jh->b_cpprev; | ||
321 | next_jh = jh; | ||
322 | do { | ||
323 | struct buffer_head *bh; | 339 | struct buffer_head *bh; |
324 | 340 | ||
325 | jh = next_jh; | 341 | jh = transaction->t_checkpoint_list; |
326 | next_jh = jh->b_cpnext; | ||
327 | bh = jh2bh(jh); | 342 | bh = jh2bh(jh); |
328 | if (!jbd_trylock_bh_state(bh)) { | 343 | if (!jbd_trylock_bh_state(bh)) { |
329 | jbd_sync_bh(journal, bh); | 344 | jbd_sync_bh(journal, bh); |
330 | spin_lock(&journal->j_list_lock); | ||
331 | retry = 1; | 345 | retry = 1; |
332 | break; | 346 | break; |
333 | } | 347 | } |
334 | retry = __flush_buffer(journal, jh, bhs, &batch_count, &drop_count); | 348 | retry = __process_buffer(journal, jh, bhs,&batch_count); |
335 | if (cond_resched_lock(&journal->j_list_lock)) { | 349 | if (!retry && lock_need_resched(&journal->j_list_lock)){ |
350 | spin_unlock(&journal->j_list_lock); | ||
336 | retry = 1; | 351 | retry = 1; |
337 | break; | 352 | break; |
338 | } | 353 | } |
339 | } while (jh != last_jh && !retry); | 354 | } |
340 | 355 | ||
341 | if (batch_count) { | 356 | if (batch_count) { |
357 | if (!retry) { | ||
358 | spin_unlock(&journal->j_list_lock); | ||
359 | retry = 1; | ||
360 | } | ||
342 | __flush_batch(journal, bhs, &batch_count); | 361 | __flush_batch(journal, bhs, &batch_count); |
343 | retry = 1; | ||
344 | } | 362 | } |
345 | 363 | ||
364 | if (retry) { | ||
365 | spin_lock(&journal->j_list_lock); | ||
366 | goto restart; | ||
367 | } | ||
346 | /* | 368 | /* |
347 | * If someone cleaned up this transaction while we slept, we're | 369 | * Now we have cleaned up the first transaction's checkpoint |
348 | * done | 370 | * list. Let's clean up the second one |
349 | */ | ||
350 | if (journal->j_checkpoint_transactions != transaction) | ||
351 | break; | ||
352 | if (retry) | ||
353 | continue; | ||
354 | /* | ||
355 | * Maybe it's a new transaction, but it fell at the same | ||
356 | * address | ||
357 | */ | ||
358 | if (transaction->t_tid != this_tid) | ||
359 | continue; | ||
360 | /* | ||
361 | * We have walked the whole transaction list without | ||
362 | * finding anything to write to disk. We had better be | ||
363 | * able to make some progress or we are in trouble. | ||
364 | */ | 371 | */ |
365 | cleanup_ret = __cleanup_transaction(journal, transaction); | 372 | __wait_cp_io(journal, transaction); |
366 | J_ASSERT(drop_count != 0 || cleanup_ret != 0); | ||
367 | if (journal->j_checkpoint_transactions != transaction) | ||
368 | break; | ||
369 | } | 373 | } |
374 | out: | ||
370 | spin_unlock(&journal->j_list_lock); | 375 | spin_unlock(&journal->j_list_lock); |
371 | result = cleanup_journal_tail(journal); | 376 | result = cleanup_journal_tail(journal); |
372 | if (result < 0) | 377 | if (result < 0) |
373 | return result; | 378 | return result; |
374 | |||
375 | return 0; | 379 | return 0; |
376 | } | 380 | } |
377 | 381 | ||
@@ -456,52 +460,98 @@ int cleanup_journal_tail(journal_t *journal) | |||
456 | /* Checkpoint list management */ | 460 | /* Checkpoint list management */ |
457 | 461 | ||
458 | /* | 462 | /* |
463 | * journal_clean_one_cp_list | ||
464 | * | ||
465 | * Find all the written-back checkpoint buffers in the given list and release them. | ||
466 | * | ||
467 | * Called with the journal locked. | ||
468 | * Called with j_list_lock held. | ||
469 | * Returns number of bufers reaped (for debug) | ||
470 | */ | ||
471 | |||
472 | static int journal_clean_one_cp_list(struct journal_head *jh, int *released) | ||
473 | { | ||
474 | struct journal_head *last_jh; | ||
475 | struct journal_head *next_jh = jh; | ||
476 | int ret, freed = 0; | ||
477 | |||
478 | *released = 0; | ||
479 | if (!jh) | ||
480 | return 0; | ||
481 | |||
482 | last_jh = jh->b_cpprev; | ||
483 | do { | ||
484 | jh = next_jh; | ||
485 | next_jh = jh->b_cpnext; | ||
486 | /* Use trylock because of the ranking */ | ||
487 | if (jbd_trylock_bh_state(jh2bh(jh))) { | ||
488 | ret = __try_to_free_cp_buf(jh); | ||
489 | if (ret) { | ||
490 | freed++; | ||
491 | if (ret == 2) { | ||
492 | *released = 1; | ||
493 | return freed; | ||
494 | } | ||
495 | } | ||
496 | } | ||
497 | /* | ||
498 | * This function only frees up some memory | ||
499 | * if possible so we dont have an obligation | ||
500 | * to finish processing. Bail out if preemption | ||
501 | * requested: | ||
502 | */ | ||
503 | if (need_resched()) | ||
504 | return freed; | ||
505 | } while (jh != last_jh); | ||
506 | |||
507 | return freed; | ||
508 | } | ||
509 | |||
510 | /* | ||
459 | * journal_clean_checkpoint_list | 511 | * journal_clean_checkpoint_list |
460 | * | 512 | * |
461 | * Find all the written-back checkpoint buffers in the journal and release them. | 513 | * Find all the written-back checkpoint buffers in the journal and release them. |
462 | * | 514 | * |
463 | * Called with the journal locked. | 515 | * Called with the journal locked. |
464 | * Called with j_list_lock held. | 516 | * Called with j_list_lock held. |
465 | * Returns number of bufers reaped (for debug) | 517 | * Returns number of buffers reaped (for debug) |
466 | */ | 518 | */ |
467 | 519 | ||
468 | int __journal_clean_checkpoint_list(journal_t *journal) | 520 | int __journal_clean_checkpoint_list(journal_t *journal) |
469 | { | 521 | { |
470 | transaction_t *transaction, *last_transaction, *next_transaction; | 522 | transaction_t *transaction, *last_transaction, *next_transaction; |
471 | int ret = 0; | 523 | int ret = 0; |
524 | int released; | ||
472 | 525 | ||
473 | transaction = journal->j_checkpoint_transactions; | 526 | transaction = journal->j_checkpoint_transactions; |
474 | if (transaction == 0) | 527 | if (!transaction) |
475 | goto out; | 528 | goto out; |
476 | 529 | ||
477 | last_transaction = transaction->t_cpprev; | 530 | last_transaction = transaction->t_cpprev; |
478 | next_transaction = transaction; | 531 | next_transaction = transaction; |
479 | do { | 532 | do { |
480 | struct journal_head *jh; | ||
481 | |||
482 | transaction = next_transaction; | 533 | transaction = next_transaction; |
483 | next_transaction = transaction->t_cpnext; | 534 | next_transaction = transaction->t_cpnext; |
484 | jh = transaction->t_checkpoint_list; | 535 | ret += journal_clean_one_cp_list(transaction-> |
485 | if (jh) { | 536 | t_checkpoint_list, &released); |
486 | struct journal_head *last_jh = jh->b_cpprev; | 537 | /* |
487 | struct journal_head *next_jh = jh; | 538 | * This function only frees up some memory if possible so we |
488 | 539 | * dont have an obligation to finish processing. Bail out if | |
489 | do { | 540 | * preemption requested: |
490 | jh = next_jh; | 541 | */ |
491 | next_jh = jh->b_cpnext; | 542 | if (need_resched()) |
492 | /* Use trylock because of the ranknig */ | 543 | goto out; |
493 | if (jbd_trylock_bh_state(jh2bh(jh))) | 544 | if (released) |
494 | ret += __try_to_free_cp_buf(jh); | 545 | continue; |
495 | /* | 546 | /* |
496 | * This function only frees up some memory | 547 | * It is essential that we are as careful as in the case of |
497 | * if possible so we dont have an obligation | 548 | * t_checkpoint_list with removing the buffer from the list as |
498 | * to finish processing. Bail out if preemption | 549 | * we can possibly see not yet submitted buffers on io_list |
499 | * requested: | 550 | */ |
500 | */ | 551 | ret += journal_clean_one_cp_list(transaction-> |
501 | if (need_resched()) | 552 | t_checkpoint_io_list, &released); |
502 | goto out; | 553 | if (need_resched()) |
503 | } while (jh != last_jh); | 554 | goto out; |
504 | } | ||
505 | } while (transaction != last_transaction); | 555 | } while (transaction != last_transaction); |
506 | out: | 556 | out: |
507 | return ret; | 557 | return ret; |
@@ -516,18 +566,22 @@ out: | |||
516 | * buffer updates committed in that transaction have safely been stored | 566 | * buffer updates committed in that transaction have safely been stored |
517 | * elsewhere on disk. To achieve this, all of the buffers in a | 567 | * elsewhere on disk. To achieve this, all of the buffers in a |
518 | * transaction need to be maintained on the transaction's checkpoint | 568 | * transaction need to be maintained on the transaction's checkpoint |
519 | * list until they have been rewritten, at which point this function is | 569 | * lists until they have been rewritten, at which point this function is |
520 | * called to remove the buffer from the existing transaction's | 570 | * called to remove the buffer from the existing transaction's |
521 | * checkpoint list. | 571 | * checkpoint lists. |
572 | * | ||
573 | * The function returns 1 if it frees the transaction, 0 otherwise. | ||
522 | * | 574 | * |
523 | * This function is called with the journal locked. | 575 | * This function is called with the journal locked. |
524 | * This function is called with j_list_lock held. | 576 | * This function is called with j_list_lock held. |
577 | * This function is called with jbd_lock_bh_state(jh2bh(jh)) | ||
525 | */ | 578 | */ |
526 | 579 | ||
527 | void __journal_remove_checkpoint(struct journal_head *jh) | 580 | int __journal_remove_checkpoint(struct journal_head *jh) |
528 | { | 581 | { |
529 | transaction_t *transaction; | 582 | transaction_t *transaction; |
530 | journal_t *journal; | 583 | journal_t *journal; |
584 | int ret = 0; | ||
531 | 585 | ||
532 | JBUFFER_TRACE(jh, "entry"); | 586 | JBUFFER_TRACE(jh, "entry"); |
533 | 587 | ||
@@ -538,8 +592,10 @@ void __journal_remove_checkpoint(struct journal_head *jh) | |||
538 | journal = transaction->t_journal; | 592 | journal = transaction->t_journal; |
539 | 593 | ||
540 | __buffer_unlink(jh); | 594 | __buffer_unlink(jh); |
595 | jh->b_cp_transaction = NULL; | ||
541 | 596 | ||
542 | if (transaction->t_checkpoint_list != NULL) | 597 | if (transaction->t_checkpoint_list != NULL || |
598 | transaction->t_checkpoint_io_list != NULL) | ||
543 | goto out; | 599 | goto out; |
544 | JBUFFER_TRACE(jh, "transaction has no more buffers"); | 600 | JBUFFER_TRACE(jh, "transaction has no more buffers"); |
545 | 601 | ||
@@ -565,8 +621,10 @@ void __journal_remove_checkpoint(struct journal_head *jh) | |||
565 | /* Just in case anybody was waiting for more transactions to be | 621 | /* Just in case anybody was waiting for more transactions to be |
566 | checkpointed... */ | 622 | checkpointed... */ |
567 | wake_up(&journal->j_wait_logspace); | 623 | wake_up(&journal->j_wait_logspace); |
624 | ret = 1; | ||
568 | out: | 625 | out: |
569 | JBUFFER_TRACE(jh, "exit"); | 626 | JBUFFER_TRACE(jh, "exit"); |
627 | return ret; | ||
570 | } | 628 | } |
571 | 629 | ||
572 | /* | 630 | /* |
@@ -628,6 +686,7 @@ void __journal_drop_transaction(journal_t *journal, transaction_t *transaction) | |||
628 | J_ASSERT(transaction->t_shadow_list == NULL); | 686 | J_ASSERT(transaction->t_shadow_list == NULL); |
629 | J_ASSERT(transaction->t_log_list == NULL); | 687 | J_ASSERT(transaction->t_log_list == NULL); |
630 | J_ASSERT(transaction->t_checkpoint_list == NULL); | 688 | J_ASSERT(transaction->t_checkpoint_list == NULL); |
689 | J_ASSERT(transaction->t_checkpoint_io_list == NULL); | ||
631 | J_ASSERT(transaction->t_updates == 0); | 690 | J_ASSERT(transaction->t_updates == 0); |
632 | J_ASSERT(journal->j_committing_transaction != transaction); | 691 | J_ASSERT(journal->j_committing_transaction != transaction); |
633 | J_ASSERT(journal->j_running_transaction != transaction); | 692 | J_ASSERT(journal->j_running_transaction != transaction); |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 002ad2bbc769..0971814c38b8 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -790,11 +790,22 @@ restart_loop: | |||
790 | jbd_unlock_bh_state(bh); | 790 | jbd_unlock_bh_state(bh); |
791 | } else { | 791 | } else { |
792 | J_ASSERT_BH(bh, !buffer_dirty(bh)); | 792 | J_ASSERT_BH(bh, !buffer_dirty(bh)); |
793 | J_ASSERT_JH(jh, jh->b_next_transaction == NULL); | 793 | /* The buffer on BJ_Forget list and not jbddirty means |
794 | __journal_unfile_buffer(jh); | 794 | * it has been freed by this transaction and hence it |
795 | jbd_unlock_bh_state(bh); | 795 | * could not have been reallocated until this |
796 | journal_remove_journal_head(bh); /* needs a brelse */ | 796 | * transaction has committed. *BUT* it could be |
797 | release_buffer_page(bh); | 797 | * reallocated once we have written all the data to |
798 | * disk and before we process the buffer on BJ_Forget | ||
799 | * list. */ | ||
800 | JBUFFER_TRACE(jh, "refile or unfile freed buffer"); | ||
801 | __journal_refile_buffer(jh); | ||
802 | if (!jh->b_transaction) { | ||
803 | jbd_unlock_bh_state(bh); | ||
804 | /* needs a brelse */ | ||
805 | journal_remove_journal_head(bh); | ||
806 | release_buffer_page(bh); | ||
807 | } else | ||
808 | jbd_unlock_bh_state(bh); | ||
798 | } | 809 | } |
799 | cond_resched_lock(&journal->j_list_lock); | 810 | cond_resched_lock(&journal->j_list_lock); |
800 | } | 811 | } |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index c609f5034fcd..508b2ea91f43 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -227,7 +227,8 @@ 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 | kfree(new_transaction); | 230 | if (unlikely(new_transaction)) /* It's usually NULL */ |
231 | kfree(new_transaction); | ||
231 | return ret; | 232 | return ret; |
232 | } | 233 | } |
233 | 234 | ||
@@ -724,7 +725,8 @@ done: | |||
724 | journal_cancel_revoke(handle, jh); | 725 | journal_cancel_revoke(handle, jh); |
725 | 726 | ||
726 | out: | 727 | out: |
727 | kfree(frozen_buffer); | 728 | if (unlikely(frozen_buffer)) /* It's usually NULL */ |
729 | kfree(frozen_buffer); | ||
728 | 730 | ||
729 | JBUFFER_TRACE(jh, "exit"); | 731 | JBUFFER_TRACE(jh, "exit"); |
730 | return error; | 732 | return error; |
@@ -903,7 +905,8 @@ repeat: | |||
903 | jbd_unlock_bh_state(bh); | 905 | jbd_unlock_bh_state(bh); |
904 | out: | 906 | out: |
905 | journal_put_journal_head(jh); | 907 | journal_put_journal_head(jh); |
906 | kfree(committed_data); | 908 | if (unlikely(committed_data)) |
909 | kfree(committed_data); | ||
907 | return err; | 910 | return err; |
908 | } | 911 | } |
909 | 912 | ||
@@ -2038,7 +2041,8 @@ void __journal_refile_buffer(struct journal_head *jh) | |||
2038 | __journal_temp_unlink_buffer(jh); | 2041 | __journal_temp_unlink_buffer(jh); |
2039 | jh->b_transaction = jh->b_next_transaction; | 2042 | jh->b_transaction = jh->b_next_transaction; |
2040 | jh->b_next_transaction = NULL; | 2043 | jh->b_next_transaction = NULL; |
2041 | __journal_file_buffer(jh, jh->b_transaction, BJ_Metadata); | 2044 | __journal_file_buffer(jh, jh->b_transaction, |
2045 | was_dirty ? BJ_Metadata : BJ_Reserved); | ||
2042 | J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); | 2046 | J_ASSERT_JH(jh, jh->b_transaction->t_state == T_RUNNING); |
2043 | 2047 | ||
2044 | if (was_dirty) | 2048 | if (was_dirty) |
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c index 020cc097c539..9e46ea6da752 100644 --- a/fs/jffs/inode-v23.c +++ b/fs/jffs/inode-v23.c | |||
@@ -377,9 +377,9 @@ jffs_new_inode(const struct inode * dir, struct jffs_raw_inode *raw_inode, | |||
377 | 377 | ||
378 | /* Get statistics of the file system. */ | 378 | /* Get statistics of the file system. */ |
379 | static int | 379 | static int |
380 | jffs_statfs(struct super_block *sb, struct kstatfs *buf) | 380 | jffs_statfs(struct dentry *dentry, struct kstatfs *buf) |
381 | { | 381 | { |
382 | struct jffs_control *c = (struct jffs_control *) sb->s_fs_info; | 382 | struct jffs_control *c = (struct jffs_control *) dentry->d_sb->s_fs_info; |
383 | struct jffs_fmcontrol *fmc; | 383 | struct jffs_fmcontrol *fmc; |
384 | 384 | ||
385 | lock_kernel(); | 385 | lock_kernel(); |
@@ -1785,10 +1785,11 @@ static struct super_operations jffs_ops = | |||
1785 | .remount_fs = jffs_remount, | 1785 | .remount_fs = jffs_remount, |
1786 | }; | 1786 | }; |
1787 | 1787 | ||
1788 | static struct super_block *jffs_get_sb(struct file_system_type *fs_type, | 1788 | static int jffs_get_sb(struct file_system_type *fs_type, |
1789 | int flags, const char *dev_name, void *data) | 1789 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
1790 | { | 1790 | { |
1791 | return get_sb_bdev(fs_type, flags, dev_name, data, jffs_fill_super); | 1791 | return get_sb_bdev(fs_type, flags, dev_name, data, jffs_fill_super, |
1792 | mnt); | ||
1792 | } | 1793 | } |
1793 | 1794 | ||
1794 | static struct file_system_type jffs_fs_type = { | 1795 | static struct file_system_type jffs_fs_type = { |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 7b6c24b14f85..2900ec3ec3af 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -192,9 +192,9 @@ int jffs2_setattr(struct dentry *dentry, struct iattr *iattr) | |||
192 | return rc; | 192 | return rc; |
193 | } | 193 | } |
194 | 194 | ||
195 | int jffs2_statfs(struct super_block *sb, struct kstatfs *buf) | 195 | int jffs2_statfs(struct dentry *dentry, struct kstatfs *buf) |
196 | { | 196 | { |
197 | struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); | 197 | struct jffs2_sb_info *c = JFFS2_SB_INFO(dentry->d_sb); |
198 | unsigned long avail; | 198 | unsigned long avail; |
199 | 199 | ||
200 | buf->f_type = JFFS2_SUPER_MAGIC; | 200 | buf->f_type = JFFS2_SUPER_MAGIC; |
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index cd4021bcb944..6b5223565405 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
@@ -175,7 +175,7 @@ void jffs2_clear_inode (struct inode *); | |||
175 | void jffs2_dirty_inode(struct inode *inode); | 175 | void jffs2_dirty_inode(struct inode *inode); |
176 | struct inode *jffs2_new_inode (struct inode *dir_i, int mode, | 176 | struct inode *jffs2_new_inode (struct inode *dir_i, int mode, |
177 | struct jffs2_raw_inode *ri); | 177 | struct jffs2_raw_inode *ri); |
178 | int jffs2_statfs (struct super_block *, struct kstatfs *); | 178 | int jffs2_statfs (struct dentry *, struct kstatfs *); |
179 | void jffs2_write_super (struct super_block *); | 179 | void jffs2_write_super (struct super_block *); |
180 | int jffs2_remount_fs (struct super_block *, int *, char *); | 180 | int jffs2_remount_fs (struct super_block *, int *, char *); |
181 | int jffs2_do_fill_super(struct super_block *sb, void *data, int silent); | 181 | int jffs2_do_fill_super(struct super_block *sb, void *data, int silent); |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 9d0521451f59..2378a662c256 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -111,9 +111,10 @@ static int jffs2_sb_set(struct super_block *sb, void *data) | |||
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
114 | static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type, | 114 | static int jffs2_get_sb_mtd(struct file_system_type *fs_type, |
115 | int flags, const char *dev_name, | 115 | int flags, const char *dev_name, |
116 | void *data, struct mtd_info *mtd) | 116 | void *data, struct mtd_info *mtd, |
117 | struct vfsmount *mnt) | ||
117 | { | 118 | { |
118 | struct super_block *sb; | 119 | struct super_block *sb; |
119 | struct jffs2_sb_info *c; | 120 | struct jffs2_sb_info *c; |
@@ -121,19 +122,20 @@ static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type, | |||
121 | 122 | ||
122 | c = kmalloc(sizeof(*c), GFP_KERNEL); | 123 | c = kmalloc(sizeof(*c), GFP_KERNEL); |
123 | if (!c) | 124 | if (!c) |
124 | return ERR_PTR(-ENOMEM); | 125 | return -ENOMEM; |
125 | memset(c, 0, sizeof(*c)); | 126 | memset(c, 0, sizeof(*c)); |
126 | c->mtd = mtd; | 127 | c->mtd = mtd; |
127 | 128 | ||
128 | sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c); | 129 | sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c); |
129 | 130 | ||
130 | if (IS_ERR(sb)) | 131 | if (IS_ERR(sb)) |
131 | goto out_put; | 132 | goto out_error; |
132 | 133 | ||
133 | if (sb->s_root) { | 134 | if (sb->s_root) { |
134 | /* New mountpoint for JFFS2 which is already mounted */ | 135 | /* New mountpoint for JFFS2 which is already mounted */ |
135 | D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): Device %d (\"%s\") is already mounted\n", | 136 | D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): Device %d (\"%s\") is already mounted\n", |
136 | mtd->index, mtd->name)); | 137 | mtd->index, mtd->name)); |
138 | ret = simple_set_mnt(mnt, sb); | ||
137 | goto out_put; | 139 | goto out_put; |
138 | } | 140 | } |
139 | 141 | ||
@@ -161,44 +163,47 @@ static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type, | |||
161 | /* Failure case... */ | 163 | /* Failure case... */ |
162 | up_write(&sb->s_umount); | 164 | up_write(&sb->s_umount); |
163 | deactivate_super(sb); | 165 | deactivate_super(sb); |
164 | return ERR_PTR(ret); | 166 | return ret; |
165 | } | 167 | } |
166 | 168 | ||
167 | sb->s_flags |= MS_ACTIVE; | 169 | sb->s_flags |= MS_ACTIVE; |
168 | return sb; | 170 | return simple_set_mnt(mnt, sb); |
169 | 171 | ||
172 | out_error: | ||
173 | ret = PTR_ERR(sb); | ||
170 | out_put: | 174 | out_put: |
171 | kfree(c); | 175 | kfree(c); |
172 | put_mtd_device(mtd); | 176 | put_mtd_device(mtd); |
173 | 177 | ||
174 | return sb; | 178 | return ret; |
175 | } | 179 | } |
176 | 180 | ||
177 | static struct super_block *jffs2_get_sb_mtdnr(struct file_system_type *fs_type, | 181 | static int jffs2_get_sb_mtdnr(struct file_system_type *fs_type, |
178 | int flags, const char *dev_name, | 182 | int flags, const char *dev_name, |
179 | void *data, int mtdnr) | 183 | void *data, int mtdnr, |
184 | struct vfsmount *mnt) | ||
180 | { | 185 | { |
181 | struct mtd_info *mtd; | 186 | struct mtd_info *mtd; |
182 | 187 | ||
183 | mtd = get_mtd_device(NULL, mtdnr); | 188 | mtd = get_mtd_device(NULL, mtdnr); |
184 | if (!mtd) { | 189 | if (!mtd) { |
185 | D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr)); | 190 | D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr)); |
186 | return ERR_PTR(-EINVAL); | 191 | return -EINVAL; |
187 | } | 192 | } |
188 | 193 | ||
189 | return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd); | 194 | return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt); |
190 | } | 195 | } |
191 | 196 | ||
192 | static struct super_block *jffs2_get_sb(struct file_system_type *fs_type, | 197 | static int jffs2_get_sb(struct file_system_type *fs_type, |
193 | int flags, const char *dev_name, | 198 | int flags, const char *dev_name, |
194 | void *data) | 199 | void *data, struct vfsmount *mnt) |
195 | { | 200 | { |
196 | int err; | 201 | int err; |
197 | struct nameidata nd; | 202 | struct nameidata nd; |
198 | int mtdnr; | 203 | int mtdnr; |
199 | 204 | ||
200 | if (!dev_name) | 205 | if (!dev_name) |
201 | return ERR_PTR(-EINVAL); | 206 | return -EINVAL; |
202 | 207 | ||
203 | D1(printk(KERN_DEBUG "jffs2_get_sb(): dev_name \"%s\"\n", dev_name)); | 208 | D1(printk(KERN_DEBUG "jffs2_get_sb(): dev_name \"%s\"\n", dev_name)); |
204 | 209 | ||
@@ -220,7 +225,7 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type, | |||
220 | mtd = get_mtd_device(NULL, mtdnr); | 225 | mtd = get_mtd_device(NULL, mtdnr); |
221 | if (mtd) { | 226 | if (mtd) { |
222 | if (!strcmp(mtd->name, dev_name+4)) | 227 | if (!strcmp(mtd->name, dev_name+4)) |
223 | return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd); | 228 | return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt); |
224 | put_mtd_device(mtd); | 229 | put_mtd_device(mtd); |
225 | } | 230 | } |
226 | } | 231 | } |
@@ -233,7 +238,7 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type, | |||
233 | if (!*endptr) { | 238 | if (!*endptr) { |
234 | /* It was a valid number */ | 239 | /* It was a valid number */ |
235 | D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd%%d, mtdnr %d\n", mtdnr)); | 240 | D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd%%d, mtdnr %d\n", mtdnr)); |
236 | return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr); | 241 | return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr, mnt); |
237 | } | 242 | } |
238 | } | 243 | } |
239 | } | 244 | } |
@@ -247,7 +252,7 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type, | |||
247 | err, nd.dentry->d_inode)); | 252 | err, nd.dentry->d_inode)); |
248 | 253 | ||
249 | if (err) | 254 | if (err) |
250 | return ERR_PTR(err); | 255 | return err; |
251 | 256 | ||
252 | err = -EINVAL; | 257 | err = -EINVAL; |
253 | 258 | ||
@@ -269,11 +274,11 @@ static struct super_block *jffs2_get_sb(struct file_system_type *fs_type, | |||
269 | mtdnr = iminor(nd.dentry->d_inode); | 274 | mtdnr = iminor(nd.dentry->d_inode); |
270 | path_release(&nd); | 275 | path_release(&nd); |
271 | 276 | ||
272 | return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr); | 277 | return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr, mnt); |
273 | 278 | ||
274 | out: | 279 | out: |
275 | path_release(&nd); | 280 | path_release(&nd); |
276 | return ERR_PTR(err); | 281 | return err; |
277 | } | 282 | } |
278 | 283 | ||
279 | static void jffs2_put_super (struct super_block *sb) | 284 | static void jffs2_put_super (struct super_block *sb) |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 2b220dd6b4e7..7f6e88039700 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -632,10 +632,9 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, | |||
632 | } | 632 | } |
633 | SetPageUptodate(page); | 633 | SetPageUptodate(page); |
634 | } else { | 634 | } else { |
635 | page = read_cache_page(mapping, page_index, | 635 | page = read_mapping_page(mapping, page_index, NULL); |
636 | (filler_t *)mapping->a_ops->readpage, NULL); | ||
637 | if (IS_ERR(page) || !PageUptodate(page)) { | 636 | if (IS_ERR(page) || !PageUptodate(page)) { |
638 | jfs_err("read_cache_page failed!"); | 637 | jfs_err("read_mapping_page failed!"); |
639 | return NULL; | 638 | return NULL; |
640 | } | 639 | } |
641 | lock_page(page); | 640 | lock_page(page); |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index db6f41d6dd60..73d2aba084c6 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -139,9 +139,9 @@ static void jfs_destroy_inode(struct inode *inode) | |||
139 | kmem_cache_free(jfs_inode_cachep, ji); | 139 | kmem_cache_free(jfs_inode_cachep, ji); |
140 | } | 140 | } |
141 | 141 | ||
142 | static int jfs_statfs(struct super_block *sb, struct kstatfs *buf) | 142 | static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
143 | { | 143 | { |
144 | struct jfs_sb_info *sbi = JFS_SBI(sb); | 144 | struct jfs_sb_info *sbi = JFS_SBI(dentry->d_sb); |
145 | s64 maxinodes; | 145 | s64 maxinodes; |
146 | struct inomap *imap = JFS_IP(sbi->ipimap)->i_imap; | 146 | struct inomap *imap = JFS_IP(sbi->ipimap)->i_imap; |
147 | 147 | ||
@@ -565,10 +565,11 @@ static void jfs_unlockfs(struct super_block *sb) | |||
565 | } | 565 | } |
566 | } | 566 | } |
567 | 567 | ||
568 | static struct super_block *jfs_get_sb(struct file_system_type *fs_type, | 568 | static int jfs_get_sb(struct file_system_type *fs_type, |
569 | int flags, const char *dev_name, void *data) | 569 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
570 | { | 570 | { |
571 | return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super); | 571 | return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super, |
572 | mnt); | ||
572 | } | 573 | } |
573 | 574 | ||
574 | static int jfs_sync_fs(struct super_block *sb, int wait) | 575 | static int jfs_sync_fs(struct super_block *sb, int wait) |
diff --git a/fs/libfs.c b/fs/libfs.c index 7145ba7a48d0..1b1156381787 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -20,9 +20,9 @@ int simple_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
20 | return 0; | 20 | return 0; |
21 | } | 21 | } |
22 | 22 | ||
23 | int simple_statfs(struct super_block *sb, struct kstatfs *buf) | 23 | int simple_statfs(struct dentry *dentry, struct kstatfs *buf) |
24 | { | 24 | { |
25 | buf->f_type = sb->s_magic; | 25 | buf->f_type = dentry->d_sb->s_magic; |
26 | buf->f_bsize = PAGE_CACHE_SIZE; | 26 | buf->f_bsize = PAGE_CACHE_SIZE; |
27 | buf->f_namelen = NAME_MAX; | 27 | buf->f_namelen = NAME_MAX; |
28 | return 0; | 28 | return 0; |
@@ -196,9 +196,9 @@ struct inode_operations simple_dir_inode_operations = { | |||
196 | * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that | 196 | * Common helper for pseudo-filesystems (sockfs, pipefs, bdev - stuff that |
197 | * will never be mountable) | 197 | * will never be mountable) |
198 | */ | 198 | */ |
199 | struct super_block * | 199 | int get_sb_pseudo(struct file_system_type *fs_type, char *name, |
200 | get_sb_pseudo(struct file_system_type *fs_type, char *name, | 200 | struct super_operations *ops, unsigned long magic, |
201 | struct super_operations *ops, unsigned long magic) | 201 | struct vfsmount *mnt) |
202 | { | 202 | { |
203 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); | 203 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); |
204 | static struct super_operations default_ops = {.statfs = simple_statfs}; | 204 | static struct super_operations default_ops = {.statfs = simple_statfs}; |
@@ -207,7 +207,7 @@ get_sb_pseudo(struct file_system_type *fs_type, char *name, | |||
207 | struct qstr d_name = {.name = name, .len = strlen(name)}; | 207 | struct qstr d_name = {.name = name, .len = strlen(name)}; |
208 | 208 | ||
209 | if (IS_ERR(s)) | 209 | if (IS_ERR(s)) |
210 | return s; | 210 | return PTR_ERR(s); |
211 | 211 | ||
212 | s->s_flags = MS_NOUSER; | 212 | s->s_flags = MS_NOUSER; |
213 | s->s_maxbytes = ~0ULL; | 213 | s->s_maxbytes = ~0ULL; |
@@ -232,12 +232,12 @@ get_sb_pseudo(struct file_system_type *fs_type, char *name, | |||
232 | d_instantiate(dentry, root); | 232 | d_instantiate(dentry, root); |
233 | s->s_root = dentry; | 233 | s->s_root = dentry; |
234 | s->s_flags |= MS_ACTIVE; | 234 | s->s_flags |= MS_ACTIVE; |
235 | return s; | 235 | return simple_set_mnt(mnt, s); |
236 | 236 | ||
237 | Enomem: | 237 | Enomem: |
238 | up_write(&s->s_umount); | 238 | up_write(&s->s_umount); |
239 | deactivate_super(s); | 239 | deactivate_super(s); |
240 | return ERR_PTR(-ENOMEM); | 240 | return -ENOMEM; |
241 | } | 241 | } |
242 | 242 | ||
243 | int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | 243 | int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) |
diff --git a/fs/locks.c b/fs/locks.c index 69435c68c1ed..1ad29c9b6252 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -703,7 +703,7 @@ EXPORT_SYMBOL(posix_test_lock); | |||
703 | * from a broken NFS client. But broken NFS clients have a lot more to | 703 | * from a broken NFS client. But broken NFS clients have a lot more to |
704 | * worry about than proper deadlock detection anyway... --okir | 704 | * worry about than proper deadlock detection anyway... --okir |
705 | */ | 705 | */ |
706 | int posix_locks_deadlock(struct file_lock *caller_fl, | 706 | static int posix_locks_deadlock(struct file_lock *caller_fl, |
707 | struct file_lock *block_fl) | 707 | struct file_lock *block_fl) |
708 | { | 708 | { |
709 | struct list_head *tmp; | 709 | struct list_head *tmp; |
@@ -722,8 +722,6 @@ next_task: | |||
722 | return 0; | 722 | return 0; |
723 | } | 723 | } |
724 | 724 | ||
725 | EXPORT_SYMBOL(posix_locks_deadlock); | ||
726 | |||
727 | /* Try to create a FLOCK lock on filp. We always insert new FLOCK locks | 725 | /* Try to create a FLOCK lock on filp. We always insert new FLOCK locks |
728 | * at the head of the list, but that's secret knowledge known only to | 726 | * at the head of the list, but that's secret knowledge known only to |
729 | * flock_lock_file and posix_lock_file. | 727 | * flock_lock_file and posix_lock_file. |
@@ -794,7 +792,8 @@ out: | |||
794 | static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request, struct file_lock *conflock) | 792 | static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request, struct file_lock *conflock) |
795 | { | 793 | { |
796 | struct file_lock *fl; | 794 | struct file_lock *fl; |
797 | struct file_lock *new_fl, *new_fl2; | 795 | struct file_lock *new_fl = NULL; |
796 | struct file_lock *new_fl2 = NULL; | ||
798 | struct file_lock *left = NULL; | 797 | struct file_lock *left = NULL; |
799 | struct file_lock *right = NULL; | 798 | struct file_lock *right = NULL; |
800 | struct file_lock **before; | 799 | struct file_lock **before; |
@@ -803,9 +802,15 @@ static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request | |||
803 | /* | 802 | /* |
804 | * We may need two file_lock structures for this operation, | 803 | * We may need two file_lock structures for this operation, |
805 | * so we get them in advance to avoid races. | 804 | * so we get them in advance to avoid races. |
805 | * | ||
806 | * In some cases we can be sure, that no new locks will be needed | ||
806 | */ | 807 | */ |
807 | new_fl = locks_alloc_lock(); | 808 | if (!(request->fl_flags & FL_ACCESS) && |
808 | new_fl2 = locks_alloc_lock(); | 809 | (request->fl_type != F_UNLCK || |
810 | request->fl_start != 0 || request->fl_end != OFFSET_MAX)) { | ||
811 | new_fl = locks_alloc_lock(); | ||
812 | new_fl2 = locks_alloc_lock(); | ||
813 | } | ||
809 | 814 | ||
810 | lock_kernel(); | 815 | lock_kernel(); |
811 | if (request->fl_type != F_UNLCK) { | 816 | if (request->fl_type != F_UNLCK) { |
@@ -834,14 +839,7 @@ static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request | |||
834 | if (request->fl_flags & FL_ACCESS) | 839 | if (request->fl_flags & FL_ACCESS) |
835 | goto out; | 840 | goto out; |
836 | 841 | ||
837 | error = -ENOLCK; /* "no luck" */ | ||
838 | if (!(new_fl && new_fl2)) | ||
839 | goto out; | ||
840 | |||
841 | /* | 842 | /* |
842 | * We've allocated the new locks in advance, so there are no | ||
843 | * errors possible (and no blocking operations) from here on. | ||
844 | * | ||
845 | * Find the first old lock with the same owner as the new lock. | 843 | * Find the first old lock with the same owner as the new lock. |
846 | */ | 844 | */ |
847 | 845 | ||
@@ -938,10 +936,25 @@ static int __posix_lock_file_conf(struct inode *inode, struct file_lock *request | |||
938 | before = &fl->fl_next; | 936 | before = &fl->fl_next; |
939 | } | 937 | } |
940 | 938 | ||
939 | /* | ||
940 | * The above code only modifies existing locks in case of | ||
941 | * merging or replacing. If new lock(s) need to be inserted | ||
942 | * all modifications are done bellow this, so it's safe yet to | ||
943 | * bail out. | ||
944 | */ | ||
945 | error = -ENOLCK; /* "no luck" */ | ||
946 | if (right && left == right && !new_fl2) | ||
947 | goto out; | ||
948 | |||
941 | error = 0; | 949 | error = 0; |
942 | if (!added) { | 950 | if (!added) { |
943 | if (request->fl_type == F_UNLCK) | 951 | if (request->fl_type == F_UNLCK) |
944 | goto out; | 952 | goto out; |
953 | |||
954 | if (!new_fl) { | ||
955 | error = -ENOLCK; | ||
956 | goto out; | ||
957 | } | ||
945 | locks_copy_lock(new_fl, request); | 958 | locks_copy_lock(new_fl, request); |
946 | locks_insert_lock(before, new_fl); | 959 | locks_insert_lock(before, new_fl); |
947 | new_fl = NULL; | 960 | new_fl = NULL; |
@@ -1881,19 +1894,18 @@ out: | |||
1881 | */ | 1894 | */ |
1882 | void locks_remove_posix(struct file *filp, fl_owner_t owner) | 1895 | void locks_remove_posix(struct file *filp, fl_owner_t owner) |
1883 | { | 1896 | { |
1884 | struct file_lock lock, **before; | 1897 | struct file_lock lock; |
1885 | 1898 | ||
1886 | /* | 1899 | /* |
1887 | * If there are no locks held on this file, we don't need to call | 1900 | * If there are no locks held on this file, we don't need to call |
1888 | * posix_lock_file(). Another process could be setting a lock on this | 1901 | * posix_lock_file(). Another process could be setting a lock on this |
1889 | * file at the same time, but we wouldn't remove that lock anyway. | 1902 | * file at the same time, but we wouldn't remove that lock anyway. |
1890 | */ | 1903 | */ |
1891 | before = &filp->f_dentry->d_inode->i_flock; | 1904 | if (!filp->f_dentry->d_inode->i_flock) |
1892 | if (*before == NULL) | ||
1893 | return; | 1905 | return; |
1894 | 1906 | ||
1895 | lock.fl_type = F_UNLCK; | 1907 | lock.fl_type = F_UNLCK; |
1896 | lock.fl_flags = FL_POSIX; | 1908 | lock.fl_flags = FL_POSIX | FL_CLOSE; |
1897 | lock.fl_start = 0; | 1909 | lock.fl_start = 0; |
1898 | lock.fl_end = OFFSET_MAX; | 1910 | lock.fl_end = OFFSET_MAX; |
1899 | lock.fl_owner = owner; | 1911 | lock.fl_owner = owner; |
@@ -1902,25 +1914,11 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner) | |||
1902 | lock.fl_ops = NULL; | 1914 | lock.fl_ops = NULL; |
1903 | lock.fl_lmops = NULL; | 1915 | lock.fl_lmops = NULL; |
1904 | 1916 | ||
1905 | if (filp->f_op && filp->f_op->lock != NULL) { | 1917 | if (filp->f_op && filp->f_op->lock != NULL) |
1906 | filp->f_op->lock(filp, F_SETLK, &lock); | 1918 | filp->f_op->lock(filp, F_SETLK, &lock); |
1907 | goto out; | 1919 | else |
1908 | } | 1920 | posix_lock_file(filp, &lock); |
1909 | 1921 | ||
1910 | /* Can't use posix_lock_file here; we need to remove it no matter | ||
1911 | * which pid we have. | ||
1912 | */ | ||
1913 | lock_kernel(); | ||
1914 | while (*before != NULL) { | ||
1915 | struct file_lock *fl = *before; | ||
1916 | if (IS_POSIX(fl) && posix_same_owner(fl, &lock)) { | ||
1917 | locks_delete_lock(before); | ||
1918 | continue; | ||
1919 | } | ||
1920 | before = &fl->fl_next; | ||
1921 | } | ||
1922 | unlock_kernel(); | ||
1923 | out: | ||
1924 | if (lock.fl_ops && lock.fl_ops->fl_release_private) | 1922 | if (lock.fl_ops && lock.fl_ops->fl_release_private) |
1925 | lock.fl_ops->fl_release_private(&lock); | 1923 | lock.fl_ops->fl_release_private(&lock); |
1926 | } | 1924 | } |
diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 69224d1fe043..2b0a389d1987 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c | |||
@@ -60,8 +60,7 @@ static int dir_commit_chunk(struct page *page, unsigned from, unsigned to) | |||
60 | static struct page * dir_get_page(struct inode *dir, unsigned long n) | 60 | static struct page * dir_get_page(struct inode *dir, unsigned long n) |
61 | { | 61 | { |
62 | struct address_space *mapping = dir->i_mapping; | 62 | struct address_space *mapping = dir->i_mapping; |
63 | struct page *page = read_cache_page(mapping, n, | 63 | struct page *page = read_mapping_page(mapping, n, NULL); |
64 | (filler_t*)mapping->a_ops->readpage, NULL); | ||
65 | if (!IS_ERR(page)) { | 64 | if (!IS_ERR(page)) { |
66 | wait_on_page_locked(page); | 65 | wait_on_page_locked(page); |
67 | kmap(page); | 66 | kmap(page); |
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index 2dcccf1d1b7f..a6fb509b7341 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | static void minix_read_inode(struct inode * inode); | 20 | static void minix_read_inode(struct inode * inode); |
21 | static int minix_write_inode(struct inode * inode, int wait); | 21 | static int minix_write_inode(struct inode * inode, int wait); |
22 | static int minix_statfs(struct super_block *sb, struct kstatfs *buf); | 22 | static int minix_statfs(struct dentry *dentry, struct kstatfs *buf); |
23 | static int minix_remount (struct super_block * sb, int * flags, char * data); | 23 | static int minix_remount (struct super_block * sb, int * flags, char * data); |
24 | 24 | ||
25 | static void minix_delete_inode(struct inode *inode) | 25 | static void minix_delete_inode(struct inode *inode) |
@@ -296,11 +296,11 @@ out_bad_sb: | |||
296 | return -EINVAL; | 296 | return -EINVAL; |
297 | } | 297 | } |
298 | 298 | ||
299 | static int minix_statfs(struct super_block *sb, struct kstatfs *buf) | 299 | static int minix_statfs(struct dentry *dentry, struct kstatfs *buf) |
300 | { | 300 | { |
301 | struct minix_sb_info *sbi = minix_sb(sb); | 301 | struct minix_sb_info *sbi = minix_sb(dentry->d_sb); |
302 | buf->f_type = sb->s_magic; | 302 | buf->f_type = dentry->d_sb->s_magic; |
303 | buf->f_bsize = sb->s_blocksize; | 303 | buf->f_bsize = dentry->d_sb->s_blocksize; |
304 | buf->f_blocks = (sbi->s_nzones - sbi->s_firstdatazone) << sbi->s_log_zone_size; | 304 | buf->f_blocks = (sbi->s_nzones - sbi->s_firstdatazone) << sbi->s_log_zone_size; |
305 | buf->f_bfree = minix_count_free_blocks(sbi); | 305 | buf->f_bfree = minix_count_free_blocks(sbi); |
306 | buf->f_bavail = buf->f_bfree; | 306 | buf->f_bavail = buf->f_bfree; |
@@ -559,10 +559,11 @@ void minix_truncate(struct inode * inode) | |||
559 | V2_minix_truncate(inode); | 559 | V2_minix_truncate(inode); |
560 | } | 560 | } |
561 | 561 | ||
562 | static struct super_block *minix_get_sb(struct file_system_type *fs_type, | 562 | static int minix_get_sb(struct file_system_type *fs_type, |
563 | int flags, const char *dev_name, void *data) | 563 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
564 | { | 564 | { |
565 | return get_sb_bdev(fs_type, flags, dev_name, data, minix_fill_super); | 565 | return get_sb_bdev(fs_type, flags, dev_name, data, minix_fill_super, |
566 | mnt); | ||
566 | } | 567 | } |
567 | 568 | ||
568 | static struct file_system_type minix_fs_type = { | 569 | static struct file_system_type minix_fs_type = { |
diff --git a/fs/mpage.c b/fs/mpage.c index 9bf2eb30e6f4..1e4598247d0b 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
@@ -707,9 +707,9 @@ mpage_writepages(struct address_space *mapping, | |||
707 | struct pagevec pvec; | 707 | struct pagevec pvec; |
708 | int nr_pages; | 708 | int nr_pages; |
709 | pgoff_t index; | 709 | pgoff_t index; |
710 | pgoff_t end = -1; /* Inclusive */ | 710 | pgoff_t end; /* Inclusive */ |
711 | int scanned = 0; | 711 | int scanned = 0; |
712 | int is_range = 0; | 712 | int range_whole = 0; |
713 | 713 | ||
714 | if (wbc->nonblocking && bdi_write_congested(bdi)) { | 714 | if (wbc->nonblocking && bdi_write_congested(bdi)) { |
715 | wbc->encountered_congestion = 1; | 715 | wbc->encountered_congestion = 1; |
@@ -721,16 +721,14 @@ mpage_writepages(struct address_space *mapping, | |||
721 | writepage = mapping->a_ops->writepage; | 721 | writepage = mapping->a_ops->writepage; |
722 | 722 | ||
723 | pagevec_init(&pvec, 0); | 723 | pagevec_init(&pvec, 0); |
724 | if (wbc->sync_mode == WB_SYNC_NONE) { | 724 | if (wbc->range_cyclic) { |
725 | index = mapping->writeback_index; /* Start from prev offset */ | 725 | index = mapping->writeback_index; /* Start from prev offset */ |
726 | end = -1; | ||
726 | } else { | 727 | } else { |
727 | index = 0; /* whole-file sweep */ | 728 | index = wbc->range_start >> PAGE_CACHE_SHIFT; |
728 | scanned = 1; | 729 | end = wbc->range_end >> PAGE_CACHE_SHIFT; |
729 | } | 730 | if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) |
730 | if (wbc->start || wbc->end) { | 731 | range_whole = 1; |
731 | index = wbc->start >> PAGE_CACHE_SHIFT; | ||
732 | end = wbc->end >> PAGE_CACHE_SHIFT; | ||
733 | is_range = 1; | ||
734 | scanned = 1; | 732 | scanned = 1; |
735 | } | 733 | } |
736 | retry: | 734 | retry: |
@@ -759,7 +757,7 @@ retry: | |||
759 | continue; | 757 | continue; |
760 | } | 758 | } |
761 | 759 | ||
762 | if (unlikely(is_range) && page->index > end) { | 760 | if (!wbc->range_cyclic && page->index > end) { |
763 | done = 1; | 761 | done = 1; |
764 | unlock_page(page); | 762 | unlock_page(page); |
765 | continue; | 763 | continue; |
@@ -810,7 +808,7 @@ retry: | |||
810 | index = 0; | 808 | index = 0; |
811 | goto retry; | 809 | goto retry; |
812 | } | 810 | } |
813 | if (!is_range) | 811 | if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) |
814 | mapping->writeback_index = index; | 812 | mapping->writeback_index = index; |
815 | if (bio) | 813 | if (bio) |
816 | mpage_bio_submit(WRITE, bio); | 814 | mpage_bio_submit(WRITE, bio); |
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c index 5b76ccd19e3f..9e44158a7540 100644 --- a/fs/msdos/namei.c +++ b/fs/msdos/namei.c | |||
@@ -661,11 +661,12 @@ static int msdos_fill_super(struct super_block *sb, void *data, int silent) | |||
661 | return 0; | 661 | return 0; |
662 | } | 662 | } |
663 | 663 | ||
664 | static struct super_block *msdos_get_sb(struct file_system_type *fs_type, | 664 | static int msdos_get_sb(struct file_system_type *fs_type, |
665 | int flags, const char *dev_name, | 665 | int flags, const char *dev_name, |
666 | void *data) | 666 | void *data, struct vfsmount *mnt) |
667 | { | 667 | { |
668 | return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super); | 668 | return get_sb_bdev(fs_type, flags, dev_name, data, msdos_fill_super, |
669 | mnt); | ||
669 | } | 670 | } |
670 | 671 | ||
671 | static struct file_system_type msdos_fs_type = { | 672 | static struct file_system_type msdos_fs_type = { |
diff --git a/fs/namei.c b/fs/namei.c index 184fe4acf824..bb4a3e40e432 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2577,8 +2577,7 @@ static char *page_getlink(struct dentry * dentry, struct page **ppage) | |||
2577 | { | 2577 | { |
2578 | struct page * page; | 2578 | struct page * page; |
2579 | struct address_space *mapping = dentry->d_inode->i_mapping; | 2579 | struct address_space *mapping = dentry->d_inode->i_mapping; |
2580 | page = read_cache_page(mapping, 0, (filler_t *)mapping->a_ops->readpage, | 2580 | page = read_mapping_page(mapping, 0, NULL); |
2581 | NULL); | ||
2582 | if (IS_ERR(page)) | 2581 | if (IS_ERR(page)) |
2583 | goto sync_fail; | 2582 | goto sync_fail; |
2584 | wait_on_page_locked(page); | 2583 | wait_on_page_locked(page); |
diff --git a/fs/namespace.c b/fs/namespace.c index bf478addb852..c13072a5f1ee 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -86,6 +86,15 @@ struct vfsmount *alloc_vfsmnt(const char *name) | |||
86 | return mnt; | 86 | return mnt; |
87 | } | 87 | } |
88 | 88 | ||
89 | int simple_set_mnt(struct vfsmount *mnt, struct super_block *sb) | ||
90 | { | ||
91 | mnt->mnt_sb = sb; | ||
92 | mnt->mnt_root = dget(sb->s_root); | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | EXPORT_SYMBOL(simple_set_mnt); | ||
97 | |||
89 | void free_vfsmnt(struct vfsmount *mnt) | 98 | void free_vfsmnt(struct vfsmount *mnt) |
90 | { | 99 | { |
91 | kfree(mnt->mnt_devname); | 100 | kfree(mnt->mnt_devname); |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index a1f3e972c6ef..90d2ea28f333 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | static void ncp_delete_inode(struct inode *); | 40 | static void ncp_delete_inode(struct inode *); |
41 | static void ncp_put_super(struct super_block *); | 41 | static void ncp_put_super(struct super_block *); |
42 | static int ncp_statfs(struct super_block *, struct kstatfs *); | 42 | static int ncp_statfs(struct dentry *, struct kstatfs *); |
43 | 43 | ||
44 | static kmem_cache_t * ncp_inode_cachep; | 44 | static kmem_cache_t * ncp_inode_cachep; |
45 | 45 | ||
@@ -724,13 +724,14 @@ static void ncp_put_super(struct super_block *sb) | |||
724 | kfree(server); | 724 | kfree(server); |
725 | } | 725 | } |
726 | 726 | ||
727 | static int ncp_statfs(struct super_block *sb, struct kstatfs *buf) | 727 | static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf) |
728 | { | 728 | { |
729 | struct dentry* d; | 729 | struct dentry* d; |
730 | struct inode* i; | 730 | struct inode* i; |
731 | struct ncp_inode_info* ni; | 731 | struct ncp_inode_info* ni; |
732 | struct ncp_server* s; | 732 | struct ncp_server* s; |
733 | struct ncp_volume_info vi; | 733 | struct ncp_volume_info vi; |
734 | struct super_block *sb = dentry->d_sb; | ||
734 | int err; | 735 | int err; |
735 | __u8 dh; | 736 | __u8 dh; |
736 | 737 | ||
@@ -957,10 +958,10 @@ out: | |||
957 | return result; | 958 | return result; |
958 | } | 959 | } |
959 | 960 | ||
960 | static struct super_block *ncp_get_sb(struct file_system_type *fs_type, | 961 | static int ncp_get_sb(struct file_system_type *fs_type, |
961 | int flags, const char *dev_name, void *data) | 962 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
962 | { | 963 | { |
963 | return get_sb_nodev(fs_type, flags, data, ncp_fill_super); | 964 | return get_sb_nodev(fs_type, flags, data, ncp_fill_super, mnt); |
964 | } | 965 | } |
965 | 966 | ||
966 | static struct file_system_type ncp_fs_type = { | 967 | static struct file_system_type ncp_fs_type = { |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index fade02c15e6e..fa05c027ea11 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -43,7 +43,7 @@ static int nfs_file_mmap(struct file *, struct vm_area_struct *); | |||
43 | static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); | 43 | static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); |
44 | static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t); | 44 | static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t); |
45 | static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t); | 45 | static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t); |
46 | static int nfs_file_flush(struct file *); | 46 | static int nfs_file_flush(struct file *, fl_owner_t id); |
47 | static int nfs_fsync(struct file *, struct dentry *dentry, int datasync); | 47 | static int nfs_fsync(struct file *, struct dentry *dentry, int datasync); |
48 | static int nfs_check_flags(int flags); | 48 | static int nfs_check_flags(int flags); |
49 | static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl); | 49 | static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl); |
@@ -188,7 +188,7 @@ static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) | |||
188 | * | 188 | * |
189 | */ | 189 | */ |
190 | static int | 190 | static int |
191 | nfs_file_flush(struct file *file) | 191 | nfs_file_flush(struct file *file, fl_owner_t id) |
192 | { | 192 | { |
193 | struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; | 193 | struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data; |
194 | struct inode *inode = file->f_dentry->d_inode; | 194 | struct inode *inode = file->f_dentry->d_inode; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index d0b991a92327..937fbfc381bb 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -65,7 +65,7 @@ static int nfs_write_inode(struct inode *,int); | |||
65 | static void nfs_delete_inode(struct inode *); | 65 | static void nfs_delete_inode(struct inode *); |
66 | static void nfs_clear_inode(struct inode *); | 66 | static void nfs_clear_inode(struct inode *); |
67 | static void nfs_umount_begin(struct super_block *); | 67 | static void nfs_umount_begin(struct super_block *); |
68 | static int nfs_statfs(struct super_block *, struct kstatfs *); | 68 | static int nfs_statfs(struct dentry *, struct kstatfs *); |
69 | static int nfs_show_options(struct seq_file *, struct vfsmount *); | 69 | static int nfs_show_options(struct seq_file *, struct vfsmount *); |
70 | static int nfs_show_stats(struct seq_file *, struct vfsmount *); | 70 | static int nfs_show_stats(struct seq_file *, struct vfsmount *); |
71 | static void nfs_zap_acl_cache(struct inode *); | 71 | static void nfs_zap_acl_cache(struct inode *); |
@@ -534,8 +534,9 @@ nfs_fill_super(struct super_block *sb, struct nfs_mount_data *data, int silent) | |||
534 | } | 534 | } |
535 | 535 | ||
536 | static int | 536 | static int |
537 | nfs_statfs(struct super_block *sb, struct kstatfs *buf) | 537 | nfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
538 | { | 538 | { |
539 | struct super_block *sb = dentry->d_sb; | ||
539 | struct nfs_server *server = NFS_SB(sb); | 540 | struct nfs_server *server = NFS_SB(sb); |
540 | unsigned char blockbits; | 541 | unsigned char blockbits; |
541 | unsigned long blockres; | 542 | unsigned long blockres; |
@@ -1690,8 +1691,8 @@ static int nfs_compare_super(struct super_block *sb, void *data) | |||
1690 | return !nfs_compare_fh(&old->fh, &server->fh); | 1691 | return !nfs_compare_fh(&old->fh, &server->fh); |
1691 | } | 1692 | } |
1692 | 1693 | ||
1693 | static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | 1694 | static int nfs_get_sb(struct file_system_type *fs_type, |
1694 | int flags, const char *dev_name, void *raw_data) | 1695 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) |
1695 | { | 1696 | { |
1696 | int error; | 1697 | int error; |
1697 | struct nfs_server *server = NULL; | 1698 | struct nfs_server *server = NULL; |
@@ -1699,14 +1700,14 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | |||
1699 | struct nfs_fh *root; | 1700 | struct nfs_fh *root; |
1700 | struct nfs_mount_data *data = raw_data; | 1701 | struct nfs_mount_data *data = raw_data; |
1701 | 1702 | ||
1702 | s = ERR_PTR(-EINVAL); | 1703 | error = -EINVAL; |
1703 | if (data == NULL) { | 1704 | if (data == NULL) { |
1704 | dprintk("%s: missing data argument\n", __FUNCTION__); | 1705 | dprintk("%s: missing data argument\n", __FUNCTION__); |
1705 | goto out_err; | 1706 | goto out_err_noserver; |
1706 | } | 1707 | } |
1707 | if (data->version <= 0 || data->version > NFS_MOUNT_VERSION) { | 1708 | if (data->version <= 0 || data->version > NFS_MOUNT_VERSION) { |
1708 | dprintk("%s: bad mount version\n", __FUNCTION__); | 1709 | dprintk("%s: bad mount version\n", __FUNCTION__); |
1709 | goto out_err; | 1710 | goto out_err_noserver; |
1710 | } | 1711 | } |
1711 | switch (data->version) { | 1712 | switch (data->version) { |
1712 | case 1: | 1713 | case 1: |
@@ -1718,7 +1719,7 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | |||
1718 | dprintk("%s: mount structure version %d does not support NFSv3\n", | 1719 | dprintk("%s: mount structure version %d does not support NFSv3\n", |
1719 | __FUNCTION__, | 1720 | __FUNCTION__, |
1720 | data->version); | 1721 | data->version); |
1721 | goto out_err; | 1722 | goto out_err_noserver; |
1722 | } | 1723 | } |
1723 | data->root.size = NFS2_FHSIZE; | 1724 | data->root.size = NFS2_FHSIZE; |
1724 | memcpy(data->root.data, data->old_root.data, NFS2_FHSIZE); | 1725 | memcpy(data->root.data, data->old_root.data, NFS2_FHSIZE); |
@@ -1727,24 +1728,24 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | |||
1727 | dprintk("%s: mount structure version %d does not support strong security\n", | 1728 | dprintk("%s: mount structure version %d does not support strong security\n", |
1728 | __FUNCTION__, | 1729 | __FUNCTION__, |
1729 | data->version); | 1730 | data->version); |
1730 | goto out_err; | 1731 | goto out_err_noserver; |
1731 | } | 1732 | } |
1732 | case 5: | 1733 | case 5: |
1733 | memset(data->context, 0, sizeof(data->context)); | 1734 | memset(data->context, 0, sizeof(data->context)); |
1734 | } | 1735 | } |
1735 | #ifndef CONFIG_NFS_V3 | 1736 | #ifndef CONFIG_NFS_V3 |
1736 | /* If NFSv3 is not compiled in, return -EPROTONOSUPPORT */ | 1737 | /* If NFSv3 is not compiled in, return -EPROTONOSUPPORT */ |
1737 | s = ERR_PTR(-EPROTONOSUPPORT); | 1738 | error = -EPROTONOSUPPORT; |
1738 | if (data->flags & NFS_MOUNT_VER3) { | 1739 | if (data->flags & NFS_MOUNT_VER3) { |
1739 | dprintk("%s: NFSv3 not compiled into kernel\n", __FUNCTION__); | 1740 | dprintk("%s: NFSv3 not compiled into kernel\n", __FUNCTION__); |
1740 | goto out_err; | 1741 | goto out_err_noserver; |
1741 | } | 1742 | } |
1742 | #endif /* CONFIG_NFS_V3 */ | 1743 | #endif /* CONFIG_NFS_V3 */ |
1743 | 1744 | ||
1744 | s = ERR_PTR(-ENOMEM); | 1745 | error = -ENOMEM; |
1745 | server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); | 1746 | server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); |
1746 | if (!server) | 1747 | if (!server) |
1747 | goto out_err; | 1748 | goto out_err_noserver; |
1748 | /* Zero out the NFS state stuff */ | 1749 | /* Zero out the NFS state stuff */ |
1749 | init_nfsv4_state(server); | 1750 | init_nfsv4_state(server); |
1750 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); | 1751 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); |
@@ -1754,7 +1755,7 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | |||
1754 | root->size = data->root.size; | 1755 | root->size = data->root.size; |
1755 | else | 1756 | else |
1756 | root->size = NFS2_FHSIZE; | 1757 | root->size = NFS2_FHSIZE; |
1757 | s = ERR_PTR(-EINVAL); | 1758 | error = -EINVAL; |
1758 | if (root->size > sizeof(root->data)) { | 1759 | if (root->size > sizeof(root->data)) { |
1759 | dprintk("%s: invalid root filehandle\n", __FUNCTION__); | 1760 | dprintk("%s: invalid root filehandle\n", __FUNCTION__); |
1760 | goto out_err; | 1761 | goto out_err; |
@@ -1770,15 +1771,20 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | |||
1770 | } | 1771 | } |
1771 | 1772 | ||
1772 | /* Fire up rpciod if not yet running */ | 1773 | /* Fire up rpciod if not yet running */ |
1773 | s = ERR_PTR(rpciod_up()); | 1774 | error = rpciod_up(); |
1774 | if (IS_ERR(s)) { | 1775 | if (error < 0) { |
1775 | dprintk("%s: couldn't start rpciod! Error = %ld\n", | 1776 | dprintk("%s: couldn't start rpciod! Error = %d\n", |
1776 | __FUNCTION__, PTR_ERR(s)); | 1777 | __FUNCTION__, error); |
1777 | goto out_err; | 1778 | goto out_err; |
1778 | } | 1779 | } |
1779 | 1780 | ||
1780 | s = sget(fs_type, nfs_compare_super, nfs_set_super, server); | 1781 | s = sget(fs_type, nfs_compare_super, nfs_set_super, server); |
1781 | if (IS_ERR(s) || s->s_root) | 1782 | if (IS_ERR(s)) { |
1783 | error = PTR_ERR(s); | ||
1784 | goto out_err_rpciod; | ||
1785 | } | ||
1786 | |||
1787 | if (s->s_root) | ||
1782 | goto out_rpciod_down; | 1788 | goto out_rpciod_down; |
1783 | 1789 | ||
1784 | s->s_flags = flags; | 1790 | s->s_flags = flags; |
@@ -1787,15 +1793,22 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | |||
1787 | if (error) { | 1793 | if (error) { |
1788 | up_write(&s->s_umount); | 1794 | up_write(&s->s_umount); |
1789 | deactivate_super(s); | 1795 | deactivate_super(s); |
1790 | return ERR_PTR(error); | 1796 | return error; |
1791 | } | 1797 | } |
1792 | s->s_flags |= MS_ACTIVE; | 1798 | s->s_flags |= MS_ACTIVE; |
1793 | return s; | 1799 | return simple_set_mnt(mnt, s); |
1800 | |||
1794 | out_rpciod_down: | 1801 | out_rpciod_down: |
1795 | rpciod_down(); | 1802 | rpciod_down(); |
1803 | kfree(server); | ||
1804 | return simple_set_mnt(mnt, s); | ||
1805 | |||
1806 | out_err_rpciod: | ||
1807 | rpciod_down(); | ||
1796 | out_err: | 1808 | out_err: |
1797 | kfree(server); | 1809 | kfree(server); |
1798 | return s; | 1810 | out_err_noserver: |
1811 | return error; | ||
1799 | } | 1812 | } |
1800 | 1813 | ||
1801 | static void nfs_kill_super(struct super_block *s) | 1814 | static void nfs_kill_super(struct super_block *s) |
@@ -2032,8 +2045,8 @@ nfs_copy_user_string(char *dst, struct nfs_string *src, int maxlen) | |||
2032 | return dst; | 2045 | return dst; |
2033 | } | 2046 | } |
2034 | 2047 | ||
2035 | static struct super_block *nfs4_get_sb(struct file_system_type *fs_type, | 2048 | static int nfs4_get_sb(struct file_system_type *fs_type, |
2036 | int flags, const char *dev_name, void *raw_data) | 2049 | int flags, const char *dev_name, void *raw_data, struct vfsmount *mnt) |
2037 | { | 2050 | { |
2038 | int error; | 2051 | int error; |
2039 | struct nfs_server *server; | 2052 | struct nfs_server *server; |
@@ -2043,16 +2056,16 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type, | |||
2043 | 2056 | ||
2044 | if (data == NULL) { | 2057 | if (data == NULL) { |
2045 | dprintk("%s: missing data argument\n", __FUNCTION__); | 2058 | dprintk("%s: missing data argument\n", __FUNCTION__); |
2046 | return ERR_PTR(-EINVAL); | 2059 | return -EINVAL; |
2047 | } | 2060 | } |
2048 | if (data->version <= 0 || data->version > NFS4_MOUNT_VERSION) { | 2061 | if (data->version <= 0 || data->version > NFS4_MOUNT_VERSION) { |
2049 | dprintk("%s: bad mount version\n", __FUNCTION__); | 2062 | dprintk("%s: bad mount version\n", __FUNCTION__); |
2050 | return ERR_PTR(-EINVAL); | 2063 | return -EINVAL; |
2051 | } | 2064 | } |
2052 | 2065 | ||
2053 | server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); | 2066 | server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); |
2054 | if (!server) | 2067 | if (!server) |
2055 | return ERR_PTR(-ENOMEM); | 2068 | return -ENOMEM; |
2056 | /* Zero out the NFS state stuff */ | 2069 | /* Zero out the NFS state stuff */ |
2057 | init_nfsv4_state(server); | 2070 | init_nfsv4_state(server); |
2058 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); | 2071 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); |
@@ -2074,33 +2087,41 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type, | |||
2074 | 2087 | ||
2075 | /* We now require that the mount process passes the remote address */ | 2088 | /* We now require that the mount process passes the remote address */ |
2076 | if (data->host_addrlen != sizeof(server->addr)) { | 2089 | if (data->host_addrlen != sizeof(server->addr)) { |
2077 | s = ERR_PTR(-EINVAL); | 2090 | error = -EINVAL; |
2078 | goto out_free; | 2091 | goto out_free; |
2079 | } | 2092 | } |
2080 | if (copy_from_user(&server->addr, data->host_addr, sizeof(server->addr))) { | 2093 | if (copy_from_user(&server->addr, data->host_addr, sizeof(server->addr))) { |
2081 | s = ERR_PTR(-EFAULT); | 2094 | error = -EFAULT; |
2082 | goto out_free; | 2095 | goto out_free; |
2083 | } | 2096 | } |
2084 | if (server->addr.sin_family != AF_INET || | 2097 | if (server->addr.sin_family != AF_INET || |
2085 | server->addr.sin_addr.s_addr == INADDR_ANY) { | 2098 | server->addr.sin_addr.s_addr == INADDR_ANY) { |
2086 | dprintk("%s: mount program didn't pass remote IP address!\n", | 2099 | dprintk("%s: mount program didn't pass remote IP address!\n", |
2087 | __FUNCTION__); | 2100 | __FUNCTION__); |
2088 | s = ERR_PTR(-EINVAL); | 2101 | error = -EINVAL; |
2089 | goto out_free; | 2102 | goto out_free; |
2090 | } | 2103 | } |
2091 | 2104 | ||
2092 | /* Fire up rpciod if not yet running */ | 2105 | /* Fire up rpciod if not yet running */ |
2093 | s = ERR_PTR(rpciod_up()); | 2106 | error = rpciod_up(); |
2094 | if (IS_ERR(s)) { | 2107 | if (error < 0) { |
2095 | dprintk("%s: couldn't start rpciod! Error = %ld\n", | 2108 | dprintk("%s: couldn't start rpciod! Error = %d\n", |
2096 | __FUNCTION__, PTR_ERR(s)); | 2109 | __FUNCTION__, error); |
2097 | goto out_free; | 2110 | goto out_free; |
2098 | } | 2111 | } |
2099 | 2112 | ||
2100 | s = sget(fs_type, nfs4_compare_super, nfs_set_super, server); | 2113 | s = sget(fs_type, nfs4_compare_super, nfs_set_super, server); |
2101 | 2114 | if (IS_ERR(s)) { | |
2102 | if (IS_ERR(s) || s->s_root) | 2115 | error = PTR_ERR(s); |
2103 | goto out_free; | 2116 | goto out_free; |
2117 | } | ||
2118 | |||
2119 | if (s->s_root) { | ||
2120 | kfree(server->mnt_path); | ||
2121 | kfree(server->hostname); | ||
2122 | kfree(server); | ||
2123 | return simple_set_mnt(mnt, s); | ||
2124 | } | ||
2104 | 2125 | ||
2105 | s->s_flags = flags; | 2126 | s->s_flags = flags; |
2106 | 2127 | ||
@@ -2108,17 +2129,17 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type, | |||
2108 | if (error) { | 2129 | if (error) { |
2109 | up_write(&s->s_umount); | 2130 | up_write(&s->s_umount); |
2110 | deactivate_super(s); | 2131 | deactivate_super(s); |
2111 | return ERR_PTR(error); | 2132 | return error; |
2112 | } | 2133 | } |
2113 | s->s_flags |= MS_ACTIVE; | 2134 | s->s_flags |= MS_ACTIVE; |
2114 | return s; | 2135 | return simple_set_mnt(mnt, s); |
2115 | out_err: | 2136 | out_err: |
2116 | s = (struct super_block *)p; | 2137 | error = PTR_ERR(p); |
2117 | out_free: | 2138 | out_free: |
2118 | kfree(server->mnt_path); | 2139 | kfree(server->mnt_path); |
2119 | kfree(server->hostname); | 2140 | kfree(server->hostname); |
2120 | kfree(server); | 2141 | kfree(server); |
2121 | return s; | 2142 | return error; |
2122 | } | 2143 | } |
2123 | 2144 | ||
2124 | static void nfs4_kill_super(struct super_block *sb) | 2145 | static void nfs4_kill_super(struct super_block *sb) |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index de3998f15f10..5446a0861d1d 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1310,7 +1310,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
1310 | if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || | 1310 | if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || |
1311 | (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | | 1311 | (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | |
1312 | FATTR4_WORD1_SPACE_TOTAL))) { | 1312 | FATTR4_WORD1_SPACE_TOTAL))) { |
1313 | status = vfs_statfs(dentry->d_inode->i_sb, &statfs); | 1313 | status = vfs_statfs(dentry, &statfs); |
1314 | if (status) | 1314 | if (status) |
1315 | goto out_nfserr; | 1315 | goto out_nfserr; |
1316 | } | 1316 | } |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 3ef017b3b5bd..a1810e6a93e5 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -494,10 +494,10 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) | |||
494 | return simple_fill_super(sb, 0x6e667364, nfsd_files); | 494 | return simple_fill_super(sb, 0x6e667364, nfsd_files); |
495 | } | 495 | } |
496 | 496 | ||
497 | static struct super_block *nfsd_get_sb(struct file_system_type *fs_type, | 497 | static int nfsd_get_sb(struct file_system_type *fs_type, |
498 | int flags, const char *dev_name, void *data) | 498 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
499 | { | 499 | { |
500 | return get_sb_single(fs_type, flags, data, nfsd_fill_super); | 500 | return get_sb_single(fs_type, flags, data, nfsd_fill_super, mnt); |
501 | } | 501 | } |
502 | 502 | ||
503 | static struct file_system_type nfsd_fs_type = { | 503 | static struct file_system_type nfsd_fs_type = { |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 1d65f13f458c..245eaa1fb59b 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1737,7 +1737,7 @@ int | |||
1737 | nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) | 1737 | nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) |
1738 | { | 1738 | { |
1739 | int err = fh_verify(rqstp, fhp, 0, MAY_NOP); | 1739 | int err = fh_verify(rqstp, fhp, 0, MAY_NOP); |
1740 | if (!err && vfs_statfs(fhp->fh_dentry->d_inode->i_sb,stat)) | 1740 | if (!err && vfs_statfs(fhp->fh_dentry,stat)) |
1741 | err = nfserr_io; | 1741 | err = nfserr_io; |
1742 | return err; | 1742 | return err; |
1743 | } | 1743 | } |
diff --git a/fs/ntfs/aops.h b/fs/ntfs/aops.h index 3b74e66ca2ff..325ce261a107 100644 --- a/fs/ntfs/aops.h +++ b/fs/ntfs/aops.h | |||
@@ -86,8 +86,7 @@ static inline void ntfs_unmap_page(struct page *page) | |||
86 | static inline struct page *ntfs_map_page(struct address_space *mapping, | 86 | static inline struct page *ntfs_map_page(struct address_space *mapping, |
87 | unsigned long index) | 87 | unsigned long index) |
88 | { | 88 | { |
89 | struct page *page = read_cache_page(mapping, index, | 89 | struct page *page = read_mapping_page(mapping, index, NULL); |
90 | (filler_t*)mapping->a_ops->readpage, NULL); | ||
91 | 90 | ||
92 | if (!IS_ERR(page)) { | 91 | if (!IS_ERR(page)) { |
93 | wait_on_page_locked(page); | 92 | wait_on_page_locked(page); |
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index 1663f5c3c6aa..6708e1d68a9e 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c | |||
@@ -2529,8 +2529,7 @@ int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt, const u8 val) | |||
2529 | end >>= PAGE_CACHE_SHIFT; | 2529 | end >>= PAGE_CACHE_SHIFT; |
2530 | /* If there is a first partial page, need to do it the slow way. */ | 2530 | /* If there is a first partial page, need to do it the slow way. */ |
2531 | if (start_ofs) { | 2531 | if (start_ofs) { |
2532 | page = read_cache_page(mapping, idx, | 2532 | page = read_mapping_page(mapping, idx, NULL); |
2533 | (filler_t*)mapping->a_ops->readpage, NULL); | ||
2534 | if (IS_ERR(page)) { | 2533 | if (IS_ERR(page)) { |
2535 | ntfs_error(vol->sb, "Failed to read first partial " | 2534 | ntfs_error(vol->sb, "Failed to read first partial " |
2536 | "page (sync error, index 0x%lx).", idx); | 2535 | "page (sync error, index 0x%lx).", idx); |
@@ -2600,8 +2599,7 @@ int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt, const u8 val) | |||
2600 | } | 2599 | } |
2601 | /* If there is a last partial page, need to do it the slow way. */ | 2600 | /* If there is a last partial page, need to do it the slow way. */ |
2602 | if (end_ofs) { | 2601 | if (end_ofs) { |
2603 | page = read_cache_page(mapping, idx, | 2602 | page = read_mapping_page(mapping, idx, NULL); |
2604 | (filler_t*)mapping->a_ops->readpage, NULL); | ||
2605 | if (IS_ERR(page)) { | 2603 | if (IS_ERR(page)) { |
2606 | ntfs_error(vol->sb, "Failed to read last partial page " | 2604 | ntfs_error(vol->sb, "Failed to read last partial page " |
2607 | "(sync error, index 0x%lx).", idx); | 2605 | "(sync error, index 0x%lx).", idx); |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 36e1e136bb0c..88292f9e4b9b 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -231,8 +231,7 @@ do_non_resident_extend: | |||
231 | * Read the page. If the page is not present, this will zero | 231 | * Read the page. If the page is not present, this will zero |
232 | * the uninitialized regions for us. | 232 | * the uninitialized regions for us. |
233 | */ | 233 | */ |
234 | page = read_cache_page(mapping, index, | 234 | page = read_mapping_page(mapping, index, NULL); |
235 | (filler_t*)mapping->a_ops->readpage, NULL); | ||
236 | if (IS_ERR(page)) { | 235 | if (IS_ERR(page)) { |
237 | err = PTR_ERR(page); | 236 | err = PTR_ERR(page); |
238 | goto init_err_out; | 237 | goto init_err_out; |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 27833f6df49f..0e14acea3f8b 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -2601,10 +2601,10 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol, | |||
2601 | 2601 | ||
2602 | /** | 2602 | /** |
2603 | * ntfs_statfs - return information about mounted NTFS volume | 2603 | * ntfs_statfs - return information about mounted NTFS volume |
2604 | * @sb: super block of mounted volume | 2604 | * @dentry: dentry from mounted volume |
2605 | * @sfs: statfs structure in which to return the information | 2605 | * @sfs: statfs structure in which to return the information |
2606 | * | 2606 | * |
2607 | * Return information about the mounted NTFS volume @sb in the statfs structure | 2607 | * Return information about the mounted NTFS volume @dentry in the statfs structure |
2608 | * pointed to by @sfs (this is initialized with zeros before ntfs_statfs is | 2608 | * pointed to by @sfs (this is initialized with zeros before ntfs_statfs is |
2609 | * called). We interpret the values to be correct of the moment in time at | 2609 | * called). We interpret the values to be correct of the moment in time at |
2610 | * which we are called. Most values are variable otherwise and this isn't just | 2610 | * which we are called. Most values are variable otherwise and this isn't just |
@@ -2617,8 +2617,9 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol, | |||
2617 | * | 2617 | * |
2618 | * Return 0 on success or -errno on error. | 2618 | * Return 0 on success or -errno on error. |
2619 | */ | 2619 | */ |
2620 | static int ntfs_statfs(struct super_block *sb, struct kstatfs *sfs) | 2620 | static int ntfs_statfs(struct dentry *dentry, struct kstatfs *sfs) |
2621 | { | 2621 | { |
2622 | struct super_block *sb = dentry->d_sb; | ||
2622 | s64 size; | 2623 | s64 size; |
2623 | ntfs_volume *vol = NTFS_SB(sb); | 2624 | ntfs_volume *vol = NTFS_SB(sb); |
2624 | ntfs_inode *mft_ni = NTFS_I(vol->mft_ino); | 2625 | ntfs_inode *mft_ni = NTFS_I(vol->mft_ino); |
@@ -3093,10 +3094,11 @@ struct kmem_cache *ntfs_index_ctx_cache; | |||
3093 | /* Driver wide mutex. */ | 3094 | /* Driver wide mutex. */ |
3094 | DEFINE_MUTEX(ntfs_lock); | 3095 | DEFINE_MUTEX(ntfs_lock); |
3095 | 3096 | ||
3096 | static struct super_block *ntfs_get_sb(struct file_system_type *fs_type, | 3097 | static int ntfs_get_sb(struct file_system_type *fs_type, |
3097 | int flags, const char *dev_name, void *data) | 3098 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
3098 | { | 3099 | { |
3099 | return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super); | 3100 | return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super, |
3101 | mnt); | ||
3100 | } | 3102 | } |
3101 | 3103 | ||
3102 | static struct file_system_type ntfs_fs_type = { | 3104 | static struct file_system_type ntfs_fs_type = { |
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 7e88e24b3471..7273d9fa6bab 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c | |||
@@ -574,10 +574,10 @@ static struct inode_operations dlmfs_file_inode_operations = { | |||
574 | .getattr = simple_getattr, | 574 | .getattr = simple_getattr, |
575 | }; | 575 | }; |
576 | 576 | ||
577 | static struct super_block *dlmfs_get_sb(struct file_system_type *fs_type, | 577 | static int dlmfs_get_sb(struct file_system_type *fs_type, |
578 | int flags, const char *dev_name, void *data) | 578 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
579 | { | 579 | { |
580 | return get_sb_nodev(fs_type, flags, data, dlmfs_fill_super); | 580 | return get_sb_nodev(fs_type, flags, data, dlmfs_fill_super, mnt); |
581 | } | 581 | } |
582 | 582 | ||
583 | static struct file_system_type dlmfs_fs_type = { | 583 | static struct file_system_type dlmfs_fs_type = { |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 949b3dac30f1..cdf73393f094 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -100,7 +100,7 @@ static int ocfs2_initialize_mem_caches(void); | |||
100 | static void ocfs2_free_mem_caches(void); | 100 | static void ocfs2_free_mem_caches(void); |
101 | static void ocfs2_delete_osb(struct ocfs2_super *osb); | 101 | static void ocfs2_delete_osb(struct ocfs2_super *osb); |
102 | 102 | ||
103 | static int ocfs2_statfs(struct super_block *sb, struct kstatfs *buf); | 103 | static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf); |
104 | 104 | ||
105 | static int ocfs2_sync_fs(struct super_block *sb, int wait); | 105 | static int ocfs2_sync_fs(struct super_block *sb, int wait); |
106 | 106 | ||
@@ -672,12 +672,14 @@ read_super_error: | |||
672 | return status; | 672 | return status; |
673 | } | 673 | } |
674 | 674 | ||
675 | static struct super_block *ocfs2_get_sb(struct file_system_type *fs_type, | 675 | static int ocfs2_get_sb(struct file_system_type *fs_type, |
676 | int flags, | 676 | int flags, |
677 | const char *dev_name, | 677 | const char *dev_name, |
678 | void *data) | 678 | void *data, |
679 | struct vfsmount *mnt) | ||
679 | { | 680 | { |
680 | return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super); | 681 | return get_sb_bdev(fs_type, flags, dev_name, data, ocfs2_fill_super, |
682 | mnt); | ||
681 | } | 683 | } |
682 | 684 | ||
683 | static struct file_system_type ocfs2_fs_type = { | 685 | static struct file_system_type ocfs2_fs_type = { |
@@ -855,7 +857,7 @@ static void ocfs2_put_super(struct super_block *sb) | |||
855 | mlog_exit_void(); | 857 | mlog_exit_void(); |
856 | } | 858 | } |
857 | 859 | ||
858 | static int ocfs2_statfs(struct super_block *sb, struct kstatfs *buf) | 860 | static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf) |
859 | { | 861 | { |
860 | struct ocfs2_super *osb; | 862 | struct ocfs2_super *osb; |
861 | u32 numbits, freebits; | 863 | u32 numbits, freebits; |
@@ -864,9 +866,9 @@ static int ocfs2_statfs(struct super_block *sb, struct kstatfs *buf) | |||
864 | struct buffer_head *bh = NULL; | 866 | struct buffer_head *bh = NULL; |
865 | struct inode *inode = NULL; | 867 | struct inode *inode = NULL; |
866 | 868 | ||
867 | mlog_entry("(%p, %p)\n", sb, buf); | 869 | mlog_entry("(%p, %p)\n", dentry->d_sb, buf); |
868 | 870 | ||
869 | osb = OCFS2_SB(sb); | 871 | osb = OCFS2_SB(dentry->d_sb); |
870 | 872 | ||
871 | inode = ocfs2_get_system_file_inode(osb, | 873 | inode = ocfs2_get_system_file_inode(osb, |
872 | GLOBAL_BITMAP_SYSTEM_INODE, | 874 | GLOBAL_BITMAP_SYSTEM_INODE, |
@@ -889,7 +891,7 @@ static int ocfs2_statfs(struct super_block *sb, struct kstatfs *buf) | |||
889 | freebits = numbits - le32_to_cpu(bm_lock->id1.bitmap1.i_used); | 891 | freebits = numbits - le32_to_cpu(bm_lock->id1.bitmap1.i_used); |
890 | 892 | ||
891 | buf->f_type = OCFS2_SUPER_MAGIC; | 893 | buf->f_type = OCFS2_SUPER_MAGIC; |
892 | buf->f_bsize = sb->s_blocksize; | 894 | buf->f_bsize = dentry->d_sb->s_blocksize; |
893 | buf->f_namelen = OCFS2_MAX_FILENAME_LEN; | 895 | buf->f_namelen = OCFS2_MAX_FILENAME_LEN; |
894 | buf->f_blocks = ((sector_t) numbits) * | 896 | buf->f_blocks = ((sector_t) numbits) * |
895 | (osb->s_clustersize >> osb->sb->s_blocksize_bits); | 897 | (osb->s_clustersize >> osb->sb->s_blocksize_bits); |
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index f6986bd79e75..0c8a1294ec96 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c | |||
@@ -64,8 +64,7 @@ static char *ocfs2_page_getlink(struct dentry * dentry, | |||
64 | { | 64 | { |
65 | struct page * page; | 65 | struct page * page; |
66 | struct address_space *mapping = dentry->d_inode->i_mapping; | 66 | struct address_space *mapping = dentry->d_inode->i_mapping; |
67 | page = read_cache_page(mapping, 0, | 67 | page = read_mapping_page(mapping, 0, NULL); |
68 | (filler_t *)mapping->a_ops->readpage, NULL); | ||
69 | if (IS_ERR(page)) | 68 | if (IS_ERR(page)) |
70 | goto sync_fail; | 69 | goto sync_fail; |
71 | wait_on_page_locked(page); | 70 | wait_on_page_locked(page); |
@@ -31,18 +31,18 @@ | |||
31 | 31 | ||
32 | #include <asm/unistd.h> | 32 | #include <asm/unistd.h> |
33 | 33 | ||
34 | int vfs_statfs(struct super_block *sb, struct kstatfs *buf) | 34 | int vfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
35 | { | 35 | { |
36 | int retval = -ENODEV; | 36 | int retval = -ENODEV; |
37 | 37 | ||
38 | if (sb) { | 38 | if (dentry) { |
39 | retval = -ENOSYS; | 39 | retval = -ENOSYS; |
40 | if (sb->s_op->statfs) { | 40 | if (dentry->d_sb->s_op->statfs) { |
41 | memset(buf, 0, sizeof(*buf)); | 41 | memset(buf, 0, sizeof(*buf)); |
42 | retval = security_sb_statfs(sb); | 42 | retval = security_sb_statfs(dentry); |
43 | if (retval) | 43 | if (retval) |
44 | return retval; | 44 | return retval; |
45 | retval = sb->s_op->statfs(sb, buf); | 45 | retval = dentry->d_sb->s_op->statfs(dentry, buf); |
46 | if (retval == 0 && buf->f_frsize == 0) | 46 | if (retval == 0 && buf->f_frsize == 0) |
47 | buf->f_frsize = buf->f_bsize; | 47 | buf->f_frsize = buf->f_bsize; |
48 | } | 48 | } |
@@ -52,12 +52,12 @@ int vfs_statfs(struct super_block *sb, struct kstatfs *buf) | |||
52 | 52 | ||
53 | EXPORT_SYMBOL(vfs_statfs); | 53 | EXPORT_SYMBOL(vfs_statfs); |
54 | 54 | ||
55 | static int vfs_statfs_native(struct super_block *sb, struct statfs *buf) | 55 | static int vfs_statfs_native(struct dentry *dentry, struct statfs *buf) |
56 | { | 56 | { |
57 | struct kstatfs st; | 57 | struct kstatfs st; |
58 | int retval; | 58 | int retval; |
59 | 59 | ||
60 | retval = vfs_statfs(sb, &st); | 60 | retval = vfs_statfs(dentry, &st); |
61 | if (retval) | 61 | if (retval) |
62 | return retval; | 62 | return retval; |
63 | 63 | ||
@@ -95,12 +95,12 @@ static int vfs_statfs_native(struct super_block *sb, struct statfs *buf) | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | static int vfs_statfs64(struct super_block *sb, struct statfs64 *buf) | 98 | static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf) |
99 | { | 99 | { |
100 | struct kstatfs st; | 100 | struct kstatfs st; |
101 | int retval; | 101 | int retval; |
102 | 102 | ||
103 | retval = vfs_statfs(sb, &st); | 103 | retval = vfs_statfs(dentry, &st); |
104 | if (retval) | 104 | if (retval) |
105 | return retval; | 105 | return retval; |
106 | 106 | ||
@@ -130,7 +130,7 @@ asmlinkage long sys_statfs(const char __user * path, struct statfs __user * buf) | |||
130 | error = user_path_walk(path, &nd); | 130 | error = user_path_walk(path, &nd); |
131 | if (!error) { | 131 | if (!error) { |
132 | struct statfs tmp; | 132 | struct statfs tmp; |
133 | error = vfs_statfs_native(nd.dentry->d_inode->i_sb, &tmp); | 133 | error = vfs_statfs_native(nd.dentry, &tmp); |
134 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 134 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
135 | error = -EFAULT; | 135 | error = -EFAULT; |
136 | path_release(&nd); | 136 | path_release(&nd); |
@@ -149,7 +149,7 @@ asmlinkage long sys_statfs64(const char __user *path, size_t sz, struct statfs64 | |||
149 | error = user_path_walk(path, &nd); | 149 | error = user_path_walk(path, &nd); |
150 | if (!error) { | 150 | if (!error) { |
151 | struct statfs64 tmp; | 151 | struct statfs64 tmp; |
152 | error = vfs_statfs64(nd.dentry->d_inode->i_sb, &tmp); | 152 | error = vfs_statfs64(nd.dentry, &tmp); |
153 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 153 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
154 | error = -EFAULT; | 154 | error = -EFAULT; |
155 | path_release(&nd); | 155 | path_release(&nd); |
@@ -168,7 +168,7 @@ asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf) | |||
168 | file = fget(fd); | 168 | file = fget(fd); |
169 | if (!file) | 169 | if (!file) |
170 | goto out; | 170 | goto out; |
171 | error = vfs_statfs_native(file->f_dentry->d_inode->i_sb, &tmp); | 171 | error = vfs_statfs_native(file->f_dentry, &tmp); |
172 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 172 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
173 | error = -EFAULT; | 173 | error = -EFAULT; |
174 | fput(file); | 174 | fput(file); |
@@ -189,7 +189,7 @@ asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user | |||
189 | file = fget(fd); | 189 | file = fget(fd); |
190 | if (!file) | 190 | if (!file) |
191 | goto out; | 191 | goto out; |
192 | error = vfs_statfs64(file->f_dentry->d_inode->i_sb, &tmp); | 192 | error = vfs_statfs64(file->f_dentry, &tmp); |
193 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | 193 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) |
194 | error = -EFAULT; | 194 | error = -EFAULT; |
195 | fput(file); | 195 | fput(file); |
@@ -1152,7 +1152,7 @@ int filp_close(struct file *filp, fl_owner_t id) | |||
1152 | } | 1152 | } |
1153 | 1153 | ||
1154 | if (filp->f_op && filp->f_op->flush) | 1154 | if (filp->f_op && filp->f_op->flush) |
1155 | retval = filp->f_op->flush(filp); | 1155 | retval = filp->f_op->flush(filp, id); |
1156 | 1156 | ||
1157 | dnotify_flush(filp, id); | 1157 | dnotify_flush(filp, id); |
1158 | locks_remove_posix(filp, id); | 1158 | locks_remove_posix(filp, id); |
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c index 0f14276a2e51..464e2bce0203 100644 --- a/fs/openpromfs/inode.c +++ b/fs/openpromfs/inode.c | |||
@@ -1054,10 +1054,10 @@ out_no_root: | |||
1054 | return -ENOMEM; | 1054 | return -ENOMEM; |
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | static struct super_block *openprom_get_sb(struct file_system_type *fs_type, | 1057 | static int openprom_get_sb(struct file_system_type *fs_type, |
1058 | int flags, const char *dev_name, void *data) | 1058 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
1059 | { | 1059 | { |
1060 | return get_sb_single(fs_type, flags, data, openprom_fill_super); | 1060 | return get_sb_single(fs_type, flags, data, openprom_fill_super, mnt); |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | static struct file_system_type openprom_fs_type = { | 1063 | static struct file_system_type openprom_fs_type = { |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 8851b81e7c5a..2ef313a96b66 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -484,6 +484,10 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) | |||
484 | sector_t from = state->parts[p].from; | 484 | sector_t from = state->parts[p].from; |
485 | if (!size) | 485 | if (!size) |
486 | continue; | 486 | continue; |
487 | if (from + size > get_capacity(disk)) { | ||
488 | printk(" %s: p%d exceeds device capacity\n", | ||
489 | disk->disk_name, p); | ||
490 | } | ||
487 | add_partition(disk, p, from, size); | 491 | add_partition(disk, p, from, size); |
488 | #ifdef CONFIG_BLK_DEV_MD | 492 | #ifdef CONFIG_BLK_DEV_MD |
489 | if (state->parts[p].flags) | 493 | if (state->parts[p].flags) |
@@ -499,8 +503,8 @@ unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) | |||
499 | struct address_space *mapping = bdev->bd_inode->i_mapping; | 503 | struct address_space *mapping = bdev->bd_inode->i_mapping; |
500 | struct page *page; | 504 | struct page *page; |
501 | 505 | ||
502 | page = read_cache_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), | 506 | page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), |
503 | (filler_t *)mapping->a_ops->readpage, NULL); | 507 | NULL); |
504 | if (!IS_ERR(page)) { | 508 | if (!IS_ERR(page)) { |
505 | wait_on_page_locked(page); | 509 | wait_on_page_locked(page); |
506 | if (!PageUptodate(page)) | 510 | if (!PageUptodate(page)) |
@@ -979,12 +979,11 @@ no_files: | |||
979 | * any operations on the root directory. However, we need a non-trivial | 979 | * any operations on the root directory. However, we need a non-trivial |
980 | * d_name - pipe: will go nicely and kill the special-casing in procfs. | 980 | * d_name - pipe: will go nicely and kill the special-casing in procfs. |
981 | */ | 981 | */ |
982 | 982 | static int pipefs_get_sb(struct file_system_type *fs_type, | |
983 | static struct super_block * | 983 | int flags, const char *dev_name, void *data, |
984 | pipefs_get_sb(struct file_system_type *fs_type, int flags, | 984 | struct vfsmount *mnt) |
985 | const char *dev_name, void *data) | ||
986 | { | 985 | { |
987 | return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC); | 986 | return get_sb_pseudo(fs_type, "pipe:", NULL, PIPEFS_MAGIC, mnt); |
988 | } | 987 | } |
989 | 988 | ||
990 | static struct file_system_type pipe_fs_type = { | 989 | static struct file_system_type pipe_fs_type = { |
diff --git a/fs/proc/root.c b/fs/proc/root.c index c3fd3611112f..9995356ce73e 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -26,10 +26,10 @@ struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc | |||
26 | struct proc_dir_entry *proc_sys_root; | 26 | struct proc_dir_entry *proc_sys_root; |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | static struct super_block *proc_get_sb(struct file_system_type *fs_type, | 29 | static int proc_get_sb(struct file_system_type *fs_type, |
30 | int flags, const char *dev_name, void *data) | 30 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
31 | { | 31 | { |
32 | return get_sb_single(fs_type, flags, data, proc_fill_super); | 32 | return get_sb_single(fs_type, flags, data, proc_fill_super, mnt); |
33 | } | 33 | } |
34 | 34 | ||
35 | static struct file_system_type proc_fs_type = { | 35 | static struct file_system_type proc_fs_type = { |
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c index 2ecd46f85e9f..2f24c46f72a1 100644 --- a/fs/qnx4/inode.c +++ b/fs/qnx4/inode.c | |||
@@ -128,7 +128,7 @@ static struct inode *qnx4_alloc_inode(struct super_block *sb); | |||
128 | static void qnx4_destroy_inode(struct inode *inode); | 128 | static void qnx4_destroy_inode(struct inode *inode); |
129 | static void qnx4_read_inode(struct inode *); | 129 | static void qnx4_read_inode(struct inode *); |
130 | static int qnx4_remount(struct super_block *sb, int *flags, char *data); | 130 | static int qnx4_remount(struct super_block *sb, int *flags, char *data); |
131 | static int qnx4_statfs(struct super_block *, struct kstatfs *); | 131 | static int qnx4_statfs(struct dentry *, struct kstatfs *); |
132 | 132 | ||
133 | static struct super_operations qnx4_sops = | 133 | static struct super_operations qnx4_sops = |
134 | { | 134 | { |
@@ -282,8 +282,10 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock ) | |||
282 | return block; | 282 | return block; |
283 | } | 283 | } |
284 | 284 | ||
285 | static int qnx4_statfs(struct super_block *sb, struct kstatfs *buf) | 285 | static int qnx4_statfs(struct dentry *dentry, struct kstatfs *buf) |
286 | { | 286 | { |
287 | struct super_block *sb = dentry->d_sb; | ||
288 | |||
287 | lock_kernel(); | 289 | lock_kernel(); |
288 | 290 | ||
289 | buf->f_type = sb->s_magic; | 291 | buf->f_type = sb->s_magic; |
@@ -561,10 +563,11 @@ static void destroy_inodecache(void) | |||
561 | "qnx4_inode_cache: not all structures were freed\n"); | 563 | "qnx4_inode_cache: not all structures were freed\n"); |
562 | } | 564 | } |
563 | 565 | ||
564 | static struct super_block *qnx4_get_sb(struct file_system_type *fs_type, | 566 | static int qnx4_get_sb(struct file_system_type *fs_type, |
565 | int flags, const char *dev_name, void *data) | 567 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
566 | { | 568 | { |
567 | return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super); | 569 | return get_sb_bdev(fs_type, flags, dev_name, data, qnx4_fill_super, |
570 | mnt); | ||
568 | } | 571 | } |
569 | 572 | ||
570 | static struct file_system_type qnx4_fs_type = { | 573 | static struct file_system_type qnx4_fs_type = { |
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index 14bd2246fb6d..b9677335cc8d 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c | |||
@@ -185,16 +185,17 @@ static int ramfs_fill_super(struct super_block * sb, void * data, int silent) | |||
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | struct super_block *ramfs_get_sb(struct file_system_type *fs_type, | 188 | int ramfs_get_sb(struct file_system_type *fs_type, |
189 | int flags, const char *dev_name, void *data) | 189 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
190 | { | 190 | { |
191 | return get_sb_nodev(fs_type, flags, data, ramfs_fill_super); | 191 | return get_sb_nodev(fs_type, flags, data, ramfs_fill_super, mnt); |
192 | } | 192 | } |
193 | 193 | ||
194 | static struct super_block *rootfs_get_sb(struct file_system_type *fs_type, | 194 | static int rootfs_get_sb(struct file_system_type *fs_type, |
195 | int flags, const char *dev_name, void *data) | 195 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
196 | { | 196 | { |
197 | return get_sb_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super); | 197 | return get_sb_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super, |
198 | mnt); | ||
198 | } | 199 | } |
199 | 200 | ||
200 | static struct file_system_type ramfs_fs_type = { | 201 | static struct file_system_type ramfs_fs_type = { |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index cae2abbc0c71..00f1321e9209 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -60,7 +60,7 @@ static int is_any_reiserfs_magic_string(struct reiserfs_super_block *rs) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | static int reiserfs_remount(struct super_block *s, int *flags, char *data); | 62 | static int reiserfs_remount(struct super_block *s, int *flags, char *data); |
63 | static int reiserfs_statfs(struct super_block *s, struct kstatfs *buf); | 63 | static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf); |
64 | 64 | ||
65 | static int reiserfs_sync_fs(struct super_block *s, int wait) | 65 | static int reiserfs_sync_fs(struct super_block *s, int wait) |
66 | { | 66 | { |
@@ -1938,15 +1938,15 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1938 | return errval; | 1938 | return errval; |
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | static int reiserfs_statfs(struct super_block *s, struct kstatfs *buf) | 1941 | static int reiserfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
1942 | { | 1942 | { |
1943 | struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(s); | 1943 | struct reiserfs_super_block *rs = SB_DISK_SUPER_BLOCK(dentry->d_sb); |
1944 | 1944 | ||
1945 | buf->f_namelen = (REISERFS_MAX_NAME(s->s_blocksize)); | 1945 | buf->f_namelen = (REISERFS_MAX_NAME(s->s_blocksize)); |
1946 | buf->f_bfree = sb_free_blocks(rs); | 1946 | buf->f_bfree = sb_free_blocks(rs); |
1947 | buf->f_bavail = buf->f_bfree; | 1947 | buf->f_bavail = buf->f_bfree; |
1948 | buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1; | 1948 | buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1; |
1949 | buf->f_bsize = s->s_blocksize; | 1949 | buf->f_bsize = dentry->d_sb->s_blocksize; |
1950 | /* changed to accommodate gcc folks. */ | 1950 | /* changed to accommodate gcc folks. */ |
1951 | buf->f_type = REISERFS_SUPER_MAGIC; | 1951 | buf->f_type = REISERFS_SUPER_MAGIC; |
1952 | return 0; | 1952 | return 0; |
@@ -2249,11 +2249,12 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type, | |||
2249 | 2249 | ||
2250 | #endif | 2250 | #endif |
2251 | 2251 | ||
2252 | static struct super_block *get_super_block(struct file_system_type *fs_type, | 2252 | static int get_super_block(struct file_system_type *fs_type, |
2253 | int flags, const char *dev_name, | 2253 | int flags, const char *dev_name, |
2254 | void *data) | 2254 | void *data, struct vfsmount *mnt) |
2255 | { | 2255 | { |
2256 | return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super); | 2256 | return get_sb_bdev(fs_type, flags, dev_name, data, reiserfs_fill_super, |
2257 | mnt); | ||
2257 | } | 2258 | } |
2258 | 2259 | ||
2259 | static int __init init_reiserfs_fs(void) | 2260 | static int __init init_reiserfs_fs(void) |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index ffb79c48c5bf..39fedaa88a0c 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -452,8 +452,7 @@ static struct page *reiserfs_get_page(struct inode *dir, unsigned long n) | |||
452 | /* We can deadlock if we try to free dentries, | 452 | /* We can deadlock if we try to free dentries, |
453 | and an unlink/rmdir has just occured - GFP_NOFS avoids this */ | 453 | and an unlink/rmdir has just occured - GFP_NOFS avoids this */ |
454 | mapping_set_gfp_mask(mapping, GFP_NOFS); | 454 | mapping_set_gfp_mask(mapping, GFP_NOFS); |
455 | page = read_cache_page(mapping, n, | 455 | page = read_mapping_page(mapping, n, NULL); |
456 | (filler_t *) mapping->a_ops->readpage, NULL); | ||
457 | if (!IS_ERR(page)) { | 456 | if (!IS_ERR(page)) { |
458 | wait_on_page_locked(page); | 457 | wait_on_page_locked(page); |
459 | kmap(page); | 458 | kmap(page); |
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c index 9b9eda7b335c..283fbc6b8eea 100644 --- a/fs/romfs/inode.c +++ b/fs/romfs/inode.c | |||
@@ -179,12 +179,12 @@ outnobh: | |||
179 | /* That's simple too. */ | 179 | /* That's simple too. */ |
180 | 180 | ||
181 | static int | 181 | static int |
182 | romfs_statfs(struct super_block *sb, struct kstatfs *buf) | 182 | romfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
183 | { | 183 | { |
184 | buf->f_type = ROMFS_MAGIC; | 184 | buf->f_type = ROMFS_MAGIC; |
185 | buf->f_bsize = ROMBSIZE; | 185 | buf->f_bsize = ROMBSIZE; |
186 | buf->f_bfree = buf->f_bavail = buf->f_ffree; | 186 | buf->f_bfree = buf->f_bavail = buf->f_ffree; |
187 | buf->f_blocks = (romfs_maxsize(sb)+ROMBSIZE-1)>>ROMBSBITS; | 187 | buf->f_blocks = (romfs_maxsize(dentry->d_sb)+ROMBSIZE-1)>>ROMBSBITS; |
188 | buf->f_namelen = ROMFS_MAXFN; | 188 | buf->f_namelen = ROMFS_MAXFN; |
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
@@ -607,10 +607,11 @@ static struct super_operations romfs_ops = { | |||
607 | .remount_fs = romfs_remount, | 607 | .remount_fs = romfs_remount, |
608 | }; | 608 | }; |
609 | 609 | ||
610 | static struct super_block *romfs_get_sb(struct file_system_type *fs_type, | 610 | static int romfs_get_sb(struct file_system_type *fs_type, |
611 | int flags, const char *dev_name, void *data) | 611 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
612 | { | 612 | { |
613 | return get_sb_bdev(fs_type, flags, dev_name, data, romfs_fill_super); | 613 | return get_sb_bdev(fs_type, flags, dev_name, data, romfs_fill_super, |
614 | mnt); | ||
614 | } | 615 | } |
615 | 616 | ||
616 | static struct file_system_type romfs_fs_type = { | 617 | static struct file_system_type romfs_fs_type = { |
diff --git a/fs/select.c b/fs/select.c index a8109baa5e46..9c4f0f2604f1 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -546,37 +546,38 @@ struct poll_list { | |||
546 | 546 | ||
547 | #define POLLFD_PER_PAGE ((PAGE_SIZE-sizeof(struct poll_list)) / sizeof(struct pollfd)) | 547 | #define POLLFD_PER_PAGE ((PAGE_SIZE-sizeof(struct poll_list)) / sizeof(struct pollfd)) |
548 | 548 | ||
549 | static void do_pollfd(unsigned int num, struct pollfd * fdpage, | 549 | /* |
550 | poll_table ** pwait, int *count) | 550 | * Fish for pollable events on the pollfd->fd file descriptor. We're only |
551 | * interested in events matching the pollfd->events mask, and the result | ||
552 | * matching that mask is both recorded in pollfd->revents and returned. The | ||
553 | * pwait poll_table will be used by the fd-provided poll handler for waiting, | ||
554 | * if non-NULL. | ||
555 | */ | ||
556 | static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait) | ||
551 | { | 557 | { |
552 | int i; | 558 | unsigned int mask; |
553 | 559 | int fd; | |
554 | for (i = 0; i < num; i++) { | 560 | |
555 | int fd; | 561 | mask = 0; |
556 | unsigned int mask; | 562 | fd = pollfd->fd; |
557 | struct pollfd *fdp; | 563 | if (fd >= 0) { |
558 | 564 | int fput_needed; | |
559 | mask = 0; | 565 | struct file * file; |
560 | fdp = fdpage+i; | 566 | |
561 | fd = fdp->fd; | 567 | file = fget_light(fd, &fput_needed); |
562 | if (fd >= 0) { | 568 | mask = POLLNVAL; |
563 | int fput_needed; | 569 | if (file != NULL) { |
564 | struct file * file = fget_light(fd, &fput_needed); | 570 | mask = DEFAULT_POLLMASK; |
565 | mask = POLLNVAL; | 571 | if (file->f_op && file->f_op->poll) |
566 | if (file != NULL) { | 572 | mask = file->f_op->poll(file, pwait); |
567 | mask = DEFAULT_POLLMASK; | 573 | /* Mask out unneeded events. */ |
568 | if (file->f_op && file->f_op->poll) | 574 | mask &= pollfd->events | POLLERR | POLLHUP; |
569 | mask = file->f_op->poll(file, *pwait); | 575 | fput_light(file, fput_needed); |
570 | mask &= fdp->events | POLLERR | POLLHUP; | ||
571 | fput_light(file, fput_needed); | ||
572 | } | ||
573 | if (mask) { | ||
574 | *pwait = NULL; | ||
575 | (*count)++; | ||
576 | } | ||
577 | } | 576 | } |
578 | fdp->revents = mask; | ||
579 | } | 577 | } |
578 | pollfd->revents = mask; | ||
579 | |||
580 | return mask; | ||
580 | } | 581 | } |
581 | 582 | ||
582 | static int do_poll(unsigned int nfds, struct poll_list *list, | 583 | static int do_poll(unsigned int nfds, struct poll_list *list, |
@@ -594,11 +595,29 @@ static int do_poll(unsigned int nfds, struct poll_list *list, | |||
594 | long __timeout; | 595 | long __timeout; |
595 | 596 | ||
596 | set_current_state(TASK_INTERRUPTIBLE); | 597 | set_current_state(TASK_INTERRUPTIBLE); |
597 | walk = list; | 598 | for (walk = list; walk != NULL; walk = walk->next) { |
598 | while(walk != NULL) { | 599 | struct pollfd * pfd, * pfd_end; |
599 | do_pollfd( walk->len, walk->entries, &pt, &count); | 600 | |
600 | walk = walk->next; | 601 | pfd = walk->entries; |
602 | pfd_end = pfd + walk->len; | ||
603 | for (; pfd != pfd_end; pfd++) { | ||
604 | /* | ||
605 | * Fish for events. If we found one, record it | ||
606 | * and kill the poll_table, so we don't | ||
607 | * needlessly register any other waiters after | ||
608 | * this. They'll get immediately deregistered | ||
609 | * when we break out and return. | ||
610 | */ | ||
611 | if (do_pollfd(pfd, pt)) { | ||
612 | count++; | ||
613 | pt = NULL; | ||
614 | } | ||
615 | } | ||
601 | } | 616 | } |
617 | /* | ||
618 | * All waiters have already been registered, so don't provide | ||
619 | * a poll_table to them on the next loop iteration. | ||
620 | */ | ||
602 | pt = NULL; | 621 | pt = NULL; |
603 | if (count || !*timeout || signal_pending(current)) | 622 | if (count || !*timeout || signal_pending(current)) |
604 | break; | 623 | break; |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index fdeabc0a34f7..506ff87c1d4b 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | static void smb_delete_inode(struct inode *); | 49 | static void smb_delete_inode(struct inode *); |
50 | static void smb_put_super(struct super_block *); | 50 | static void smb_put_super(struct super_block *); |
51 | static int smb_statfs(struct super_block *, struct kstatfs *); | 51 | static int smb_statfs(struct dentry *, struct kstatfs *); |
52 | static int smb_show_options(struct seq_file *, struct vfsmount *); | 52 | static int smb_show_options(struct seq_file *, struct vfsmount *); |
53 | 53 | ||
54 | static kmem_cache_t *smb_inode_cachep; | 54 | static kmem_cache_t *smb_inode_cachep; |
@@ -641,13 +641,13 @@ out_no_server: | |||
641 | } | 641 | } |
642 | 642 | ||
643 | static int | 643 | static int |
644 | smb_statfs(struct super_block *sb, struct kstatfs *buf) | 644 | smb_statfs(struct dentry *dentry, struct kstatfs *buf) |
645 | { | 645 | { |
646 | int result; | 646 | int result; |
647 | 647 | ||
648 | lock_kernel(); | 648 | lock_kernel(); |
649 | 649 | ||
650 | result = smb_proc_dskattr(sb, buf); | 650 | result = smb_proc_dskattr(dentry, buf); |
651 | 651 | ||
652 | unlock_kernel(); | 652 | unlock_kernel(); |
653 | 653 | ||
@@ -782,10 +782,10 @@ out: | |||
782 | return error; | 782 | return error; |
783 | } | 783 | } |
784 | 784 | ||
785 | static struct super_block *smb_get_sb(struct file_system_type *fs_type, | 785 | static int smb_get_sb(struct file_system_type *fs_type, |
786 | int flags, const char *dev_name, void *data) | 786 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
787 | { | 787 | { |
788 | return get_sb_nodev(fs_type, flags, data, smb_fill_super); | 788 | return get_sb_nodev(fs_type, flags, data, smb_fill_super, mnt); |
789 | } | 789 | } |
790 | 790 | ||
791 | static struct file_system_type smb_fs_type = { | 791 | static struct file_system_type smb_fs_type = { |
diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c index b1b878b81730..c3495059889d 100644 --- a/fs/smbfs/proc.c +++ b/fs/smbfs/proc.c | |||
@@ -3226,9 +3226,9 @@ smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr) | |||
3226 | } | 3226 | } |
3227 | 3227 | ||
3228 | int | 3228 | int |
3229 | smb_proc_dskattr(struct super_block *sb, struct kstatfs *attr) | 3229 | smb_proc_dskattr(struct dentry *dentry, struct kstatfs *attr) |
3230 | { | 3230 | { |
3231 | struct smb_sb_info *server = SMB_SB(sb); | 3231 | struct smb_sb_info *server = SMB_SB(dentry->d_sb); |
3232 | int result; | 3232 | int result; |
3233 | char *p; | 3233 | char *p; |
3234 | long unit; | 3234 | long unit; |
diff --git a/fs/smbfs/proto.h b/fs/smbfs/proto.h index 47664597e6b1..972ed7dad388 100644 --- a/fs/smbfs/proto.h +++ b/fs/smbfs/proto.h | |||
@@ -29,7 +29,7 @@ extern int smb_proc_getattr(struct dentry *dir, struct smb_fattr *fattr); | |||
29 | extern int smb_proc_setattr(struct dentry *dir, struct smb_fattr *fattr); | 29 | extern int smb_proc_setattr(struct dentry *dir, struct smb_fattr *fattr); |
30 | extern int smb_proc_setattr_unix(struct dentry *d, struct iattr *attr, unsigned int major, unsigned int minor); | 30 | extern int smb_proc_setattr_unix(struct dentry *d, struct iattr *attr, unsigned int major, unsigned int minor); |
31 | extern int smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr); | 31 | extern int smb_proc_settime(struct dentry *dentry, struct smb_fattr *fattr); |
32 | extern int smb_proc_dskattr(struct super_block *sb, struct kstatfs *attr); | 32 | extern int smb_proc_dskattr(struct dentry *dentry, struct kstatfs *attr); |
33 | extern int smb_proc_read_link(struct smb_sb_info *server, struct dentry *d, char *buffer, int len); | 33 | extern int smb_proc_read_link(struct smb_sb_info *server, struct dentry *d, char *buffer, int len); |
34 | extern int smb_proc_symlink(struct smb_sb_info *server, struct dentry *d, const char *oldpath); | 34 | extern int smb_proc_symlink(struct smb_sb_info *server, struct dentry *d, const char *oldpath); |
35 | extern int smb_proc_link(struct smb_sb_info *server, struct dentry *dentry, struct dentry *new_dentry); | 35 | extern int smb_proc_link(struct smb_sb_info *server, struct dentry *dentry, struct dentry *new_dentry); |
diff --git a/fs/splice.c b/fs/splice.c index a285fd746dc0..05fd2787be98 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -55,31 +55,43 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe, | |||
55 | struct pipe_buffer *buf) | 55 | struct pipe_buffer *buf) |
56 | { | 56 | { |
57 | struct page *page = buf->page; | 57 | struct page *page = buf->page; |
58 | struct address_space *mapping = page_mapping(page); | 58 | struct address_space *mapping; |
59 | 59 | ||
60 | lock_page(page); | 60 | lock_page(page); |
61 | 61 | ||
62 | WARN_ON(!PageUptodate(page)); | 62 | mapping = page_mapping(page); |
63 | if (mapping) { | ||
64 | WARN_ON(!PageUptodate(page)); | ||
63 | 65 | ||
64 | /* | 66 | /* |
65 | * At least for ext2 with nobh option, we need to wait on writeback | 67 | * At least for ext2 with nobh option, we need to wait on |
66 | * completing on this page, since we'll remove it from the pagecache. | 68 | * writeback completing on this page, since we'll remove it |
67 | * Otherwise truncate wont wait on the page, allowing the disk | 69 | * from the pagecache. Otherwise truncate wont wait on the |
68 | * blocks to be reused by someone else before we actually wrote our | 70 | * page, allowing the disk blocks to be reused by someone else |
69 | * data to them. fs corruption ensues. | 71 | * before we actually wrote our data to them. fs corruption |
70 | */ | 72 | * ensues. |
71 | wait_on_page_writeback(page); | 73 | */ |
74 | wait_on_page_writeback(page); | ||
72 | 75 | ||
73 | if (PagePrivate(page)) | 76 | if (PagePrivate(page)) |
74 | try_to_release_page(page, mapping_gfp_mask(mapping)); | 77 | try_to_release_page(page, mapping_gfp_mask(mapping)); |
75 | 78 | ||
76 | if (!remove_mapping(mapping, page)) { | 79 | /* |
77 | unlock_page(page); | 80 | * If we succeeded in removing the mapping, set LRU flag |
78 | return 1; | 81 | * and return good. |
82 | */ | ||
83 | if (remove_mapping(mapping, page)) { | ||
84 | buf->flags |= PIPE_BUF_FLAG_LRU; | ||
85 | return 0; | ||
86 | } | ||
79 | } | 87 | } |
80 | 88 | ||
81 | buf->flags |= PIPE_BUF_FLAG_LRU; | 89 | /* |
82 | return 0; | 90 | * Raced with truncate or failed to remove page from current |
91 | * address space, unlock and return failure. | ||
92 | */ | ||
93 | unlock_page(page); | ||
94 | return 1; | ||
83 | } | 95 | } |
84 | 96 | ||
85 | static void page_cache_pipe_buf_release(struct pipe_inode_info *pipe, | 97 | static void page_cache_pipe_buf_release(struct pipe_inode_info *pipe, |
diff --git a/fs/super.c b/fs/super.c index 9d5c2add7228..057b5325b7ef 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -231,7 +231,7 @@ void generic_shutdown_super(struct super_block *sb) | |||
231 | if (root) { | 231 | if (root) { |
232 | sb->s_root = NULL; | 232 | sb->s_root = NULL; |
233 | shrink_dcache_parent(root); | 233 | shrink_dcache_parent(root); |
234 | shrink_dcache_anon(sb); | 234 | shrink_dcache_sb(sb); |
235 | dput(root); | 235 | dput(root); |
236 | fsync_super(sb); | 236 | fsync_super(sb); |
237 | lock_super(sb); | 237 | lock_super(sb); |
@@ -486,7 +486,7 @@ asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf) | |||
486 | s = user_get_super(new_decode_dev(dev)); | 486 | s = user_get_super(new_decode_dev(dev)); |
487 | if (s == NULL) | 487 | if (s == NULL) |
488 | goto out; | 488 | goto out; |
489 | err = vfs_statfs(s, &sbuf); | 489 | err = vfs_statfs(s->s_root, &sbuf); |
490 | drop_super(s); | 490 | drop_super(s); |
491 | if (err) | 491 | if (err) |
492 | goto out; | 492 | goto out; |
@@ -676,9 +676,10 @@ static void bdev_uevent(struct block_device *bdev, enum kobject_action action) | |||
676 | } | 676 | } |
677 | } | 677 | } |
678 | 678 | ||
679 | struct super_block *get_sb_bdev(struct file_system_type *fs_type, | 679 | int get_sb_bdev(struct file_system_type *fs_type, |
680 | int flags, const char *dev_name, void *data, | 680 | int flags, const char *dev_name, void *data, |
681 | int (*fill_super)(struct super_block *, void *, int)) | 681 | int (*fill_super)(struct super_block *, void *, int), |
682 | struct vfsmount *mnt) | ||
682 | { | 683 | { |
683 | struct block_device *bdev; | 684 | struct block_device *bdev; |
684 | struct super_block *s; | 685 | struct super_block *s; |
@@ -686,7 +687,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, | |||
686 | 687 | ||
687 | bdev = open_bdev_excl(dev_name, flags, fs_type); | 688 | bdev = open_bdev_excl(dev_name, flags, fs_type); |
688 | if (IS_ERR(bdev)) | 689 | if (IS_ERR(bdev)) |
689 | return (struct super_block *)bdev; | 690 | return PTR_ERR(bdev); |
690 | 691 | ||
691 | /* | 692 | /* |
692 | * once the super is inserted into the list by sget, s_umount | 693 | * once the super is inserted into the list by sget, s_umount |
@@ -697,15 +698,17 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, | |||
697 | s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); | 698 | s = sget(fs_type, test_bdev_super, set_bdev_super, bdev); |
698 | mutex_unlock(&bdev->bd_mount_mutex); | 699 | mutex_unlock(&bdev->bd_mount_mutex); |
699 | if (IS_ERR(s)) | 700 | if (IS_ERR(s)) |
700 | goto out; | 701 | goto error_s; |
701 | 702 | ||
702 | if (s->s_root) { | 703 | if (s->s_root) { |
703 | if ((flags ^ s->s_flags) & MS_RDONLY) { | 704 | if ((flags ^ s->s_flags) & MS_RDONLY) { |
704 | up_write(&s->s_umount); | 705 | up_write(&s->s_umount); |
705 | deactivate_super(s); | 706 | deactivate_super(s); |
706 | s = ERR_PTR(-EBUSY); | 707 | error = -EBUSY; |
708 | goto error_bdev; | ||
707 | } | 709 | } |
708 | goto out; | 710 | |
711 | close_bdev_excl(bdev); | ||
709 | } else { | 712 | } else { |
710 | char b[BDEVNAME_SIZE]; | 713 | char b[BDEVNAME_SIZE]; |
711 | 714 | ||
@@ -716,18 +719,21 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type, | |||
716 | if (error) { | 719 | if (error) { |
717 | up_write(&s->s_umount); | 720 | up_write(&s->s_umount); |
718 | deactivate_super(s); | 721 | deactivate_super(s); |
719 | s = ERR_PTR(error); | 722 | goto error; |
720 | } else { | ||
721 | s->s_flags |= MS_ACTIVE; | ||
722 | bdev_uevent(bdev, KOBJ_MOUNT); | ||
723 | } | 723 | } |
724 | |||
725 | s->s_flags |= MS_ACTIVE; | ||
726 | bdev_uevent(bdev, KOBJ_MOUNT); | ||
724 | } | 727 | } |
725 | 728 | ||
726 | return s; | 729 | return simple_set_mnt(mnt, s); |
727 | 730 | ||
728 | out: | 731 | error_s: |
732 | error = PTR_ERR(s); | ||
733 | error_bdev: | ||
729 | close_bdev_excl(bdev); | 734 | close_bdev_excl(bdev); |
730 | return s; | 735 | error: |
736 | return error; | ||
731 | } | 737 | } |
732 | 738 | ||
733 | EXPORT_SYMBOL(get_sb_bdev); | 739 | EXPORT_SYMBOL(get_sb_bdev); |
@@ -744,15 +750,16 @@ void kill_block_super(struct super_block *sb) | |||
744 | 750 | ||
745 | EXPORT_SYMBOL(kill_block_super); | 751 | EXPORT_SYMBOL(kill_block_super); |
746 | 752 | ||
747 | struct super_block *get_sb_nodev(struct file_system_type *fs_type, | 753 | int get_sb_nodev(struct file_system_type *fs_type, |
748 | int flags, void *data, | 754 | int flags, void *data, |
749 | int (*fill_super)(struct super_block *, void *, int)) | 755 | int (*fill_super)(struct super_block *, void *, int), |
756 | struct vfsmount *mnt) | ||
750 | { | 757 | { |
751 | int error; | 758 | int error; |
752 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); | 759 | struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL); |
753 | 760 | ||
754 | if (IS_ERR(s)) | 761 | if (IS_ERR(s)) |
755 | return s; | 762 | return PTR_ERR(s); |
756 | 763 | ||
757 | s->s_flags = flags; | 764 | s->s_flags = flags; |
758 | 765 | ||
@@ -760,10 +767,10 @@ struct super_block *get_sb_nodev(struct file_system_type *fs_type, | |||
760 | if (error) { | 767 | if (error) { |
761 | up_write(&s->s_umount); | 768 | up_write(&s->s_umount); |
762 | deactivate_super(s); | 769 | deactivate_super(s); |
763 | return ERR_PTR(error); | 770 | return error; |
764 | } | 771 | } |
765 | s->s_flags |= MS_ACTIVE; | 772 | s->s_flags |= MS_ACTIVE; |
766 | return s; | 773 | return simple_set_mnt(mnt, s); |
767 | } | 774 | } |
768 | 775 | ||
769 | EXPORT_SYMBOL(get_sb_nodev); | 776 | EXPORT_SYMBOL(get_sb_nodev); |
@@ -773,94 +780,102 @@ static int compare_single(struct super_block *s, void *p) | |||
773 | return 1; | 780 | return 1; |
774 | } | 781 | } |
775 | 782 | ||
776 | struct super_block *get_sb_single(struct file_system_type *fs_type, | 783 | int get_sb_single(struct file_system_type *fs_type, |
777 | int flags, void *data, | 784 | int flags, void *data, |
778 | int (*fill_super)(struct super_block *, void *, int)) | 785 | int (*fill_super)(struct super_block *, void *, int), |
786 | struct vfsmount *mnt) | ||
779 | { | 787 | { |
780 | struct super_block *s; | 788 | struct super_block *s; |
781 | int error; | 789 | int error; |
782 | 790 | ||
783 | s = sget(fs_type, compare_single, set_anon_super, NULL); | 791 | s = sget(fs_type, compare_single, set_anon_super, NULL); |
784 | if (IS_ERR(s)) | 792 | if (IS_ERR(s)) |
785 | return s; | 793 | return PTR_ERR(s); |
786 | if (!s->s_root) { | 794 | if (!s->s_root) { |
787 | s->s_flags = flags; | 795 | s->s_flags = flags; |
788 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); | 796 | error = fill_super(s, data, flags & MS_SILENT ? 1 : 0); |
789 | if (error) { | 797 | if (error) { |
790 | up_write(&s->s_umount); | 798 | up_write(&s->s_umount); |
791 | deactivate_super(s); | 799 | deactivate_super(s); |
792 | return ERR_PTR(error); | 800 | return error; |
793 | } | 801 | } |
794 | s->s_flags |= MS_ACTIVE; | 802 | s->s_flags |= MS_ACTIVE; |
795 | } | 803 | } |
796 | do_remount_sb(s, flags, data, 0); | 804 | do_remount_sb(s, flags, data, 0); |
797 | return s; | 805 | return simple_set_mnt(mnt, s); |
798 | } | 806 | } |
799 | 807 | ||
800 | EXPORT_SYMBOL(get_sb_single); | 808 | EXPORT_SYMBOL(get_sb_single); |
801 | 809 | ||
802 | struct vfsmount * | 810 | struct vfsmount * |
803 | do_kern_mount(const char *fstype, int flags, const char *name, void *data) | 811 | vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data) |
804 | { | 812 | { |
805 | struct file_system_type *type = get_fs_type(fstype); | ||
806 | struct super_block *sb = ERR_PTR(-ENOMEM); | ||
807 | struct vfsmount *mnt; | 813 | struct vfsmount *mnt; |
808 | int error; | ||
809 | char *secdata = NULL; | 814 | char *secdata = NULL; |
815 | int error; | ||
810 | 816 | ||
811 | if (!type) | 817 | if (!type) |
812 | return ERR_PTR(-ENODEV); | 818 | return ERR_PTR(-ENODEV); |
813 | 819 | ||
820 | error = -ENOMEM; | ||
814 | mnt = alloc_vfsmnt(name); | 821 | mnt = alloc_vfsmnt(name); |
815 | if (!mnt) | 822 | if (!mnt) |
816 | goto out; | 823 | goto out; |
817 | 824 | ||
818 | if (data) { | 825 | if (data) { |
819 | secdata = alloc_secdata(); | 826 | secdata = alloc_secdata(); |
820 | if (!secdata) { | 827 | if (!secdata) |
821 | sb = ERR_PTR(-ENOMEM); | ||
822 | goto out_mnt; | 828 | goto out_mnt; |
823 | } | ||
824 | 829 | ||
825 | error = security_sb_copy_data(type, data, secdata); | 830 | error = security_sb_copy_data(type, data, secdata); |
826 | if (error) { | 831 | if (error) |
827 | sb = ERR_PTR(error); | ||
828 | goto out_free_secdata; | 832 | goto out_free_secdata; |
829 | } | ||
830 | } | 833 | } |
831 | 834 | ||
832 | sb = type->get_sb(type, flags, name, data); | 835 | error = type->get_sb(type, flags, name, data, mnt); |
833 | if (IS_ERR(sb)) | 836 | if (error < 0) |
834 | goto out_free_secdata; | 837 | goto out_free_secdata; |
835 | error = security_sb_kern_mount(sb, secdata); | 838 | |
839 | error = security_sb_kern_mount(mnt->mnt_sb, secdata); | ||
836 | if (error) | 840 | if (error) |
837 | goto out_sb; | 841 | goto out_sb; |
838 | mnt->mnt_sb = sb; | 842 | |
839 | mnt->mnt_root = dget(sb->s_root); | 843 | mnt->mnt_mountpoint = mnt->mnt_root; |
840 | mnt->mnt_mountpoint = sb->s_root; | ||
841 | mnt->mnt_parent = mnt; | 844 | mnt->mnt_parent = mnt; |
842 | up_write(&sb->s_umount); | 845 | up_write(&mnt->mnt_sb->s_umount); |
843 | free_secdata(secdata); | 846 | free_secdata(secdata); |
844 | put_filesystem(type); | ||
845 | return mnt; | 847 | return mnt; |
846 | out_sb: | 848 | out_sb: |
847 | up_write(&sb->s_umount); | 849 | dput(mnt->mnt_root); |
848 | deactivate_super(sb); | 850 | up_write(&mnt->mnt_sb->s_umount); |
849 | sb = ERR_PTR(error); | 851 | deactivate_super(mnt->mnt_sb); |
850 | out_free_secdata: | 852 | out_free_secdata: |
851 | free_secdata(secdata); | 853 | free_secdata(secdata); |
852 | out_mnt: | 854 | out_mnt: |
853 | free_vfsmnt(mnt); | 855 | free_vfsmnt(mnt); |
854 | out: | 856 | out: |
857 | return ERR_PTR(error); | ||
858 | } | ||
859 | |||
860 | EXPORT_SYMBOL_GPL(vfs_kern_mount); | ||
861 | |||
862 | struct vfsmount * | ||
863 | do_kern_mount(const char *fstype, int flags, const char *name, void *data) | ||
864 | { | ||
865 | struct file_system_type *type = get_fs_type(fstype); | ||
866 | struct vfsmount *mnt; | ||
867 | if (!type) | ||
868 | return ERR_PTR(-ENODEV); | ||
869 | mnt = vfs_kern_mount(type, flags, name, data); | ||
855 | put_filesystem(type); | 870 | put_filesystem(type); |
856 | return (struct vfsmount *)sb; | 871 | return mnt; |
857 | } | 872 | } |
858 | 873 | ||
859 | EXPORT_SYMBOL_GPL(do_kern_mount); | 874 | EXPORT_SYMBOL_GPL(do_kern_mount); |
860 | 875 | ||
861 | struct vfsmount *kern_mount(struct file_system_type *type) | 876 | struct vfsmount *kern_mount(struct file_system_type *type) |
862 | { | 877 | { |
863 | return do_kern_mount(type->name, 0, type->name, NULL); | 878 | return vfs_kern_mount(type, 0, type->name, NULL); |
864 | } | 879 | } |
865 | 880 | ||
866 | EXPORT_SYMBOL(kern_mount); | 881 | EXPORT_SYMBOL(kern_mount); |
@@ -100,7 +100,7 @@ asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, | |||
100 | } | 100 | } |
101 | 101 | ||
102 | if (nbytes == 0) | 102 | if (nbytes == 0) |
103 | endbyte = -1; | 103 | endbyte = LLONG_MAX; |
104 | else | 104 | else |
105 | endbyte--; /* inclusive */ | 105 | endbyte--; /* inclusive */ |
106 | 106 | ||
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index f1117e885bd6..40190c489271 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -66,10 +66,10 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | |||
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | static struct super_block *sysfs_get_sb(struct file_system_type *fs_type, | 69 | static int sysfs_get_sb(struct file_system_type *fs_type, |
70 | int flags, const char *dev_name, void *data) | 70 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
71 | { | 71 | { |
72 | return get_sb_single(fs_type, flags, data, sysfs_fill_super); | 72 | return get_sb_single(fs_type, flags, data, sysfs_fill_super, mnt); |
73 | } | 73 | } |
74 | 74 | ||
75 | static struct file_system_type sysfs_fs_type = { | 75 | static struct file_system_type sysfs_fs_type = { |
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index d7074341ee87..f2bef962d309 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c | |||
@@ -53,8 +53,7 @@ static int dir_commit_chunk(struct page *page, unsigned from, unsigned to) | |||
53 | static struct page * dir_get_page(struct inode *dir, unsigned long n) | 53 | static struct page * dir_get_page(struct inode *dir, unsigned long n) |
54 | { | 54 | { |
55 | struct address_space *mapping = dir->i_mapping; | 55 | struct address_space *mapping = dir->i_mapping; |
56 | struct page *page = read_cache_page(mapping, n, | 56 | struct page *page = read_mapping_page(mapping, n, NULL); |
57 | (filler_t*)mapping->a_ops->readpage, NULL); | ||
58 | if (!IS_ERR(page)) { | 57 | if (!IS_ERR(page)) { |
59 | wait_on_page_locked(page); | 58 | wait_on_page_locked(page); |
60 | kmap(page); | 59 | kmap(page); |
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index 3ff89cc5833a..58b2d22142ba 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
@@ -85,8 +85,9 @@ static void sysv_put_super(struct super_block *sb) | |||
85 | kfree(sbi); | 85 | kfree(sbi); |
86 | } | 86 | } |
87 | 87 | ||
88 | static int sysv_statfs(struct super_block *sb, struct kstatfs *buf) | 88 | static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf) |
89 | { | 89 | { |
90 | struct super_block *sb = dentry->d_sb; | ||
90 | struct sysv_sb_info *sbi = SYSV_SB(sb); | 91 | struct sysv_sb_info *sbi = SYSV_SB(sb); |
91 | 92 | ||
92 | buf->f_type = sb->s_magic; | 93 | buf->f_type = sb->s_magic; |
diff --git a/fs/sysv/super.c b/fs/sysv/super.c index e92b991e6dda..876639b93321 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c | |||
@@ -506,16 +506,17 @@ failed: | |||
506 | 506 | ||
507 | /* Every kernel module contains stuff like this. */ | 507 | /* Every kernel module contains stuff like this. */ |
508 | 508 | ||
509 | static struct super_block *sysv_get_sb(struct file_system_type *fs_type, | 509 | static int sysv_get_sb(struct file_system_type *fs_type, |
510 | int flags, const char *dev_name, void *data) | 510 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
511 | { | 511 | { |
512 | return get_sb_bdev(fs_type, flags, dev_name, data, sysv_fill_super); | 512 | return get_sb_bdev(fs_type, flags, dev_name, data, sysv_fill_super, |
513 | mnt); | ||
513 | } | 514 | } |
514 | 515 | ||
515 | static struct super_block *v7_get_sb(struct file_system_type *fs_type, | 516 | static int v7_get_sb(struct file_system_type *fs_type, |
516 | int flags, const char *dev_name, void *data) | 517 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
517 | { | 518 | { |
518 | return get_sb_bdev(fs_type, flags, dev_name, data, v7_fill_super); | 519 | return get_sb_bdev(fs_type, flags, dev_name, data, v7_fill_super, mnt); |
519 | } | 520 | } |
520 | 521 | ||
521 | static struct file_system_type sysv_fs_type = { | 522 | static struct file_system_type sysv_fs_type = { |
diff --git a/fs/udf/super.c b/fs/udf/super.c index e45789fe38e8..44fe2cb0bbb2 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -91,13 +91,13 @@ static void udf_load_partdesc(struct super_block *, struct buffer_head *); | |||
91 | static void udf_open_lvid(struct super_block *); | 91 | static void udf_open_lvid(struct super_block *); |
92 | static void udf_close_lvid(struct super_block *); | 92 | static void udf_close_lvid(struct super_block *); |
93 | static unsigned int udf_count_free(struct super_block *); | 93 | static unsigned int udf_count_free(struct super_block *); |
94 | static int udf_statfs(struct super_block *, struct kstatfs *); | 94 | static int udf_statfs(struct dentry *, struct kstatfs *); |
95 | 95 | ||
96 | /* UDF filesystem type */ | 96 | /* UDF filesystem type */ |
97 | static struct super_block *udf_get_sb(struct file_system_type *fs_type, | 97 | static int udf_get_sb(struct file_system_type *fs_type, |
98 | int flags, const char *dev_name, void *data) | 98 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
99 | { | 99 | { |
100 | return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super); | 100 | return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super, mnt); |
101 | } | 101 | } |
102 | 102 | ||
103 | static struct file_system_type udf_fstype = { | 103 | static struct file_system_type udf_fstype = { |
@@ -1779,8 +1779,10 @@ udf_put_super(struct super_block *sb) | |||
1779 | * Written, tested, and released. | 1779 | * Written, tested, and released. |
1780 | */ | 1780 | */ |
1781 | static int | 1781 | static int |
1782 | udf_statfs(struct super_block *sb, struct kstatfs *buf) | 1782 | udf_statfs(struct dentry *dentry, struct kstatfs *buf) |
1783 | { | 1783 | { |
1784 | struct super_block *sb = dentry->d_sb; | ||
1785 | |||
1784 | buf->f_type = UDF_SUPER_MAGIC; | 1786 | buf->f_type = UDF_SUPER_MAGIC; |
1785 | buf->f_bsize = sb->s_blocksize; | 1787 | buf->f_bsize = sb->s_blocksize; |
1786 | buf->f_blocks = UDF_SB_PARTLEN(sb, UDF_SB_PARTITION(sb)); | 1788 | buf->f_blocks = UDF_SB_PARTLEN(sb, UDF_SB_PARTITION(sb)); |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index db98a4c71e63..fe5ab2aa2899 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -1113,8 +1113,9 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1113 | return 0; | 1113 | return 0; |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | static int ufs_statfs (struct super_block *sb, struct kstatfs *buf) | 1116 | static int ufs_statfs (struct dentry *dentry, struct kstatfs *buf) |
1117 | { | 1117 | { |
1118 | struct super_block *sb = dentry->d_sb; | ||
1118 | struct ufs_sb_private_info * uspi; | 1119 | struct ufs_sb_private_info * uspi; |
1119 | struct ufs_super_block_first * usb1; | 1120 | struct ufs_super_block_first * usb1; |
1120 | struct ufs_super_block * usb; | 1121 | struct ufs_super_block * usb; |
@@ -1311,10 +1312,10 @@ out: | |||
1311 | 1312 | ||
1312 | #endif | 1313 | #endif |
1313 | 1314 | ||
1314 | static struct super_block *ufs_get_sb(struct file_system_type *fs_type, | 1315 | static int ufs_get_sb(struct file_system_type *fs_type, |
1315 | int flags, const char *dev_name, void *data) | 1316 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
1316 | { | 1317 | { |
1317 | return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super); | 1318 | return get_sb_bdev(fs_type, flags, dev_name, data, ufs_fill_super, mnt); |
1318 | } | 1319 | } |
1319 | 1320 | ||
1320 | static struct file_system_type ufs_fs_type = { | 1321 | static struct file_system_type ufs_fs_type = { |
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c index a56cec3be5f0..9a8f48bae956 100644 --- a/fs/vfat/namei.c +++ b/fs/vfat/namei.c | |||
@@ -1023,11 +1023,12 @@ static int vfat_fill_super(struct super_block *sb, void *data, int silent) | |||
1023 | return 0; | 1023 | return 0; |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | static struct super_block *vfat_get_sb(struct file_system_type *fs_type, | 1026 | static int vfat_get_sb(struct file_system_type *fs_type, |
1027 | int flags, const char *dev_name, | 1027 | int flags, const char *dev_name, |
1028 | void *data) | 1028 | void *data, struct vfsmount *mnt) |
1029 | { | 1029 | { |
1030 | return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super); | 1030 | return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super, |
1031 | mnt); | ||
1031 | } | 1032 | } |
1032 | 1033 | ||
1033 | static struct file_system_type vfat_fs_type = { | 1034 | static struct file_system_type vfat_fs_type = { |
diff --git a/fs/xfs/linux-2.6/xfs_stats.c b/fs/xfs/linux-2.6/xfs_stats.c index 1f0589a05eca..e480b6102051 100644 --- a/fs/xfs/linux-2.6/xfs_stats.c +++ b/fs/xfs/linux-2.6/xfs_stats.c | |||
@@ -62,7 +62,7 @@ xfs_read_xfsstats( | |||
62 | while (j < xstats[i].endpoint) { | 62 | while (j < xstats[i].endpoint) { |
63 | val = 0; | 63 | val = 0; |
64 | /* sum over all cpus */ | 64 | /* sum over all cpus */ |
65 | for_each_cpu(c) | 65 | for_each_possible_cpu(c) |
66 | val += *(((__u32*)&per_cpu(xfsstats, c) + j)); | 66 | val += *(((__u32*)&per_cpu(xfsstats, c) + j)); |
67 | len += sprintf(buffer + len, " %u", val); | 67 | len += sprintf(buffer + len, " %u", val); |
68 | j++; | 68 | j++; |
@@ -70,7 +70,7 @@ xfs_read_xfsstats( | |||
70 | buffer[len++] = '\n'; | 70 | buffer[len++] = '\n'; |
71 | } | 71 | } |
72 | /* extra precision counters */ | 72 | /* extra precision counters */ |
73 | for_each_cpu(i) { | 73 | for_each_possible_cpu(i) { |
74 | xs_xstrat_bytes += per_cpu(xfsstats, i).xs_xstrat_bytes; | 74 | xs_xstrat_bytes += per_cpu(xfsstats, i).xs_xstrat_bytes; |
75 | xs_write_bytes += per_cpu(xfsstats, i).xs_write_bytes; | 75 | xs_write_bytes += per_cpu(xfsstats, i).xs_write_bytes; |
76 | xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes; | 76 | xs_read_bytes += per_cpu(xfsstats, i).xs_read_bytes; |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index f2a0778536f4..9bdef9d51900 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -684,10 +684,11 @@ xfs_fs_sync_super( | |||
684 | 684 | ||
685 | STATIC int | 685 | STATIC int |
686 | xfs_fs_statfs( | 686 | xfs_fs_statfs( |
687 | struct super_block *sb, | 687 | struct dentry *dentry, |
688 | struct kstatfs *statp) | 688 | struct kstatfs *statp) |
689 | { | 689 | { |
690 | return -bhv_vfs_statvfs(vfs_from_sb(sb), statp, NULL); | 690 | return -bhv_vfs_statvfs(vfs_from_sb(dentry->d_sb), statp, |
691 | vn_from_inode(dentry->d_inode)); | ||
691 | } | 692 | } |
692 | 693 | ||
693 | STATIC int | 694 | STATIC int |
@@ -853,14 +854,16 @@ fail_vfsop: | |||
853 | return -error; | 854 | return -error; |
854 | } | 855 | } |
855 | 856 | ||
856 | STATIC struct super_block * | 857 | STATIC int |
857 | xfs_fs_get_sb( | 858 | xfs_fs_get_sb( |
858 | struct file_system_type *fs_type, | 859 | struct file_system_type *fs_type, |
859 | int flags, | 860 | int flags, |
860 | const char *dev_name, | 861 | const char *dev_name, |
861 | void *data) | 862 | void *data, |
863 | struct vfsmount *mnt) | ||
862 | { | 864 | { |
863 | return get_sb_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super); | 865 | return get_sb_bdev(fs_type, flags, dev_name, data, xfs_fs_fill_super, |
866 | mnt); | ||
864 | } | 867 | } |
865 | 868 | ||
866 | STATIC struct super_operations xfs_super_operations = { | 869 | STATIC struct super_operations xfs_super_operations = { |
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c index 4af97682bec8..af246532fbfb 100644 --- a/fs/xfs/linux-2.6/xfs_sysctl.c +++ b/fs/xfs/linux-2.6/xfs_sysctl.c | |||
@@ -38,7 +38,7 @@ xfs_stats_clear_proc_handler( | |||
38 | 38 | ||
39 | if (!ret && write && *valp) { | 39 | if (!ret && write && *valp) { |
40 | printk("XFS Clearing xfsstats\n"); | 40 | printk("XFS Clearing xfsstats\n"); |
41 | for_each_cpu(c) { | 41 | for_each_possible_cpu(c) { |
42 | preempt_disable(); | 42 | preempt_disable(); |
43 | /* save vn_active, it's a universal truth! */ | 43 | /* save vn_active, it's a universal truth! */ |
44 | vn_active = per_cpu(xfsstats, c).vn_active; | 44 | vn_active = per_cpu(xfsstats, c).vn_active; |