diff options
Diffstat (limited to 'fs')
65 files changed, 752 insertions, 220 deletions
diff --git a/fs/afs/cell.c b/fs/afs/cell.c index bfc1fd22d5b1..1fc578372759 100644 --- a/fs/afs/cell.c +++ b/fs/afs/cell.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/sched.h> | ||
14 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
15 | #include <rxrpc/peer.h> | 14 | #include <rxrpc/peer.h> |
16 | #include <rxrpc/connection.h> | 15 | #include <rxrpc/connection.h> |
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 9908462bcadc..b6dc2ebe47a8 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/sched.h> | ||
16 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
18 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
diff --git a/fs/afs/file.c b/fs/afs/file.c index eeff14c3f748..b17634541f67 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/sched.h> | ||
16 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
18 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 6f37754906c2..9d9bca6c28b5 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/sched.h> | ||
20 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
21 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
22 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
diff --git a/fs/afs/main.c b/fs/afs/main.c index 913c689bdb35..f2704ba53857 100644 --- a/fs/afs/main.c +++ b/fs/afs/main.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/moduleparam.h> | 13 | #include <linux/moduleparam.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/sched.h> | ||
16 | #include <linux/completion.h> | 15 | #include <linux/completion.h> |
17 | #include <rxrpc/rxrpc.h> | 16 | #include <rxrpc/rxrpc.h> |
18 | #include <rxrpc/transport.h> | 17 | #include <rxrpc/transport.h> |
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index fdf23b2a2112..68495f0de7b3 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/sched.h> | ||
16 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
18 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
diff --git a/fs/afs/proc.c b/fs/afs/proc.c index 86463ec9ccb4..ae6b85b1e484 100644 --- a/fs/afs/proc.c +++ b/fs/afs/proc.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
14 | #include <linux/module.h> | 13 | #include <linux/module.h> |
15 | #include <linux/proc_fs.h> | 14 | #include <linux/proc_fs.h> |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 669dbe5b0317..51db1182b27e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -76,7 +76,8 @@ static struct linux_binfmt elf_format = { | |||
76 | .load_binary = load_elf_binary, | 76 | .load_binary = load_elf_binary, |
77 | .load_shlib = load_elf_library, | 77 | .load_shlib = load_elf_library, |
78 | .core_dump = elf_core_dump, | 78 | .core_dump = elf_core_dump, |
79 | .min_coredump = ELF_EXEC_PAGESIZE | 79 | .min_coredump = ELF_EXEC_PAGESIZE, |
80 | .hasvdso = 1 | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | #define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) | 83 | #define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) |
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c index db3b1a9c9a5b..c57a1fa7cf23 100644 --- a/fs/coda/sysctl.c +++ b/fs/coda/sysctl.c | |||
@@ -33,8 +33,6 @@ | |||
33 | 33 | ||
34 | static struct ctl_table_header *fs_table_header; | 34 | static struct ctl_table_header *fs_table_header; |
35 | 35 | ||
36 | #define FS_CODA 1 /* Coda file system */ | ||
37 | |||
38 | #define CODA_TIMEOUT 3 /* timeout on upcalls to become intrble */ | 36 | #define CODA_TIMEOUT 3 /* timeout on upcalls to become intrble */ |
39 | #define CODA_HARD 5 /* mount type "hard" or "soft" */ | 37 | #define CODA_HARD 5 /* mount type "hard" or "soft" */ |
40 | #define CODA_VFS 6 /* vfs statistics */ | 38 | #define CODA_VFS 6 /* vfs statistics */ |
@@ -183,17 +181,57 @@ static const struct file_operations proc_cache_inv_stats_fops = { | |||
183 | }; | 181 | }; |
184 | 182 | ||
185 | static ctl_table coda_table[] = { | 183 | static ctl_table coda_table[] = { |
186 | {CODA_TIMEOUT, "timeout", &coda_timeout, sizeof(int), 0644, NULL, &proc_dointvec}, | 184 | { |
187 | {CODA_HARD, "hard", &coda_hard, sizeof(int), 0644, NULL, &proc_dointvec}, | 185 | .ctl_name = CTL_UNNUMBERED, |
188 | {CODA_VFS, "vfs_stats", NULL, 0, 0644, NULL, &do_reset_coda_vfs_stats}, | 186 | .procname = "timeout", |
189 | {CODA_CACHE_INV, "cache_inv_stats", NULL, 0, 0644, NULL, &do_reset_coda_cache_inv_stats}, | 187 | .data = &coda_timeout, |
190 | {CODA_FAKE_STATFS, "fake_statfs", &coda_fake_statfs, sizeof(int), 0600, NULL, &proc_dointvec}, | 188 | .maxlen = sizeof(int), |
191 | { 0 } | 189 | .mode = 0644, |
190 | .proc_handler = &proc_dointvec | ||
191 | }, | ||
192 | { | ||
193 | .ctl_name = CTL_UNNUMBERED, | ||
194 | .procname = "hard", | ||
195 | .data = &coda_hard, | ||
196 | .maxlen = sizeof(int), | ||
197 | .mode = 0644, | ||
198 | .proc_handler = &proc_dointvec | ||
199 | }, | ||
200 | { | ||
201 | .ctl_name = CTL_UNNUMBERED, | ||
202 | .procname = "vfs_stats", | ||
203 | .data = NULL, | ||
204 | .maxlen = 0, | ||
205 | .mode = 0644, | ||
206 | .proc_handler = &do_reset_coda_vfs_stats | ||
207 | }, | ||
208 | { | ||
209 | .ctl_name = CTL_UNNUMBERED, | ||
210 | .procname = "cache_inv_stats", | ||
211 | .data = NULL, | ||
212 | .maxlen = 0, | ||
213 | .mode = 0644, | ||
214 | .proc_handler = &do_reset_coda_cache_inv_stats | ||
215 | }, | ||
216 | { | ||
217 | .ctl_name = CTL_UNNUMBERED, | ||
218 | .procname = "fake_statfs", | ||
219 | .data = &coda_fake_statfs, | ||
220 | .maxlen = sizeof(int), | ||
221 | .mode = 0600, | ||
222 | .proc_handler = &proc_dointvec | ||
223 | }, | ||
224 | {} | ||
192 | }; | 225 | }; |
193 | 226 | ||
194 | static ctl_table fs_table[] = { | 227 | static ctl_table fs_table[] = { |
195 | {FS_CODA, "coda", NULL, 0, 0555, coda_table}, | 228 | { |
196 | {0} | 229 | .ctl_name = CTL_UNNUMBERED, |
230 | .procname = "coda", | ||
231 | .mode = 0555, | ||
232 | .child = coda_table | ||
233 | }, | ||
234 | {} | ||
197 | }; | 235 | }; |
198 | 236 | ||
199 | 237 | ||
@@ -233,7 +271,7 @@ void coda_sysctl_init(void) | |||
233 | 271 | ||
234 | #ifdef CONFIG_SYSCTL | 272 | #ifdef CONFIG_SYSCTL |
235 | if ( !fs_table_header ) | 273 | if ( !fs_table_header ) |
236 | fs_table_header = register_sysctl_table(fs_table, 0); | 274 | fs_table_header = register_sysctl_table(fs_table); |
237 | #endif | 275 | #endif |
238 | } | 276 | } |
239 | 277 | ||
diff --git a/fs/dquot.c b/fs/dquot.c index 9eb166f91489..b16f991662c1 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -1841,7 +1841,7 @@ static int __init dquot_init(void) | |||
1841 | 1841 | ||
1842 | printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__); | 1842 | printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__); |
1843 | 1843 | ||
1844 | register_sysctl_table(sys_table, 0); | 1844 | register_sysctl_table(sys_table); |
1845 | 1845 | ||
1846 | dquot_cachep = kmem_cache_create("dquot", | 1846 | dquot_cachep = kmem_cache_create("dquot", |
1847 | sizeof(struct dquot), sizeof(unsigned long) * 4, | 1847 | sizeof(struct dquot), sizeof(unsigned long) * 4, |
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index c209f67e7a26..81156e95ef8e 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c | |||
@@ -26,7 +26,6 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/sched.h> | ||
30 | #include <linux/syscalls.h> | 29 | #include <linux/syscalls.h> |
31 | #include <linux/pagemap.h> | 30 | #include <linux/pagemap.h> |
32 | #include <linux/key.h> | 31 | #include <linux/key.h> |
diff --git a/fs/ext3/hash.c b/fs/ext3/hash.c index deeb27b5ba83..c30e149fbd2e 100644 --- a/fs/ext3/hash.c +++ b/fs/ext3/hash.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/jbd.h> | 13 | #include <linux/jbd.h> |
14 | #include <linux/sched.h> | ||
15 | #include <linux/ext3_fs.h> | 14 | #include <linux/ext3_fs.h> |
16 | #include <linux/cryptohash.h> | 15 | #include <linux/cryptohash.h> |
17 | 16 | ||
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index b73cba12f79c..ecf89904c113 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #define EXT3FS_DEBUG | 12 | #define EXT3FS_DEBUG |
13 | 13 | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/smp_lock.h> | 14 | #include <linux/smp_lock.h> |
16 | #include <linux/ext3_jbd.h> | 15 | #include <linux/ext3_jbd.h> |
17 | 16 | ||
diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c index a67966385e06..1555024e3b36 100644 --- a/fs/ext4/hash.c +++ b/fs/ext4/hash.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/jbd2.h> | 13 | #include <linux/jbd2.h> |
14 | #include <linux/sched.h> | ||
15 | #include <linux/ext4_fs.h> | 14 | #include <linux/ext4_fs.h> |
16 | #include <linux/cryptohash.h> | 15 | #include <linux/cryptohash.h> |
17 | 16 | ||
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 4fe49c3661b2..ea99f6c97f56 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #define EXT4FS_DEBUG | 12 | #define EXT4FS_DEBUG |
13 | 13 | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/smp_lock.h> | 14 | #include <linux/smp_lock.h> |
16 | #include <linux/ext4_jbd2.h> | 15 | #include <linux/ext4_jbd2.h> |
17 | 16 | ||
diff --git a/fs/filesystems.c b/fs/filesystems.c index e3fa77c6ed56..7a4f61aa05f8 100644 --- a/fs/filesystems.c +++ b/fs/filesystems.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/kmod.h> | 12 | #include <linux/kmod.h> |
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/sched.h> /* for 'current' */ | ||
16 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
17 | 16 | ||
18 | /* | 17 | /* |
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 113f6c9110c7..c53a5d2d0590 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index c93ca8f361b5..82a1ac7895a2 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -53,7 +53,6 @@ | |||
53 | * but never before the maximum hash table size has been reached. | 53 | * but never before the maximum hash table size has been reached. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include <linux/sched.h> | ||
57 | #include <linux/slab.h> | 56 | #include <linux/slab.h> |
58 | #include <linux/spinlock.h> | 57 | #include <linux/spinlock.h> |
59 | #include <linux/buffer_head.h> | 58 | #include <linux/buffer_head.h> |
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c index cd747c00f670..c1f44009853f 100644 --- a/fs/gfs2/eaops.c +++ b/fs/gfs2/eaops.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c index 0c83c7f4dda8..5b83ca6acab1 100644 --- a/fs/gfs2/eattr.c +++ b/fs/gfs2/eattr.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index c4b0391b7aa2..46af55355513 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/lm.c b/fs/gfs2/lm.c index e30673dd37e0..cfcc39b86a53 100644 --- a/fs/gfs2/lm.c +++ b/fs/gfs2/lm.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index 7c1a9e22a526..6e8a59809abf 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c index ef3092e29607..32caecd20300 100644 --- a/fs/gfs2/mount.c +++ b/fs/gfs2/mount.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c index f2495f1e21ad..d9ecfd23a49e 100644 --- a/fs/gfs2/ondisk.c +++ b/fs/gfs2/ondisk.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c index 9187eb174b43..c6bac6b69420 100644 --- a/fs/gfs2/ops_dentry.c +++ b/fs/gfs2/ops_dentry.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c index 4855e8cca622..1de05b63d43a 100644 --- a/fs/gfs2/ops_export.c +++ b/fs/gfs2/ops_export.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index c996aa739a05..b50180e22779 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 60f47bf2e8e8..d85f6e05cb95 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/ops_vm.c b/fs/gfs2/ops_vm.c index 14b380fb0602..aa0dbd2aac1b 100644 --- a/fs/gfs2/ops_vm.c +++ b/fs/gfs2/ops_vm.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index d0c806b85c86..8bc182c7e2ef 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index ff0846528d54..8d9c08b5c4b6 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index e5707a9f78c2..601eaa1b9ed6 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * of the GNU General Public License version 2. | 7 | * of the GNU General Public License version 2. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/slab.h> | 10 | #include <linux/slab.h> |
12 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index f2d7c49ce759..ba117c445e78 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * Handling of catalog records | 8 | * Handling of catalog records |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/sched.h> | ||
12 | 11 | ||
13 | #include "hfsplus_fs.h" | 12 | #include "hfsplus_fs.h" |
14 | #include "hfsplus_raw.h" | 13 | #include "hfsplus_raw.h" |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 78137007ccc1..80b5682a2273 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/sched.h> | ||
14 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
15 | #include <linux/random.h> | 14 | #include <linux/random.h> |
16 | 15 | ||
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 5a282f64c637..1a97f9293447 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/sched.h> | ||
15 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
16 | #include <linux/vfs.h> | 15 | #include <linux/vfs.h> |
17 | #include <linux/nls.h> | 16 | #include <linux/nls.h> |
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c index 3681d0728ac7..0c1fc6e20b43 100644 --- a/fs/jffs2/compr_zlib.c +++ b/fs/jffs2/compr_zlib.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/sched.h> | ||
20 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
21 | #include <linux/zlib.h> | 20 | #include <linux/zlib.h> |
22 | #include <linux/zutil.h> | 21 | #include <linux/zutil.h> |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index cdbe2fe14e2d..9fa2e27f0641 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/sched.h> | ||
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
18 | #include <linux/crc32.h> | 17 | #include <linux/crc32.h> |
19 | #include <linux/jffs2.h> | 18 | #include <linux/jffs2.h> |
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c index 25265965bdc1..30f888414ce7 100644 --- a/fs/jffs2/summary.c +++ b/fs/jffs2/summary.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/sched.h> | ||
18 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
19 | #include <linux/mtd/mtd.h> | 18 | #include <linux/mtd/mtd.h> |
20 | #include <linux/pagemap.h> | 19 | #include <linux/pagemap.h> |
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 22d403208973..ad21c0713efa 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -9,7 +9,6 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/sched.h> | ||
13 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
14 | #include <linux/in.h> | 13 | #include <linux/in.h> |
15 | #include <linux/sunrpc/clnt.h> | 14 | #include <linux/sunrpc/clnt.h> |
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 80fcacc1acf9..50cb8daba4e5 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -512,7 +512,7 @@ module_param(nsm_use_hostnames, bool, 0644); | |||
512 | 512 | ||
513 | static int __init init_nlm(void) | 513 | static int __init init_nlm(void) |
514 | { | 514 | { |
515 | nlm_sysctl_table = register_sysctl_table(nlm_sysctl_root, 0); | 515 | nlm_sysctl_table = register_sysctl_table(nlm_sysctl_root); |
516 | return nlm_sysctl_table ? 0 : -ENOMEM; | 516 | return nlm_sysctl_table ? 0 : -ENOMEM; |
517 | } | 517 | } |
518 | 518 | ||
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index 823298561c0a..f5f4430fb2a4 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c | |||
@@ -43,7 +43,6 @@ | |||
43 | * child task framework of the RPC layer? | 43 | * child task framework of the RPC layer? |
44 | */ | 44 | */ |
45 | 45 | ||
46 | #include <linux/sched.h> | ||
47 | #include <linux/smp_lock.h> | 46 | #include <linux/smp_lock.h> |
48 | #include <linux/mm.h> | 47 | #include <linux/mm.h> |
49 | #include <linux/pagemap.h> | 48 | #include <linux/pagemap.h> |
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c index 3ea50ac64820..fcdcafbb3293 100644 --- a/fs/nfs/sysctl.c +++ b/fs/nfs/sysctl.c | |||
@@ -75,7 +75,7 @@ static ctl_table nfs_cb_sysctl_root[] = { | |||
75 | 75 | ||
76 | int nfs_register_sysctl(void) | 76 | int nfs_register_sysctl(void) |
77 | { | 77 | { |
78 | nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root, 0); | 78 | nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root); |
79 | if (nfs_callback_sysctl_table == NULL) | 79 | if (nfs_callback_sysctl_table == NULL) |
80 | return -ENOMEM; | 80 | return -ENOMEM; |
81 | return 0; | 81 | return 0; |
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 49c310b84923..6f24768272a1 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | #include <linux/unistd.h> | 17 | #include <linux/unistd.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/sched.h> | ||
20 | #include <linux/stat.h> | 19 | #include <linux/stat.h> |
21 | #include <linux/in.h> | 20 | #include <linux/in.h> |
22 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
@@ -190,18 +189,17 @@ static int expkey_show(struct seq_file *m, | |||
190 | struct cache_head *h) | 189 | struct cache_head *h) |
191 | { | 190 | { |
192 | struct svc_expkey *ek ; | 191 | struct svc_expkey *ek ; |
192 | int i; | ||
193 | 193 | ||
194 | if (h ==NULL) { | 194 | if (h ==NULL) { |
195 | seq_puts(m, "#domain fsidtype fsid [path]\n"); | 195 | seq_puts(m, "#domain fsidtype fsid [path]\n"); |
196 | return 0; | 196 | return 0; |
197 | } | 197 | } |
198 | ek = container_of(h, struct svc_expkey, h); | 198 | ek = container_of(h, struct svc_expkey, h); |
199 | seq_printf(m, "%s %d 0x%08x", ek->ek_client->name, | 199 | seq_printf(m, "%s %d 0x", ek->ek_client->name, |
200 | ek->ek_fsidtype, ek->ek_fsid[0]); | 200 | ek->ek_fsidtype); |
201 | if (ek->ek_fsidtype != 1) | 201 | for (i=0; i < key_len(ek->ek_fsidtype)/4; i++) |
202 | seq_printf(m, "%08x", ek->ek_fsid[1]); | 202 | seq_printf(m, "%08x", ek->ek_fsid[i]); |
203 | if (ek->ek_fsidtype == 2) | ||
204 | seq_printf(m, "%08x", ek->ek_fsid[2]); | ||
205 | if (test_bit(CACHE_VALID, &h->flags) && | 203 | if (test_bit(CACHE_VALID, &h->flags) && |
206 | !test_bit(CACHE_NEGATIVE, &h->flags)) { | 204 | !test_bit(CACHE_NEGATIVE, &h->flags)) { |
207 | seq_printf(m, " "); | 205 | seq_printf(m, " "); |
@@ -232,9 +230,8 @@ static inline void expkey_init(struct cache_head *cnew, | |||
232 | kref_get(&item->ek_client->ref); | 230 | kref_get(&item->ek_client->ref); |
233 | new->ek_client = item->ek_client; | 231 | new->ek_client = item->ek_client; |
234 | new->ek_fsidtype = item->ek_fsidtype; | 232 | new->ek_fsidtype = item->ek_fsidtype; |
235 | new->ek_fsid[0] = item->ek_fsid[0]; | 233 | |
236 | new->ek_fsid[1] = item->ek_fsid[1]; | 234 | memcpy(new->ek_fsid, item->ek_fsid, sizeof(new->ek_fsid)); |
237 | new->ek_fsid[2] = item->ek_fsid[2]; | ||
238 | } | 235 | } |
239 | 236 | ||
240 | static inline void expkey_update(struct cache_head *cnew, | 237 | static inline void expkey_update(struct cache_head *cnew, |
@@ -363,7 +360,7 @@ static struct svc_export *svc_export_update(struct svc_export *new, | |||
363 | struct svc_export *old); | 360 | struct svc_export *old); |
364 | static struct svc_export *svc_export_lookup(struct svc_export *); | 361 | static struct svc_export *svc_export_lookup(struct svc_export *); |
365 | 362 | ||
366 | static int check_export(struct inode *inode, int flags) | 363 | static int check_export(struct inode *inode, int flags, unsigned char *uuid) |
367 | { | 364 | { |
368 | 365 | ||
369 | /* We currently export only dirs and regular files. | 366 | /* We currently export only dirs and regular files. |
@@ -376,12 +373,13 @@ static int check_export(struct inode *inode, int flags) | |||
376 | /* There are two requirements on a filesystem to be exportable. | 373 | /* There are two requirements on a filesystem to be exportable. |
377 | * 1: We must be able to identify the filesystem from a number. | 374 | * 1: We must be able to identify the filesystem from a number. |
378 | * either a device number (so FS_REQUIRES_DEV needed) | 375 | * either a device number (so FS_REQUIRES_DEV needed) |
379 | * or an FSID number (so NFSEXP_FSID needed). | 376 | * or an FSID number (so NFSEXP_FSID or ->uuid is needed). |
380 | * 2: We must be able to find an inode from a filehandle. | 377 | * 2: We must be able to find an inode from a filehandle. |
381 | * This means that s_export_op must be set. | 378 | * This means that s_export_op must be set. |
382 | */ | 379 | */ |
383 | if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && | 380 | if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && |
384 | !(flags & NFSEXP_FSID)) { | 381 | !(flags & NFSEXP_FSID) && |
382 | uuid == NULL) { | ||
385 | dprintk("exp_export: export of non-dev fs without fsid\n"); | 383 | dprintk("exp_export: export of non-dev fs without fsid\n"); |
386 | return -EINVAL; | 384 | return -EINVAL; |
387 | } | 385 | } |
@@ -406,10 +404,6 @@ fsloc_parse(char **mesg, char *buf, struct nfsd4_fs_locations *fsloc) | |||
406 | int len; | 404 | int len; |
407 | int migrated, i, err; | 405 | int migrated, i, err; |
408 | 406 | ||
409 | len = qword_get(mesg, buf, PAGE_SIZE); | ||
410 | if (len != 5 || memcmp(buf, "fsloc", 5)) | ||
411 | return 0; | ||
412 | |||
413 | /* listsize */ | 407 | /* listsize */ |
414 | err = get_int(mesg, &fsloc->locations_count); | 408 | err = get_int(mesg, &fsloc->locations_count); |
415 | if (err) | 409 | if (err) |
@@ -520,6 +514,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
520 | exp.ex_fslocs.locations_count = 0; | 514 | exp.ex_fslocs.locations_count = 0; |
521 | exp.ex_fslocs.migrated = 0; | 515 | exp.ex_fslocs.migrated = 0; |
522 | 516 | ||
517 | exp.ex_uuid = NULL; | ||
518 | |||
523 | /* flags */ | 519 | /* flags */ |
524 | err = get_int(&mesg, &an_int); | 520 | err = get_int(&mesg, &an_int); |
525 | if (err == -ENOENT) | 521 | if (err == -ENOENT) |
@@ -543,12 +539,33 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
543 | if (err) goto out; | 539 | if (err) goto out; |
544 | exp.ex_fsid = an_int; | 540 | exp.ex_fsid = an_int; |
545 | 541 | ||
546 | err = check_export(nd.dentry->d_inode, exp.ex_flags); | 542 | while ((len = qword_get(&mesg, buf, PAGE_SIZE)) > 0) { |
547 | if (err) goto out; | 543 | if (strcmp(buf, "fsloc") == 0) |
544 | err = fsloc_parse(&mesg, buf, &exp.ex_fslocs); | ||
545 | else if (strcmp(buf, "uuid") == 0) { | ||
546 | /* expect a 16 byte uuid encoded as \xXXXX... */ | ||
547 | len = qword_get(&mesg, buf, PAGE_SIZE); | ||
548 | if (len != 16) | ||
549 | err = -EINVAL; | ||
550 | else { | ||
551 | exp.ex_uuid = | ||
552 | kmemdup(buf, 16, GFP_KERNEL); | ||
553 | if (exp.ex_uuid == NULL) | ||
554 | err = -ENOMEM; | ||
555 | } | ||
556 | } else | ||
557 | /* quietly ignore unknown words and anything | ||
558 | * following. Newer user-space can try to set | ||
559 | * new values, then see what the result was. | ||
560 | */ | ||
561 | break; | ||
562 | if (err) | ||
563 | goto out; | ||
564 | } | ||
548 | 565 | ||
549 | err = fsloc_parse(&mesg, buf, &exp.ex_fslocs); | 566 | err = check_export(nd.dentry->d_inode, exp.ex_flags, |
550 | if (err) | 567 | exp.ex_uuid); |
551 | goto out; | 568 | if (err) goto out; |
552 | } | 569 | } |
553 | 570 | ||
554 | expp = svc_export_lookup(&exp); | 571 | expp = svc_export_lookup(&exp); |
@@ -562,6 +579,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
562 | else | 579 | else |
563 | exp_put(expp); | 580 | exp_put(expp); |
564 | out: | 581 | out: |
582 | nfsd4_fslocs_free(&exp.ex_fslocs); | ||
583 | kfree(exp.ex_uuid); | ||
565 | kfree(exp.ex_path); | 584 | kfree(exp.ex_path); |
566 | if (nd.dentry) | 585 | if (nd.dentry) |
567 | path_release(&nd); | 586 | path_release(&nd); |
@@ -591,9 +610,19 @@ static int svc_export_show(struct seq_file *m, | |||
591 | seq_escape(m, exp->ex_client->name, " \t\n\\"); | 610 | seq_escape(m, exp->ex_client->name, " \t\n\\"); |
592 | seq_putc(m, '('); | 611 | seq_putc(m, '('); |
593 | if (test_bit(CACHE_VALID, &h->flags) && | 612 | if (test_bit(CACHE_VALID, &h->flags) && |
594 | !test_bit(CACHE_NEGATIVE, &h->flags)) | 613 | !test_bit(CACHE_NEGATIVE, &h->flags)) { |
595 | exp_flags(m, exp->ex_flags, exp->ex_fsid, | 614 | exp_flags(m, exp->ex_flags, exp->ex_fsid, |
596 | exp->ex_anon_uid, exp->ex_anon_gid, &exp->ex_fslocs); | 615 | exp->ex_anon_uid, exp->ex_anon_gid, &exp->ex_fslocs); |
616 | if (exp->ex_uuid) { | ||
617 | int i; | ||
618 | seq_puts(m, ",uuid="); | ||
619 | for (i=0; i<16; i++) { | ||
620 | if ((i&3) == 0 && i) | ||
621 | seq_putc(m, ':'); | ||
622 | seq_printf(m, "%02x", exp->ex_uuid[i]); | ||
623 | } | ||
624 | } | ||
625 | } | ||
597 | seq_puts(m, ")\n"); | 626 | seq_puts(m, ")\n"); |
598 | return 0; | 627 | return 0; |
599 | } | 628 | } |
@@ -630,6 +659,8 @@ static void export_update(struct cache_head *cnew, struct cache_head *citem) | |||
630 | new->ex_anon_uid = item->ex_anon_uid; | 659 | new->ex_anon_uid = item->ex_anon_uid; |
631 | new->ex_anon_gid = item->ex_anon_gid; | 660 | new->ex_anon_gid = item->ex_anon_gid; |
632 | new->ex_fsid = item->ex_fsid; | 661 | new->ex_fsid = item->ex_fsid; |
662 | new->ex_uuid = item->ex_uuid; | ||
663 | item->ex_uuid = NULL; | ||
633 | new->ex_path = item->ex_path; | 664 | new->ex_path = item->ex_path; |
634 | item->ex_path = NULL; | 665 | item->ex_path = NULL; |
635 | new->ex_fslocs.locations = item->ex_fslocs.locations; | 666 | new->ex_fslocs.locations = item->ex_fslocs.locations; |
@@ -752,11 +783,11 @@ exp_get_key(svc_client *clp, dev_t dev, ino_t ino) | |||
752 | u32 fsidv[3]; | 783 | u32 fsidv[3]; |
753 | 784 | ||
754 | if (old_valid_dev(dev)) { | 785 | if (old_valid_dev(dev)) { |
755 | mk_fsid_v0(fsidv, dev, ino); | 786 | mk_fsid(FSID_DEV, fsidv, dev, ino, 0, NULL); |
756 | return exp_find_key(clp, 0, fsidv, NULL); | 787 | return exp_find_key(clp, FSID_DEV, fsidv, NULL); |
757 | } | 788 | } |
758 | mk_fsid_v3(fsidv, dev, ino); | 789 | mk_fsid(FSID_ENCODE_DEV, fsidv, dev, ino, 0, NULL); |
759 | return exp_find_key(clp, 3, fsidv, NULL); | 790 | return exp_find_key(clp, FSID_ENCODE_DEV, fsidv, NULL); |
760 | } | 791 | } |
761 | 792 | ||
762 | /* | 793 | /* |
@@ -767,9 +798,9 @@ exp_get_fsid_key(svc_client *clp, int fsid) | |||
767 | { | 798 | { |
768 | u32 fsidv[2]; | 799 | u32 fsidv[2]; |
769 | 800 | ||
770 | mk_fsid_v1(fsidv, fsid); | 801 | mk_fsid(FSID_NUM, fsidv, 0, 0, fsid, NULL); |
771 | 802 | ||
772 | return exp_find_key(clp, 1, fsidv, NULL); | 803 | return exp_find_key(clp, FSID_NUM, fsidv, NULL); |
773 | } | 804 | } |
774 | 805 | ||
775 | svc_export * | 806 | svc_export * |
@@ -883,8 +914,8 @@ static int exp_fsid_hash(svc_client *clp, struct svc_export *exp) | |||
883 | if ((exp->ex_flags & NFSEXP_FSID) == 0) | 914 | if ((exp->ex_flags & NFSEXP_FSID) == 0) |
884 | return 0; | 915 | return 0; |
885 | 916 | ||
886 | mk_fsid_v1(fsid, exp->ex_fsid); | 917 | mk_fsid(FSID_NUM, fsid, 0, 0, exp->ex_fsid, NULL); |
887 | return exp_set_key(clp, 1, fsid, exp); | 918 | return exp_set_key(clp, FSID_NUM, fsid, exp); |
888 | } | 919 | } |
889 | 920 | ||
890 | static int exp_hash(struct auth_domain *clp, struct svc_export *exp) | 921 | static int exp_hash(struct auth_domain *clp, struct svc_export *exp) |
@@ -894,11 +925,11 @@ static int exp_hash(struct auth_domain *clp, struct svc_export *exp) | |||
894 | dev_t dev = inode->i_sb->s_dev; | 925 | dev_t dev = inode->i_sb->s_dev; |
895 | 926 | ||
896 | if (old_valid_dev(dev)) { | 927 | if (old_valid_dev(dev)) { |
897 | mk_fsid_v0(fsid, dev, inode->i_ino); | 928 | mk_fsid(FSID_DEV, fsid, dev, inode->i_ino, 0, NULL); |
898 | return exp_set_key(clp, 0, fsid, exp); | 929 | return exp_set_key(clp, FSID_DEV, fsid, exp); |
899 | } | 930 | } |
900 | mk_fsid_v3(fsid, dev, inode->i_ino); | 931 | mk_fsid(FSID_ENCODE_DEV, fsid, dev, inode->i_ino, 0, NULL); |
901 | return exp_set_key(clp, 3, fsid, exp); | 932 | return exp_set_key(clp, FSID_ENCODE_DEV, fsid, exp); |
902 | } | 933 | } |
903 | 934 | ||
904 | static void exp_unhash(struct svc_export *exp) | 935 | static void exp_unhash(struct svc_export *exp) |
@@ -977,7 +1008,7 @@ exp_export(struct nfsctl_export *nxp) | |||
977 | goto finish; | 1008 | goto finish; |
978 | } | 1009 | } |
979 | 1010 | ||
980 | err = check_export(nd.dentry->d_inode, nxp->ex_flags); | 1011 | err = check_export(nd.dentry->d_inode, nxp->ex_flags, NULL); |
981 | if (err) goto finish; | 1012 | if (err) goto finish; |
982 | 1013 | ||
983 | err = -ENOMEM; | 1014 | err = -ENOMEM; |
@@ -1170,9 +1201,9 @@ exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp, | |||
1170 | __be32 rv; | 1201 | __be32 rv; |
1171 | u32 fsidv[2]; | 1202 | u32 fsidv[2]; |
1172 | 1203 | ||
1173 | mk_fsid_v1(fsidv, 0); | 1204 | mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL); |
1174 | 1205 | ||
1175 | exp = exp_find(clp, 1, fsidv, creq); | 1206 | exp = exp_find(clp, FSID_NUM, fsidv, creq); |
1176 | if (IS_ERR(exp)) | 1207 | if (IS_ERR(exp)) |
1177 | return nfserrno(PTR_ERR(exp)); | 1208 | return nfserrno(PTR_ERR(exp)); |
1178 | if (exp == NULL) | 1209 | if (exp == NULL) |
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index e695660921ec..6f677988c71d 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -149,6 +149,27 @@ decode_sattr3(__be32 *p, struct iattr *iap) | |||
149 | return p; | 149 | return p; |
150 | } | 150 | } |
151 | 151 | ||
152 | static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp) | ||
153 | { | ||
154 | u64 f; | ||
155 | switch(fsid_source(fhp)) { | ||
156 | default: | ||
157 | case FSIDSOURCE_DEV: | ||
158 | p = xdr_encode_hyper(p, (u64)huge_encode_dev | ||
159 | (fhp->fh_dentry->d_inode->i_sb->s_dev)); | ||
160 | break; | ||
161 | case FSIDSOURCE_FSID: | ||
162 | p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid); | ||
163 | break; | ||
164 | case FSIDSOURCE_UUID: | ||
165 | f = ((u64*)fhp->fh_export->ex_uuid)[0]; | ||
166 | f ^= ((u64*)fhp->fh_export->ex_uuid)[1]; | ||
167 | p = xdr_encode_hyper(p, f); | ||
168 | break; | ||
169 | } | ||
170 | return p; | ||
171 | } | ||
172 | |||
152 | static __be32 * | 173 | static __be32 * |
153 | encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, | 174 | encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, |
154 | struct kstat *stat) | 175 | struct kstat *stat) |
@@ -169,10 +190,7 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, | |||
169 | p = xdr_encode_hyper(p, ((u64)stat->blocks) << 9); | 190 | p = xdr_encode_hyper(p, ((u64)stat->blocks) << 9); |
170 | *p++ = htonl((u32) MAJOR(stat->rdev)); | 191 | *p++ = htonl((u32) MAJOR(stat->rdev)); |
171 | *p++ = htonl((u32) MINOR(stat->rdev)); | 192 | *p++ = htonl((u32) MINOR(stat->rdev)); |
172 | if (is_fsid(fhp, rqstp->rq_reffh)) | 193 | p = encode_fsid(p, fhp); |
173 | p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid); | ||
174 | else | ||
175 | p = xdr_encode_hyper(p, (u64) huge_encode_dev(stat->dev)); | ||
176 | p = xdr_encode_hyper(p, (u64) stat->ino); | 194 | p = xdr_encode_hyper(p, (u64) stat->ino); |
177 | p = encode_time3(p, &stat->atime); | 195 | p = encode_time3(p, &stat->atime); |
178 | lease_get_mtime(dentry->d_inode, &time); | 196 | lease_get_mtime(dentry->d_inode, &time); |
@@ -203,10 +221,7 @@ encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) | |||
203 | p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9); | 221 | p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9); |
204 | *p++ = fhp->fh_post_rdev[0]; | 222 | *p++ = fhp->fh_post_rdev[0]; |
205 | *p++ = fhp->fh_post_rdev[1]; | 223 | *p++ = fhp->fh_post_rdev[1]; |
206 | if (is_fsid(fhp, rqstp->rq_reffh)) | 224 | p = encode_fsid(p, fhp); |
207 | p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid); | ||
208 | else | ||
209 | p = xdr_encode_hyper(p, (u64)huge_encode_dev(inode->i_sb->s_dev)); | ||
210 | p = xdr_encode_hyper(p, (u64) inode->i_ino); | 225 | p = xdr_encode_hyper(p, (u64) inode->i_ino); |
211 | p = encode_time3(p, &fhp->fh_post_atime); | 226 | p = encode_time3(p, &fhp->fh_post_atime); |
212 | p = encode_time3(p, &fhp->fh_post_mtime); | 227 | p = encode_time3(p, &fhp->fh_post_mtime); |
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index b1902ebaab41..e4a83d727afd 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <linux/sunrpc/cache.h> | 50 | #include <linux/sunrpc/cache.h> |
51 | #include <linux/nfsd_idmap.h> | 51 | #include <linux/nfsd_idmap.h> |
52 | #include <linux/list.h> | 52 | #include <linux/list.h> |
53 | #include <linux/sched.h> | ||
54 | #include <linux/time.h> | 53 | #include <linux/time.h> |
55 | #include <linux/seq_file.h> | 54 | #include <linux/seq_file.h> |
56 | #include <linux/sunrpc/svcauth.h> | 55 | #include <linux/sunrpc/svcauth.h> |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 18aa9440df14..0efba557fb55 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1563,14 +1563,20 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
1563 | if (exp->ex_fslocs.migrated) { | 1563 | if (exp->ex_fslocs.migrated) { |
1564 | WRITE64(NFS4_REFERRAL_FSID_MAJOR); | 1564 | WRITE64(NFS4_REFERRAL_FSID_MAJOR); |
1565 | WRITE64(NFS4_REFERRAL_FSID_MINOR); | 1565 | WRITE64(NFS4_REFERRAL_FSID_MINOR); |
1566 | } else if (is_fsid(fhp, rqstp->rq_reffh)) { | 1566 | } else switch(fsid_source(fhp)) { |
1567 | case FSIDSOURCE_FSID: | ||
1567 | WRITE64((u64)exp->ex_fsid); | 1568 | WRITE64((u64)exp->ex_fsid); |
1568 | WRITE64((u64)0); | 1569 | WRITE64((u64)0); |
1569 | } else { | 1570 | break; |
1571 | case FSIDSOURCE_DEV: | ||
1570 | WRITE32(0); | 1572 | WRITE32(0); |
1571 | WRITE32(MAJOR(stat.dev)); | 1573 | WRITE32(MAJOR(stat.dev)); |
1572 | WRITE32(0); | 1574 | WRITE32(0); |
1573 | WRITE32(MINOR(stat.dev)); | 1575 | WRITE32(MINOR(stat.dev)); |
1576 | break; | ||
1577 | case FSIDSOURCE_UUID: | ||
1578 | WRITEMEM(exp->ex_uuid, 16); | ||
1579 | break; | ||
1574 | } | 1580 | } |
1575 | } | 1581 | } |
1576 | if (bmval0 & FATTR4_WORD0_UNIQUE_HANDLES) { | 1582 | if (bmval0 & FATTR4_WORD0_UNIQUE_HANDLES) { |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index eedf2e3990a9..71c686dc7257 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -123,7 +123,7 @@ static ssize_t nfsctl_transaction_write(struct file *file, const char __user *bu | |||
123 | return PTR_ERR(data); | 123 | return PTR_ERR(data); |
124 | 124 | ||
125 | rv = write_op[ino](file, data, size); | 125 | rv = write_op[ino](file, data, size); |
126 | if (rv>0) { | 126 | if (rv >= 0) { |
127 | simple_transaction_set(file, rv); | 127 | simple_transaction_set(file, rv); |
128 | rv = size; | 128 | rv = size; |
129 | } | 129 | } |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index a0b4282cb284..c2660cbfcd96 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * ... and again Southern-Winter 2001 to support export_operations | 9 | * ... and again Southern-Winter 2001 to support export_operations |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
14 | #include <linux/smp_lock.h> | 13 | #include <linux/smp_lock.h> |
15 | #include <linux/fs.h> | 14 | #include <linux/fs.h> |
@@ -119,9 +118,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
119 | 118 | ||
120 | dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp)); | 119 | dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp)); |
121 | 120 | ||
122 | /* keep this filehandle for possible reference when encoding attributes */ | ||
123 | rqstp->rq_reffh = fh; | ||
124 | |||
125 | if (!fhp->fh_dentry) { | 121 | if (!fhp->fh_dentry) { |
126 | __u32 *datap=NULL; | 122 | __u32 *datap=NULL; |
127 | __u32 tfh[3]; /* filehandle fragment for oldstyle filehandles */ | 123 | __u32 tfh[3]; /* filehandle fragment for oldstyle filehandles */ |
@@ -146,10 +142,10 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
146 | } | 142 | } |
147 | len = key_len(fh->fh_fsid_type) / 4; | 143 | len = key_len(fh->fh_fsid_type) / 4; |
148 | if (len == 0) goto out; | 144 | if (len == 0) goto out; |
149 | if (fh->fh_fsid_type == 2) { | 145 | if (fh->fh_fsid_type == FSID_MAJOR_MINOR) { |
150 | /* deprecated, convert to type 3 */ | 146 | /* deprecated, convert to type 3 */ |
151 | len = 3; | 147 | len = key_len(FSID_ENCODE_DEV)/4; |
152 | fh->fh_fsid_type = 3; | 148 | fh->fh_fsid_type = FSID_ENCODE_DEV; |
153 | fh->fh_fsid[0] = new_encode_dev(MKDEV(ntohl(fh->fh_fsid[0]), ntohl(fh->fh_fsid[1]))); | 149 | fh->fh_fsid[0] = new_encode_dev(MKDEV(ntohl(fh->fh_fsid[0]), ntohl(fh->fh_fsid[1]))); |
154 | fh->fh_fsid[1] = fh->fh_fsid[2]; | 150 | fh->fh_fsid[1] = fh->fh_fsid[2]; |
155 | } | 151 | } |
@@ -164,8 +160,9 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
164 | /* assume old filehandle format */ | 160 | /* assume old filehandle format */ |
165 | xdev = old_decode_dev(fh->ofh_xdev); | 161 | xdev = old_decode_dev(fh->ofh_xdev); |
166 | xino = u32_to_ino_t(fh->ofh_xino); | 162 | xino = u32_to_ino_t(fh->ofh_xino); |
167 | mk_fsid_v0(tfh, xdev, xino); | 163 | mk_fsid(FSID_DEV, tfh, xdev, xino, 0, NULL); |
168 | exp = exp_find(rqstp->rq_client, 0, tfh, &rqstp->rq_chandle); | 164 | exp = exp_find(rqstp->rq_client, FSID_DEV, tfh, |
165 | &rqstp->rq_chandle); | ||
169 | } | 166 | } |
170 | 167 | ||
171 | if (IS_ERR(exp) && (PTR_ERR(exp) == -EAGAIN | 168 | if (IS_ERR(exp) && (PTR_ERR(exp) == -EAGAIN |
@@ -212,7 +209,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
212 | fileid_type = 2; | 209 | fileid_type = 2; |
213 | } else | 210 | } else |
214 | fileid_type = fh->fh_fileid_type; | 211 | fileid_type = fh->fh_fileid_type; |
215 | 212 | ||
216 | if (fileid_type == 0) | 213 | if (fileid_type == 0) |
217 | dentry = dget(exp->ex_dentry); | 214 | dentry = dget(exp->ex_dentry); |
218 | else { | 215 | else { |
@@ -292,7 +289,7 @@ static inline int _fh_update(struct dentry *dentry, struct svc_export *exp, | |||
292 | __u32 *datap, int *maxsize) | 289 | __u32 *datap, int *maxsize) |
293 | { | 290 | { |
294 | struct export_operations *nop = exp->ex_mnt->mnt_sb->s_export_op; | 291 | struct export_operations *nop = exp->ex_mnt->mnt_sb->s_export_op; |
295 | 292 | ||
296 | if (dentry == exp->ex_dentry) { | 293 | if (dentry == exp->ex_dentry) { |
297 | *maxsize = 0; | 294 | *maxsize = 0; |
298 | return 0; | 295 | return 0; |
@@ -317,7 +314,8 @@ static inline void _fh_update_old(struct dentry *dentry, | |||
317 | } | 314 | } |
318 | 315 | ||
319 | __be32 | 316 | __be32 |
320 | fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) | 317 | fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, |
318 | struct svc_fh *ref_fh) | ||
321 | { | 319 | { |
322 | /* ref_fh is a reference file handle. | 320 | /* ref_fh is a reference file handle. |
323 | * if it is non-null and for the same filesystem, then we should compose | 321 | * if it is non-null and for the same filesystem, then we should compose |
@@ -327,12 +325,13 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st | |||
327 | * | 325 | * |
328 | */ | 326 | */ |
329 | 327 | ||
330 | u8 ref_fh_version = 0; | 328 | u8 version = 1; |
331 | u8 ref_fh_fsid_type = 0; | 329 | u8 fsid_type = 0; |
332 | struct inode * inode = dentry->d_inode; | 330 | struct inode * inode = dentry->d_inode; |
333 | struct dentry *parent = dentry->d_parent; | 331 | struct dentry *parent = dentry->d_parent; |
334 | __u32 *datap; | 332 | __u32 *datap; |
335 | dev_t ex_dev = exp->ex_dentry->d_inode->i_sb->s_dev; | 333 | dev_t ex_dev = exp->ex_dentry->d_inode->i_sb->s_dev; |
334 | int root_export = (exp->ex_dentry == exp->ex_dentry->d_sb->s_root); | ||
336 | 335 | ||
337 | dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n", | 336 | dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n", |
338 | MAJOR(ex_dev), MINOR(ex_dev), | 337 | MAJOR(ex_dev), MINOR(ex_dev), |
@@ -340,57 +339,64 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st | |||
340 | parent->d_name.name, dentry->d_name.name, | 339 | parent->d_name.name, dentry->d_name.name, |
341 | (inode ? inode->i_ino : 0)); | 340 | (inode ? inode->i_ino : 0)); |
342 | 341 | ||
342 | /* Choose filehandle version and fsid type based on | ||
343 | * the reference filehandle (if it is in the same export) | ||
344 | * or the export options. | ||
345 | */ | ||
343 | if (ref_fh && ref_fh->fh_export == exp) { | 346 | if (ref_fh && ref_fh->fh_export == exp) { |
344 | ref_fh_version = ref_fh->fh_handle.fh_version; | 347 | version = ref_fh->fh_handle.fh_version; |
345 | if (ref_fh_version == 0xca) | 348 | if (version == 0xca) |
346 | ref_fh_fsid_type = 0; | 349 | fsid_type = FSID_DEV; |
347 | else | 350 | else |
348 | ref_fh_fsid_type = ref_fh->fh_handle.fh_fsid_type; | 351 | fsid_type = ref_fh->fh_handle.fh_fsid_type; |
349 | if (ref_fh_fsid_type > 3) | 352 | /* We know this version/type works for this export |
350 | ref_fh_fsid_type = 0; | 353 | * so there is no need for further checks. |
351 | 354 | */ | |
352 | /* make sure ref_fh type works for given export */ | 355 | } else if (exp->ex_uuid) { |
353 | if (ref_fh_fsid_type == 1 && | 356 | if (fhp->fh_maxsize >= 64) { |
354 | !(exp->ex_flags & NFSEXP_FSID)) { | 357 | if (root_export) |
355 | /* if we don't have an fsid, we cannot provide one... */ | 358 | fsid_type = FSID_UUID16; |
356 | ref_fh_fsid_type = 0; | 359 | else |
360 | fsid_type = FSID_UUID16_INUM; | ||
361 | } else { | ||
362 | if (root_export) | ||
363 | fsid_type = FSID_UUID8; | ||
364 | else | ||
365 | fsid_type = FSID_UUID4_INUM; | ||
357 | } | 366 | } |
358 | } else if (exp->ex_flags & NFSEXP_FSID) | 367 | } else if (exp->ex_flags & NFSEXP_FSID) |
359 | ref_fh_fsid_type = 1; | 368 | fsid_type = FSID_NUM; |
360 | 369 | else if (!old_valid_dev(ex_dev)) | |
361 | if (!old_valid_dev(ex_dev) && ref_fh_fsid_type == 0) { | ||
362 | /* for newer device numbers, we must use a newer fsid format */ | 370 | /* for newer device numbers, we must use a newer fsid format */ |
363 | ref_fh_version = 1; | 371 | fsid_type = FSID_ENCODE_DEV; |
364 | ref_fh_fsid_type = 3; | 372 | else |
365 | } | 373 | fsid_type = FSID_DEV; |
366 | if (old_valid_dev(ex_dev) && | ||
367 | (ref_fh_fsid_type == 2 || ref_fh_fsid_type == 3)) | ||
368 | /* must use type1 for smaller device numbers */ | ||
369 | ref_fh_fsid_type = 0; | ||
370 | 374 | ||
371 | if (ref_fh == fhp) | 375 | if (ref_fh == fhp) |
372 | fh_put(ref_fh); | 376 | fh_put(ref_fh); |
373 | 377 | ||
374 | if (fhp->fh_locked || fhp->fh_dentry) { | 378 | if (fhp->fh_locked || fhp->fh_dentry) { |
375 | printk(KERN_ERR "fh_compose: fh %s/%s not initialized!\n", | 379 | printk(KERN_ERR "fh_compose: fh %s/%s not initialized!\n", |
376 | parent->d_name.name, dentry->d_name.name); | 380 | parent->d_name.name, dentry->d_name.name); |
377 | } | 381 | } |
378 | if (fhp->fh_maxsize < NFS_FHSIZE) | 382 | if (fhp->fh_maxsize < NFS_FHSIZE) |
379 | printk(KERN_ERR "fh_compose: called with maxsize %d! %s/%s\n", | 383 | printk(KERN_ERR "fh_compose: called with maxsize %d! %s/%s\n", |
380 | fhp->fh_maxsize, parent->d_name.name, dentry->d_name.name); | 384 | fhp->fh_maxsize, |
385 | parent->d_name.name, dentry->d_name.name); | ||
381 | 386 | ||
382 | fhp->fh_dentry = dget(dentry); /* our internal copy */ | 387 | fhp->fh_dentry = dget(dentry); /* our internal copy */ |
383 | fhp->fh_export = exp; | 388 | fhp->fh_export = exp; |
384 | cache_get(&exp->h); | 389 | cache_get(&exp->h); |
385 | 390 | ||
386 | if (ref_fh_version == 0xca) { | 391 | if (version == 0xca) { |
387 | /* old style filehandle please */ | 392 | /* old style filehandle please */ |
388 | memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE); | 393 | memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE); |
389 | fhp->fh_handle.fh_size = NFS_FHSIZE; | 394 | fhp->fh_handle.fh_size = NFS_FHSIZE; |
390 | fhp->fh_handle.ofh_dcookie = 0xfeebbaca; | 395 | fhp->fh_handle.ofh_dcookie = 0xfeebbaca; |
391 | fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); | 396 | fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); |
392 | fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; | 397 | fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; |
393 | fhp->fh_handle.ofh_xino = ino_t_to_u32(exp->ex_dentry->d_inode->i_ino); | 398 | fhp->fh_handle.ofh_xino = |
399 | ino_t_to_u32(exp->ex_dentry->d_inode->i_ino); | ||
394 | fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); | 400 | fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); |
395 | if (inode) | 401 | if (inode) |
396 | _fh_update_old(dentry, exp, &fhp->fh_handle); | 402 | _fh_update_old(dentry, exp, &fhp->fh_handle); |
@@ -399,38 +405,12 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st | |||
399 | fhp->fh_handle.fh_version = 1; | 405 | fhp->fh_handle.fh_version = 1; |
400 | fhp->fh_handle.fh_auth_type = 0; | 406 | fhp->fh_handle.fh_auth_type = 0; |
401 | datap = fhp->fh_handle.fh_auth+0; | 407 | datap = fhp->fh_handle.fh_auth+0; |
402 | fhp->fh_handle.fh_fsid_type = ref_fh_fsid_type; | 408 | fhp->fh_handle.fh_fsid_type = fsid_type; |
403 | switch (ref_fh_fsid_type) { | 409 | mk_fsid(fsid_type, datap, ex_dev, |
404 | case 0: | 410 | exp->ex_dentry->d_inode->i_ino, |
405 | /* | 411 | exp->ex_fsid, exp->ex_uuid); |
406 | * fsid_type 0: | 412 | |
407 | * 2byte major, 2byte minor, 4byte inode | 413 | len = key_len(fsid_type); |
408 | */ | ||
409 | mk_fsid_v0(datap, ex_dev, | ||
410 | exp->ex_dentry->d_inode->i_ino); | ||
411 | break; | ||
412 | case 1: | ||
413 | /* fsid_type 1 == 4 bytes filesystem id */ | ||
414 | mk_fsid_v1(datap, exp->ex_fsid); | ||
415 | break; | ||
416 | case 2: | ||
417 | /* | ||
418 | * fsid_type 2: | ||
419 | * 4byte major, 4byte minor, 4byte inode | ||
420 | */ | ||
421 | mk_fsid_v2(datap, ex_dev, | ||
422 | exp->ex_dentry->d_inode->i_ino); | ||
423 | break; | ||
424 | case 3: | ||
425 | /* | ||
426 | * fsid_type 3: | ||
427 | * 4byte devicenumber, 4byte inode | ||
428 | */ | ||
429 | mk_fsid_v3(datap, ex_dev, | ||
430 | exp->ex_dentry->d_inode->i_ino); | ||
431 | break; | ||
432 | } | ||
433 | len = key_len(ref_fh_fsid_type); | ||
434 | datap += len/4; | 414 | datap += len/4; |
435 | fhp->fh_handle.fh_size = 4 + len; | 415 | fhp->fh_handle.fh_size = 4 + len; |
436 | 416 | ||
@@ -457,7 +437,7 @@ fh_update(struct svc_fh *fhp) | |||
457 | { | 437 | { |
458 | struct dentry *dentry; | 438 | struct dentry *dentry; |
459 | __u32 *datap; | 439 | __u32 *datap; |
460 | 440 | ||
461 | if (!fhp->fh_dentry) | 441 | if (!fhp->fh_dentry) |
462 | goto out_bad; | 442 | goto out_bad; |
463 | 443 | ||
@@ -534,3 +514,22 @@ char * SVCFH_fmt(struct svc_fh *fhp) | |||
534 | fh->fh_base.fh_pad[5]); | 514 | fh->fh_base.fh_pad[5]); |
535 | return buf; | 515 | return buf; |
536 | } | 516 | } |
517 | |||
518 | enum fsid_source fsid_source(struct svc_fh *fhp) | ||
519 | { | ||
520 | if (fhp->fh_handle.fh_version != 1) | ||
521 | return FSIDSOURCE_DEV; | ||
522 | switch(fhp->fh_handle.fh_fsid_type) { | ||
523 | case FSID_DEV: | ||
524 | case FSID_ENCODE_DEV: | ||
525 | case FSID_MAJOR_MINOR: | ||
526 | return FSIDSOURCE_DEV; | ||
527 | case FSID_NUM: | ||
528 | return FSIDSOURCE_FSID; | ||
529 | default: | ||
530 | if (fhp->fh_export->ex_flags & NFSEXP_FSID) | ||
531 | return FSIDSOURCE_FSID; | ||
532 | else | ||
533 | return FSIDSOURCE_UUID; | ||
534 | } | ||
535 | } | ||
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index 6555c50d9006..0c24b9e24fe8 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c | |||
@@ -153,6 +153,7 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, | |||
153 | struct dentry *dentry = fhp->fh_dentry; | 153 | struct dentry *dentry = fhp->fh_dentry; |
154 | int type; | 154 | int type; |
155 | struct timespec time; | 155 | struct timespec time; |
156 | u32 f; | ||
156 | 157 | ||
157 | type = (stat->mode & S_IFMT); | 158 | type = (stat->mode & S_IFMT); |
158 | 159 | ||
@@ -173,10 +174,22 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, | |||
173 | else | 174 | else |
174 | *p++ = htonl(0xffffffff); | 175 | *p++ = htonl(0xffffffff); |
175 | *p++ = htonl((u32) stat->blocks); | 176 | *p++ = htonl((u32) stat->blocks); |
176 | if (is_fsid(fhp, rqstp->rq_reffh)) | 177 | switch (fsid_source(fhp)) { |
177 | *p++ = htonl((u32) fhp->fh_export->ex_fsid); | 178 | default: |
178 | else | 179 | case FSIDSOURCE_DEV: |
179 | *p++ = htonl(new_encode_dev(stat->dev)); | 180 | *p++ = htonl(new_encode_dev(stat->dev)); |
181 | break; | ||
182 | case FSIDSOURCE_FSID: | ||
183 | *p++ = htonl((u32) fhp->fh_export->ex_fsid); | ||
184 | break; | ||
185 | case FSIDSOURCE_UUID: | ||
186 | f = ((u32*)fhp->fh_export->ex_uuid)[0]; | ||
187 | f ^= ((u32*)fhp->fh_export->ex_uuid)[1]; | ||
188 | f ^= ((u32*)fhp->fh_export->ex_uuid)[2]; | ||
189 | f ^= ((u32*)fhp->fh_export->ex_uuid)[3]; | ||
190 | *p++ = htonl(f); | ||
191 | break; | ||
192 | } | ||
180 | *p++ = htonl((u32) stat->ino); | 193 | *p++ = htonl((u32) stat->ino); |
181 | *p++ = htonl((u32) stat->atime.tv_sec); | 194 | *p++ = htonl((u32) stat->atime.tv_sec); |
182 | *p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0); | 195 | *p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0); |
diff --git a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c index 1c23138d00b3..4847fbfb0107 100644 --- a/fs/ntfs/sysctl.c +++ b/fs/ntfs/sysctl.c | |||
@@ -33,20 +33,28 @@ | |||
33 | #include "sysctl.h" | 33 | #include "sysctl.h" |
34 | #include "debug.h" | 34 | #include "debug.h" |
35 | 35 | ||
36 | #define FS_NTFS 1 | ||
37 | |||
38 | /* Definition of the ntfs sysctl. */ | 36 | /* Definition of the ntfs sysctl. */ |
39 | static ctl_table ntfs_sysctls[] = { | 37 | static ctl_table ntfs_sysctls[] = { |
40 | { FS_NTFS, "ntfs-debug", /* Binary and text IDs. */ | 38 | { |
41 | &debug_msgs,sizeof(debug_msgs), /* Data pointer and size. */ | 39 | .ctl_name = CTL_UNNUMBERED, /* Binary and text IDs. */ |
42 | 0644, NULL, &proc_dointvec }, /* Mode, child, proc handler. */ | 40 | .procname = "ntfs-debug", |
43 | { 0 } | 41 | .data = &debug_msgs, /* Data pointer and size. */ |
42 | .maxlen = sizeof(debug_msgs), | ||
43 | .mode = 0644, /* Mode, proc handler. */ | ||
44 | .proc_handler = &proc_dointvec | ||
45 | }, | ||
46 | {} | ||
44 | }; | 47 | }; |
45 | 48 | ||
46 | /* Define the parent directory /proc/sys/fs. */ | 49 | /* Define the parent directory /proc/sys/fs. */ |
47 | static ctl_table sysctls_root[] = { | 50 | static ctl_table sysctls_root[] = { |
48 | { CTL_FS, "fs", NULL, 0, 0555, ntfs_sysctls }, | 51 | { |
49 | { 0 } | 52 | .ctl_name = CTL_FS, |
53 | .procname = "fs", | ||
54 | .mode = 0555, | ||
55 | .child = ntfs_sysctls | ||
56 | }, | ||
57 | {} | ||
50 | }; | 58 | }; |
51 | 59 | ||
52 | /* Storage for the sysctls header. */ | 60 | /* Storage for the sysctls header. */ |
@@ -62,17 +70,9 @@ int ntfs_sysctl(int add) | |||
62 | { | 70 | { |
63 | if (add) { | 71 | if (add) { |
64 | BUG_ON(sysctls_root_table); | 72 | BUG_ON(sysctls_root_table); |
65 | sysctls_root_table = register_sysctl_table(sysctls_root, 0); | 73 | sysctls_root_table = register_sysctl_table(sysctls_root); |
66 | if (!sysctls_root_table) | 74 | if (!sysctls_root_table) |
67 | return -ENOMEM; | 75 | return -ENOMEM; |
68 | #ifdef CONFIG_PROC_FS | ||
69 | /* | ||
70 | * If the proc filesystem is in use and we are a module, need | ||
71 | * to set the owner of our proc entry to our module. In the | ||
72 | * non-modular case, THIS_MODULE is NULL, so this is ok. | ||
73 | */ | ||
74 | ntfs_sysctls[0].de->owner = THIS_MODULE; | ||
75 | #endif | ||
76 | } else { | 76 | } else { |
77 | BUG_ON(!sysctls_root_table); | 77 | BUG_ON(!sysctls_root_table); |
78 | unregister_sysctl_table(sysctls_root_table); | 78 | unregister_sysctl_table(sysctls_root_table); |
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index b17333a0606b..9f5ad0f01ce0 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c | |||
@@ -55,7 +55,7 @@ static ctl_table ocfs2_nm_table[] = { | |||
55 | 55 | ||
56 | static ctl_table ocfs2_mod_table[] = { | 56 | static ctl_table ocfs2_mod_table[] = { |
57 | { | 57 | { |
58 | .ctl_name = KERN_OCFS2_NM, | 58 | .ctl_name = FS_OCFS2_NM, |
59 | .procname = "nm", | 59 | .procname = "nm", |
60 | .data = NULL, | 60 | .data = NULL, |
61 | .maxlen = 0, | 61 | .maxlen = 0, |
@@ -67,7 +67,7 @@ static ctl_table ocfs2_mod_table[] = { | |||
67 | 67 | ||
68 | static ctl_table ocfs2_kern_table[] = { | 68 | static ctl_table ocfs2_kern_table[] = { |
69 | { | 69 | { |
70 | .ctl_name = KERN_OCFS2, | 70 | .ctl_name = FS_OCFS2, |
71 | .procname = "ocfs2", | 71 | .procname = "ocfs2", |
72 | .data = NULL, | 72 | .data = NULL, |
73 | .maxlen = 0, | 73 | .maxlen = 0, |
@@ -922,7 +922,7 @@ static int __init init_o2nm(void) | |||
922 | o2hb_init(); | 922 | o2hb_init(); |
923 | o2net_init(); | 923 | o2net_init(); |
924 | 924 | ||
925 | ocfs2_table_header = register_sysctl_table(ocfs2_root_table, 0); | 925 | ocfs2_table_header = register_sysctl_table(ocfs2_root_table); |
926 | if (!ocfs2_table_header) { | 926 | if (!ocfs2_table_header) { |
927 | printk(KERN_ERR "nodemanager: unable to register sysctl\n"); | 927 | printk(KERN_ERR "nodemanager: unable to register sysctl\n"); |
928 | ret = -ENOMEM; /* or something. */ | 928 | ret = -ENOMEM; /* or something. */ |
diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h index 8fb23cacc2f5..070522138ae2 100644 --- a/fs/ocfs2/cluster/nodemanager.h +++ b/fs/ocfs2/cluster/nodemanager.h | |||
@@ -33,8 +33,7 @@ | |||
33 | #include <linux/configfs.h> | 33 | #include <linux/configfs.h> |
34 | #include <linux/rbtree.h> | 34 | #include <linux/rbtree.h> |
35 | 35 | ||
36 | #define KERN_OCFS2 988 | 36 | #define FS_OCFS2_NM 1 |
37 | #define KERN_OCFS2_NM 1 | ||
38 | 37 | ||
39 | const char *o2nm_get_hb_ctl_path(void); | 38 | const char *o2nm_get_hb_ctl_path(void); |
40 | 39 | ||
diff --git a/fs/proc/Makefile b/fs/proc/Makefile index f6c776272572..a6b3a8f878f0 100644 --- a/fs/proc/Makefile +++ b/fs/proc/Makefile | |||
@@ -8,7 +8,7 @@ proc-y := nommu.o task_nommu.o | |||
8 | proc-$(CONFIG_MMU) := mmu.o task_mmu.o | 8 | proc-$(CONFIG_MMU) := mmu.o task_mmu.o |
9 | 9 | ||
10 | proc-y += inode.o root.o base.o generic.o array.o \ | 10 | proc-y += inode.o root.o base.o generic.o array.o \ |
11 | proc_tty.o proc_misc.o | 11 | proc_tty.o proc_misc.o proc_sysctl.o |
12 | 12 | ||
13 | proc-$(CONFIG_PROC_KCORE) += kcore.o | 13 | proc-$(CONFIG_PROC_KCORE) += kcore.o |
14 | proc-$(CONFIG_PROC_VMCORE) += vmcore.o | 14 | proc-$(CONFIG_PROC_VMCORE) += vmcore.o |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 0cdc00d9d97e..775fb21294d8 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -32,7 +32,7 @@ static loff_t proc_file_lseek(struct file *, loff_t, int); | |||
32 | 32 | ||
33 | DEFINE_SPINLOCK(proc_subdir_lock); | 33 | DEFINE_SPINLOCK(proc_subdir_lock); |
34 | 34 | ||
35 | int proc_match(int len, const char *name, struct proc_dir_entry *de) | 35 | static int proc_match(int len, const char *name, struct proc_dir_entry *de) |
36 | { | 36 | { |
37 | if (de->namelen != len) | 37 | if (de->namelen != len) |
38 | return 0; | 38 | return 0; |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index f6722be37dde..c372eb151a3a 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -161,6 +161,7 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, | |||
161 | if (!inode) | 161 | if (!inode) |
162 | goto out_ino; | 162 | goto out_ino; |
163 | 163 | ||
164 | PROC_I(inode)->fd = 0; | ||
164 | PROC_I(inode)->pde = de; | 165 | PROC_I(inode)->pde = de; |
165 | if (de) { | 166 | if (de) { |
166 | if (de->mode) { | 167 | if (de->mode) { |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 277dcd66ebe2..c932aa65e198 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
@@ -11,6 +11,8 @@ | |||
11 | 11 | ||
12 | #include <linux/proc_fs.h> | 12 | #include <linux/proc_fs.h> |
13 | 13 | ||
14 | extern int proc_sys_init(void); | ||
15 | |||
14 | struct vmalloc_info { | 16 | struct vmalloc_info { |
15 | unsigned long used; | 17 | unsigned long used; |
16 | unsigned long largest_chunk; | 18 | unsigned long largest_chunk; |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c new file mode 100644 index 000000000000..20e8cbb34364 --- /dev/null +++ b/fs/proc/proc_sysctl.c | |||
@@ -0,0 +1,479 @@ | |||
1 | /* | ||
2 | * /proc/sys support | ||
3 | */ | ||
4 | |||
5 | #include <linux/sysctl.h> | ||
6 | #include <linux/proc_fs.h> | ||
7 | #include <linux/security.h> | ||
8 | #include "internal.h" | ||
9 | |||
10 | static struct dentry_operations proc_sys_dentry_operations; | ||
11 | static const struct file_operations proc_sys_file_operations; | ||
12 | static struct inode_operations proc_sys_inode_operations; | ||
13 | |||
14 | static void proc_sys_refresh_inode(struct inode *inode, struct ctl_table *table) | ||
15 | { | ||
16 | /* Refresh the cached information bits in the inode */ | ||
17 | if (table) { | ||
18 | inode->i_uid = 0; | ||
19 | inode->i_gid = 0; | ||
20 | inode->i_mode = table->mode; | ||
21 | if (table->proc_handler) { | ||
22 | inode->i_mode |= S_IFREG; | ||
23 | inode->i_nlink = 1; | ||
24 | } else { | ||
25 | inode->i_mode |= S_IFDIR; | ||
26 | inode->i_nlink = 0; /* It is too hard to figure out */ | ||
27 | } | ||
28 | } | ||
29 | } | ||
30 | |||
31 | static struct inode *proc_sys_make_inode(struct inode *dir, struct ctl_table *table) | ||
32 | { | ||
33 | struct inode *inode; | ||
34 | struct proc_inode *dir_ei, *ei; | ||
35 | int depth; | ||
36 | |||
37 | inode = new_inode(dir->i_sb); | ||
38 | if (!inode) | ||
39 | goto out; | ||
40 | |||
41 | /* A directory is always one deeper than it's parent */ | ||
42 | dir_ei = PROC_I(dir); | ||
43 | depth = dir_ei->fd + 1; | ||
44 | |||
45 | ei = PROC_I(inode); | ||
46 | ei->fd = depth; | ||
47 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | ||
48 | inode->i_op = &proc_sys_inode_operations; | ||
49 | inode->i_fop = &proc_sys_file_operations; | ||
50 | inode->i_flags |= S_PRIVATE; /* tell selinux to ignore this inode */ | ||
51 | proc_sys_refresh_inode(inode, table); | ||
52 | out: | ||
53 | return inode; | ||
54 | } | ||
55 | |||
56 | static struct dentry *proc_sys_ancestor(struct dentry *dentry, int depth) | ||
57 | { | ||
58 | for (;;) { | ||
59 | struct proc_inode *ei; | ||
60 | |||
61 | ei = PROC_I(dentry->d_inode); | ||
62 | if (ei->fd == depth) | ||
63 | break; /* found */ | ||
64 | |||
65 | dentry = dentry->d_parent; | ||
66 | } | ||
67 | return dentry; | ||
68 | } | ||
69 | |||
70 | static struct ctl_table *proc_sys_lookup_table_one(struct ctl_table *table, | ||
71 | struct qstr *name) | ||
72 | { | ||
73 | int len; | ||
74 | for ( ; table->ctl_name || table->procname; table++) { | ||
75 | |||
76 | if (!table->procname) | ||
77 | continue; | ||
78 | |||
79 | len = strlen(table->procname); | ||
80 | if (len != name->len) | ||
81 | continue; | ||
82 | |||
83 | if (memcmp(table->procname, name->name, len) != 0) | ||
84 | continue; | ||
85 | |||
86 | /* I have a match */ | ||
87 | return table; | ||
88 | } | ||
89 | return NULL; | ||
90 | } | ||
91 | |||
92 | static struct ctl_table *proc_sys_lookup_table(struct dentry *dentry, | ||
93 | struct ctl_table *table) | ||
94 | { | ||
95 | struct dentry *ancestor; | ||
96 | struct proc_inode *ei; | ||
97 | int depth, i; | ||
98 | |||
99 | ei = PROC_I(dentry->d_inode); | ||
100 | depth = ei->fd; | ||
101 | |||
102 | if (depth == 0) | ||
103 | return table; | ||
104 | |||
105 | for (i = 1; table && (i <= depth); i++) { | ||
106 | ancestor = proc_sys_ancestor(dentry, i); | ||
107 | table = proc_sys_lookup_table_one(table, &ancestor->d_name); | ||
108 | if (table) | ||
109 | table = table->child; | ||
110 | } | ||
111 | return table; | ||
112 | |||
113 | } | ||
114 | static struct ctl_table *proc_sys_lookup_entry(struct dentry *dparent, | ||
115 | struct qstr *name, | ||
116 | struct ctl_table *table) | ||
117 | { | ||
118 | table = proc_sys_lookup_table(dparent, table); | ||
119 | if (table) | ||
120 | table = proc_sys_lookup_table_one(table, name); | ||
121 | return table; | ||
122 | } | ||
123 | |||
124 | static struct ctl_table *do_proc_sys_lookup(struct dentry *parent, | ||
125 | struct qstr *name, | ||
126 | struct ctl_table_header **ptr) | ||
127 | { | ||
128 | struct ctl_table_header *head; | ||
129 | struct ctl_table *table = NULL; | ||
130 | |||
131 | for (head = sysctl_head_next(NULL); head; | ||
132 | head = sysctl_head_next(head)) { | ||
133 | table = proc_sys_lookup_entry(parent, name, head->ctl_table); | ||
134 | if (table) | ||
135 | break; | ||
136 | } | ||
137 | *ptr = head; | ||
138 | return table; | ||
139 | } | ||
140 | |||
141 | static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, | ||
142 | struct nameidata *nd) | ||
143 | { | ||
144 | struct ctl_table_header *head; | ||
145 | struct inode *inode; | ||
146 | struct dentry *err; | ||
147 | struct ctl_table *table; | ||
148 | |||
149 | err = ERR_PTR(-ENOENT); | ||
150 | table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); | ||
151 | if (!table) | ||
152 | goto out; | ||
153 | |||
154 | err = ERR_PTR(-ENOMEM); | ||
155 | inode = proc_sys_make_inode(dir, table); | ||
156 | if (!inode) | ||
157 | goto out; | ||
158 | |||
159 | err = NULL; | ||
160 | dentry->d_op = &proc_sys_dentry_operations; | ||
161 | d_add(dentry, inode); | ||
162 | |||
163 | out: | ||
164 | sysctl_head_finish(head); | ||
165 | return err; | ||
166 | } | ||
167 | |||
168 | static ssize_t proc_sys_read(struct file *filp, char __user *buf, | ||
169 | size_t count, loff_t *ppos) | ||
170 | { | ||
171 | struct dentry *dentry = filp->f_dentry; | ||
172 | struct ctl_table_header *head; | ||
173 | struct ctl_table *table; | ||
174 | ssize_t error, res; | ||
175 | |||
176 | table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); | ||
177 | /* Has the sysctl entry disappeared on us? */ | ||
178 | error = -ENOENT; | ||
179 | if (!table) | ||
180 | goto out; | ||
181 | |||
182 | /* Has the sysctl entry been replaced by a directory? */ | ||
183 | error = -EISDIR; | ||
184 | if (!table->proc_handler) | ||
185 | goto out; | ||
186 | |||
187 | /* | ||
188 | * At this point we know that the sysctl was not unregistered | ||
189 | * and won't be until we finish. | ||
190 | */ | ||
191 | error = -EPERM; | ||
192 | if (sysctl_perm(table, MAY_READ)) | ||
193 | goto out; | ||
194 | |||
195 | /* careful: calling conventions are nasty here */ | ||
196 | res = count; | ||
197 | error = table->proc_handler(table, 0, filp, buf, &res, ppos); | ||
198 | if (!error) | ||
199 | error = res; | ||
200 | out: | ||
201 | sysctl_head_finish(head); | ||
202 | |||
203 | return error; | ||
204 | } | ||
205 | |||
206 | static ssize_t proc_sys_write(struct file *filp, const char __user *buf, | ||
207 | size_t count, loff_t *ppos) | ||
208 | { | ||
209 | struct dentry *dentry = filp->f_dentry; | ||
210 | struct ctl_table_header *head; | ||
211 | struct ctl_table *table; | ||
212 | ssize_t error, res; | ||
213 | |||
214 | table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); | ||
215 | /* Has the sysctl entry disappeared on us? */ | ||
216 | error = -ENOENT; | ||
217 | if (!table) | ||
218 | goto out; | ||
219 | |||
220 | /* Has the sysctl entry been replaced by a directory? */ | ||
221 | error = -EISDIR; | ||
222 | if (!table->proc_handler) | ||
223 | goto out; | ||
224 | |||
225 | /* | ||
226 | * At this point we know that the sysctl was not unregistered | ||
227 | * and won't be until we finish. | ||
228 | */ | ||
229 | error = -EPERM; | ||
230 | if (sysctl_perm(table, MAY_WRITE)) | ||
231 | goto out; | ||
232 | |||
233 | /* careful: calling conventions are nasty here */ | ||
234 | res = count; | ||
235 | error = table->proc_handler(table, 1, filp, (char __user *)buf, | ||
236 | &res, ppos); | ||
237 | if (!error) | ||
238 | error = res; | ||
239 | out: | ||
240 | sysctl_head_finish(head); | ||
241 | |||
242 | return error; | ||
243 | } | ||
244 | |||
245 | |||
246 | static int proc_sys_fill_cache(struct file *filp, void *dirent, | ||
247 | filldir_t filldir, struct ctl_table *table) | ||
248 | { | ||
249 | struct ctl_table_header *head; | ||
250 | struct ctl_table *child_table = NULL; | ||
251 | struct dentry *child, *dir = filp->f_path.dentry; | ||
252 | struct inode *inode; | ||
253 | struct qstr qname; | ||
254 | ino_t ino = 0; | ||
255 | unsigned type = DT_UNKNOWN; | ||
256 | int ret; | ||
257 | |||
258 | qname.name = table->procname; | ||
259 | qname.len = strlen(table->procname); | ||
260 | qname.hash = full_name_hash(qname.name, qname.len); | ||
261 | |||
262 | /* Suppress duplicates. | ||
263 | * Only fill a directory entry if it is the value that | ||
264 | * an ordinary lookup of that name returns. Hide all | ||
265 | * others. | ||
266 | * | ||
267 | * If we ever cache this translation in the dcache | ||
268 | * I should do a dcache lookup first. But for now | ||
269 | * it is just simpler not to. | ||
270 | */ | ||
271 | ret = 0; | ||
272 | child_table = do_proc_sys_lookup(dir, &qname, &head); | ||
273 | sysctl_head_finish(head); | ||
274 | if (child_table != table) | ||
275 | return 0; | ||
276 | |||
277 | child = d_lookup(dir, &qname); | ||
278 | if (!child) { | ||
279 | struct dentry *new; | ||
280 | new = d_alloc(dir, &qname); | ||
281 | if (new) { | ||
282 | inode = proc_sys_make_inode(dir->d_inode, table); | ||
283 | if (!inode) | ||
284 | child = ERR_PTR(-ENOMEM); | ||
285 | else { | ||
286 | new->d_op = &proc_sys_dentry_operations; | ||
287 | d_add(new, inode); | ||
288 | } | ||
289 | if (child) | ||
290 | dput(new); | ||
291 | else | ||
292 | child = new; | ||
293 | } | ||
294 | } | ||
295 | if (!child || IS_ERR(child) || !child->d_inode) | ||
296 | goto end_instantiate; | ||
297 | inode = child->d_inode; | ||
298 | if (inode) { | ||
299 | ino = inode->i_ino; | ||
300 | type = inode->i_mode >> 12; | ||
301 | } | ||
302 | dput(child); | ||
303 | end_instantiate: | ||
304 | if (!ino) | ||
305 | ino= find_inode_number(dir, &qname); | ||
306 | if (!ino) | ||
307 | ino = 1; | ||
308 | return filldir(dirent, qname.name, qname.len, filp->f_pos, ino, type); | ||
309 | } | ||
310 | |||
311 | static int proc_sys_readdir(struct file *filp, void *dirent, filldir_t filldir) | ||
312 | { | ||
313 | struct dentry *dentry = filp->f_dentry; | ||
314 | struct inode *inode = dentry->d_inode; | ||
315 | struct ctl_table_header *head = NULL; | ||
316 | struct ctl_table *table; | ||
317 | unsigned long pos; | ||
318 | int ret; | ||
319 | |||
320 | ret = -ENOTDIR; | ||
321 | if (!S_ISDIR(inode->i_mode)) | ||
322 | goto out; | ||
323 | |||
324 | ret = 0; | ||
325 | /* Avoid a switch here: arm builds fail with missing __cmpdi2 */ | ||
326 | if (filp->f_pos == 0) { | ||
327 | if (filldir(dirent, ".", 1, filp->f_pos, | ||
328 | inode->i_ino, DT_DIR) < 0) | ||
329 | goto out; | ||
330 | filp->f_pos++; | ||
331 | } | ||
332 | if (filp->f_pos == 1) { | ||
333 | if (filldir(dirent, "..", 2, filp->f_pos, | ||
334 | parent_ino(dentry), DT_DIR) < 0) | ||
335 | goto out; | ||
336 | filp->f_pos++; | ||
337 | } | ||
338 | pos = 2; | ||
339 | |||
340 | /* - Find each instance of the directory | ||
341 | * - Read all entries in each instance | ||
342 | * - Before returning an entry to user space lookup the entry | ||
343 | * by name and if I find a different entry don't return | ||
344 | * this one because it means it is a buried dup. | ||
345 | * For sysctl this should only happen for directory entries. | ||
346 | */ | ||
347 | for (head = sysctl_head_next(NULL); head; head = sysctl_head_next(head)) { | ||
348 | table = proc_sys_lookup_table(dentry, head->ctl_table); | ||
349 | |||
350 | if (!table) | ||
351 | continue; | ||
352 | |||
353 | for (; table->ctl_name || table->procname; table++, pos++) { | ||
354 | /* Can't do anything without a proc name */ | ||
355 | if (!table->procname) | ||
356 | continue; | ||
357 | |||
358 | if (pos < filp->f_pos) | ||
359 | continue; | ||
360 | |||
361 | if (proc_sys_fill_cache(filp, dirent, filldir, table) < 0) | ||
362 | goto out; | ||
363 | filp->f_pos = pos + 1; | ||
364 | } | ||
365 | } | ||
366 | ret = 1; | ||
367 | out: | ||
368 | sysctl_head_finish(head); | ||
369 | return ret; | ||
370 | } | ||
371 | |||
372 | static int proc_sys_permission(struct inode *inode, int mask, struct nameidata *nd) | ||
373 | { | ||
374 | /* | ||
375 | * sysctl entries that are not writeable, | ||
376 | * are _NOT_ writeable, capabilities or not. | ||
377 | */ | ||
378 | struct ctl_table_header *head; | ||
379 | struct ctl_table *table; | ||
380 | struct dentry *dentry; | ||
381 | int mode; | ||
382 | int depth; | ||
383 | int error; | ||
384 | |||
385 | head = NULL; | ||
386 | depth = PROC_I(inode)->fd; | ||
387 | |||
388 | /* First check the cached permissions, in case we don't have | ||
389 | * enough information to lookup the sysctl table entry. | ||
390 | */ | ||
391 | error = -EACCES; | ||
392 | mode = inode->i_mode; | ||
393 | |||
394 | if (current->euid == 0) | ||
395 | mode >>= 6; | ||
396 | else if (in_group_p(0)) | ||
397 | mode >>= 3; | ||
398 | |||
399 | if ((mode & mask & (MAY_READ|MAY_WRITE|MAY_EXEC)) == mask) | ||
400 | error = 0; | ||
401 | |||
402 | /* If we can't get a sysctl table entry the permission | ||
403 | * checks on the cached mode will have to be enough. | ||
404 | */ | ||
405 | if (!nd || !depth) | ||
406 | goto out; | ||
407 | |||
408 | dentry = nd->dentry; | ||
409 | table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); | ||
410 | |||
411 | /* If the entry does not exist deny permission */ | ||
412 | error = -EACCES; | ||
413 | if (!table) | ||
414 | goto out; | ||
415 | |||
416 | /* Use the permissions on the sysctl table entry */ | ||
417 | error = sysctl_perm(table, mask); | ||
418 | out: | ||
419 | sysctl_head_finish(head); | ||
420 | return error; | ||
421 | } | ||
422 | |||
423 | static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr) | ||
424 | { | ||
425 | struct inode *inode = dentry->d_inode; | ||
426 | int error; | ||
427 | |||
428 | if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) | ||
429 | return -EPERM; | ||
430 | |||
431 | error = inode_change_ok(inode, attr); | ||
432 | if (!error) { | ||
433 | error = security_inode_setattr(dentry, attr); | ||
434 | if (!error) | ||
435 | error = inode_setattr(inode, attr); | ||
436 | } | ||
437 | |||
438 | return error; | ||
439 | } | ||
440 | |||
441 | /* I'm lazy and don't distinguish between files and directories, | ||
442 | * until access time. | ||
443 | */ | ||
444 | static const struct file_operations proc_sys_file_operations = { | ||
445 | .read = proc_sys_read, | ||
446 | .write = proc_sys_write, | ||
447 | .readdir = proc_sys_readdir, | ||
448 | }; | ||
449 | |||
450 | static struct inode_operations proc_sys_inode_operations = { | ||
451 | .lookup = proc_sys_lookup, | ||
452 | .permission = proc_sys_permission, | ||
453 | .setattr = proc_sys_setattr, | ||
454 | }; | ||
455 | |||
456 | static int proc_sys_revalidate(struct dentry *dentry, struct nameidata *nd) | ||
457 | { | ||
458 | struct ctl_table_header *head; | ||
459 | struct ctl_table *table; | ||
460 | table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head); | ||
461 | proc_sys_refresh_inode(dentry->d_inode, table); | ||
462 | sysctl_head_finish(head); | ||
463 | return !!table; | ||
464 | } | ||
465 | |||
466 | static struct dentry_operations proc_sys_dentry_operations = { | ||
467 | .d_revalidate = proc_sys_revalidate, | ||
468 | }; | ||
469 | |||
470 | static struct proc_dir_entry *proc_sys_root; | ||
471 | |||
472 | int proc_sys_init(void) | ||
473 | { | ||
474 | proc_sys_root = proc_mkdir("sys", NULL); | ||
475 | proc_sys_root->proc_iops = &proc_sys_inode_operations; | ||
476 | proc_sys_root->proc_fops = &proc_sys_file_operations; | ||
477 | proc_sys_root->nlink = 0; | ||
478 | return 0; | ||
479 | } | ||
diff --git a/fs/proc/root.c b/fs/proc/root.c index af154458b540..5834a744c2a9 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
@@ -23,10 +23,6 @@ | |||
23 | 23 | ||
24 | struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver; | 24 | struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver; |
25 | 25 | ||
26 | #ifdef CONFIG_SYSCTL | ||
27 | struct proc_dir_entry *proc_sys_root; | ||
28 | #endif | ||
29 | |||
30 | static int proc_get_sb(struct file_system_type *fs_type, | 26 | static int proc_get_sb(struct file_system_type *fs_type, |
31 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 27 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
32 | { | 28 | { |
@@ -71,13 +67,6 @@ void __init proc_root_init(void) | |||
71 | #ifdef CONFIG_SYSVIPC | 67 | #ifdef CONFIG_SYSVIPC |
72 | proc_mkdir("sysvipc", NULL); | 68 | proc_mkdir("sysvipc", NULL); |
73 | #endif | 69 | #endif |
74 | #ifdef CONFIG_SYSCTL | ||
75 | proc_sys_root = proc_mkdir("sys", NULL); | ||
76 | #endif | ||
77 | #if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) | ||
78 | proc_mkdir("sys/fs", NULL); | ||
79 | proc_mkdir("sys/fs/binfmt_misc", NULL); | ||
80 | #endif | ||
81 | proc_root_fs = proc_mkdir("fs", NULL); | 70 | proc_root_fs = proc_mkdir("fs", NULL); |
82 | proc_root_driver = proc_mkdir("driver", NULL); | 71 | proc_root_driver = proc_mkdir("driver", NULL); |
83 | proc_mkdir("fs/nfsd", NULL); /* somewhere for the nfsd filesystem to be mounted */ | 72 | proc_mkdir("fs/nfsd", NULL); /* somewhere for the nfsd filesystem to be mounted */ |
@@ -90,6 +79,9 @@ void __init proc_root_init(void) | |||
90 | proc_device_tree_init(); | 79 | proc_device_tree_init(); |
91 | #endif | 80 | #endif |
92 | proc_bus = proc_mkdir("bus", NULL); | 81 | proc_bus = proc_mkdir("bus", NULL); |
82 | #ifdef CONFIG_SYSCTL | ||
83 | proc_sys_init(); | ||
84 | #endif | ||
93 | } | 85 | } |
94 | 86 | ||
95 | static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat | 87 | static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat |
diff --git a/fs/smbfs/symlink.c b/fs/smbfs/symlink.c index e4bf3456d07e..fea20ceb8a5f 100644 --- a/fs/smbfs/symlink.c +++ b/fs/smbfs/symlink.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * Please add a note about your changes to smbfs in the ChangeLog file. | 6 | * Please add a note about your changes to smbfs in the ChangeLog file. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/sched.h> | ||
10 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
11 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
12 | #include <linux/fcntl.h> | 11 | #include <linux/fcntl.h> |
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 0e97a4f79c31..bcc44084e004 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/quotaops.h> | 16 | #include <linux/quotaops.h> |
17 | #include <linux/buffer_head.h> | 17 | #include <linux/buffer_head.h> |
18 | #include <linux/capability.h> | 18 | #include <linux/capability.h> |
19 | #include <linux/sched.h> | ||
20 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
21 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
22 | 21 | ||
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index a6c0ca9f48bf..4890ddf1518e 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/ufs_fs.h> | 21 | #include <linux/ufs_fs.h> |
22 | #include <linux/smp_lock.h> | 22 | #include <linux/smp_lock.h> |
23 | #include <linux/sched.h> | ||
24 | 23 | ||
25 | #include "swab.h" | 24 | #include "swab.h" |
26 | #include "util.h" | 25 | #include "util.h" |
diff --git a/fs/xattr_acl.c b/fs/xattr_acl.c index 789a2559bd54..c6ad7c7e3ee9 100644 --- a/fs/xattr_acl.c +++ b/fs/xattr_acl.c | |||
@@ -6,7 +6,6 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/sched.h> | ||
10 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
11 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
12 | #include <linux/posix_acl_xattr.h> | 11 | #include <linux/posix_acl_xattr.h> |
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index 004baf600611..ed2b16dff914 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * along with this program; if not, write the Free Software Foundation, | 15 | * along with this program; if not, write the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | #include <linux/sched.h> | ||
19 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
20 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
21 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c index 5c46c35a97a5..cd6eaa44aa2b 100644 --- a/fs/xfs/linux-2.6/xfs_sysctl.c +++ b/fs/xfs/linux-2.6/xfs_sysctl.c | |||
@@ -251,7 +251,7 @@ static ctl_table xfs_root_table[] = { | |||
251 | void | 251 | void |
252 | xfs_sysctl_register(void) | 252 | xfs_sysctl_register(void) |
253 | { | 253 | { |
254 | xfs_table_header = register_sysctl_table(xfs_root_table, 0); | 254 | xfs_table_header = register_sysctl_table(xfs_root_table); |
255 | } | 255 | } |
256 | 256 | ||
257 | void | 257 | void |