Commit ecb5ec044ab99be1f35e93962fa43e4bb3120d9e
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile #3 from Al Viro: "Assorted fixes and patches from the last cycle" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: [regression] chunk lost from bd9b51 vfs: make mounts and mountstats honor root dir like mountinfo does vfs: cleanup show_mountinfo init: fix read-write root mount unfuck binfmt_misc.c (broken by commit e6084d4) vm_area_operations: kill ->migrate() new helper: iter_is_iovec() move_extent_per_page(): get rid of unused w_flags lustre: get rid of playing with ->fs btrfs: filp_open() returns ERR_PTR() on failure, not NULL...
Showing 17 changed files Side-by-side Diff
- drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
- drivers/staging/lustre/lustre/llite/dir.c
- drivers/staging/lustre/lustre/llite/llite_lib.c
- fs/binfmt_misc.c
- fs/btrfs/volumes.c
- fs/ext4/move_extent.c
- fs/kernfs/file.c
- fs/proc_namespace.c
- include/linux/migrate.h
- include/linux/mm.h
- include/linux/uio.h
- init/do_mounts.c
- mm/filemap.c
- mm/mempolicy.c
- mm/migrate.c
- mm/shmem.c
- net/socket.c
drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
... | ... | @@ -42,28 +42,6 @@ |
42 | 42 | |
43 | 43 | #include "lustre_patchless_compat.h" |
44 | 44 | |
45 | -# define LOCK_FS_STRUCT(fs) spin_lock(&(fs)->lock) | |
46 | -# define UNLOCK_FS_STRUCT(fs) spin_unlock(&(fs)->lock) | |
47 | - | |
48 | -static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, | |
49 | - struct dentry *dentry) | |
50 | -{ | |
51 | - struct path path; | |
52 | - struct path old_pwd; | |
53 | - | |
54 | - path.mnt = mnt; | |
55 | - path.dentry = dentry; | |
56 | - LOCK_FS_STRUCT(fs); | |
57 | - old_pwd = fs->pwd; | |
58 | - path_get(&path); | |
59 | - fs->pwd = path; | |
60 | - UNLOCK_FS_STRUCT(fs); | |
61 | - | |
62 | - if (old_pwd.dentry) | |
63 | - path_put(&old_pwd); | |
64 | -} | |
65 | - | |
66 | - | |
67 | 45 | /* |
68 | 46 | * set ATTR_BLOCKS to a high value to avoid any risk of collision with other |
69 | 47 | * ATTR_* attributes (see bug 13828) |
... | ... | @@ -110,8 +88,6 @@ |
110 | 88 | #define cfs_bio_io_error(a, b) bio_io_error((a)) |
111 | 89 | #define cfs_bio_endio(a, b, c) bio_endio((a), (c)) |
112 | 90 | |
113 | -#define cfs_fs_pwd(fs) ((fs)->pwd.dentry) | |
114 | -#define cfs_fs_mnt(fs) ((fs)->pwd.mnt) | |
115 | 91 | #define cfs_path_put(nd) path_put(&(nd)->path) |
116 | 92 | |
117 | 93 |
drivers/staging/lustre/lustre/llite/dir.c
... | ... | @@ -661,7 +661,7 @@ |
661 | 661 | int mode; |
662 | 662 | int err; |
663 | 663 | |
664 | - mode = (0755 & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR; | |
664 | + mode = (0755 & ~current_umask()) | S_IFDIR; | |
665 | 665 | op_data = ll_prep_md_op_data(NULL, dir, NULL, filename, |
666 | 666 | strlen(filename), mode, LUSTRE_OPC_MKDIR, |
667 | 667 | lump); |
drivers/staging/lustre/lustre/llite/llite_lib.c
... | ... | @@ -2372,21 +2372,6 @@ |
2372 | 2372 | return buf; |
2373 | 2373 | } |
2374 | 2374 | |
2375 | -static char *ll_d_path(struct dentry *dentry, char *buf, int bufsize) | |
2376 | -{ | |
2377 | - char *path = NULL; | |
2378 | - | |
2379 | - struct path p; | |
2380 | - | |
2381 | - p.dentry = dentry; | |
2382 | - p.mnt = current->fs->root.mnt; | |
2383 | - path_get(&p); | |
2384 | - path = d_path(&p, buf, bufsize); | |
2385 | - path_put(&p); | |
2386 | - | |
2387 | - return path; | |
2388 | -} | |
2389 | - | |
2390 | 2375 | void ll_dirty_page_discard_warn(struct page *page, int ioret) |
2391 | 2376 | { |
2392 | 2377 | char *buf, *path = NULL; |
... | ... | @@ -2398,7 +2383,7 @@ |
2398 | 2383 | if (buf != NULL) { |
2399 | 2384 | dentry = d_find_alias(page->mapping->host); |
2400 | 2385 | if (dentry != NULL) |
2401 | - path = ll_d_path(dentry, buf, PAGE_SIZE); | |
2386 | + path = dentry_path_raw(dentry, buf, PAGE_SIZE); | |
2402 | 2387 | } |
2403 | 2388 | |
2404 | 2389 | CDEBUG(D_WARNING, |
fs/binfmt_misc.c
... | ... | @@ -254,6 +254,7 @@ |
254 | 254 | return NULL; |
255 | 255 | } |
256 | 256 | } |
257 | + s[-1] ='\0'; | |
257 | 258 | return s; |
258 | 259 | } |
259 | 260 | |
... | ... | @@ -378,8 +379,7 @@ |
378 | 379 | p = scanarg(p, del); |
379 | 380 | if (!p) |
380 | 381 | goto einval; |
381 | - p[-1] = '\0'; | |
382 | - if (p == e->magic) | |
382 | + if (!e->magic[0]) | |
383 | 383 | goto einval; |
384 | 384 | if (USE_DEBUG) |
385 | 385 | print_hex_dump_bytes( |
... | ... | @@ -391,8 +391,7 @@ |
391 | 391 | p = scanarg(p, del); |
392 | 392 | if (!p) |
393 | 393 | goto einval; |
394 | - p[-1] = '\0'; | |
395 | - if (p == e->mask) { | |
394 | + if (!e->mask[0]) { | |
396 | 395 | e->mask = NULL; |
397 | 396 | pr_debug("register: mask[raw]: none\n"); |
398 | 397 | } else if (USE_DEBUG) |
fs/btrfs/volumes.c
fs/ext4/move_extent.c
... | ... | @@ -267,7 +267,6 @@ |
267 | 267 | handle_t *handle; |
268 | 268 | ext4_lblk_t orig_blk_offset, donor_blk_offset; |
269 | 269 | unsigned long blocksize = orig_inode->i_sb->s_blocksize; |
270 | - unsigned int w_flags = 0; | |
271 | 270 | unsigned int tmp_data_size, data_size, replaced_size; |
272 | 271 | int err2, jblocks, retries = 0; |
273 | 272 | int replaced_count = 0; |
... | ... | @@ -287,9 +286,6 @@ |
287 | 286 | *err = PTR_ERR(handle); |
288 | 287 | return 0; |
289 | 288 | } |
290 | - | |
291 | - if (segment_eq(get_fs(), KERNEL_DS)) | |
292 | - w_flags |= AOP_FLAG_UNINTERRUPTIBLE; | |
293 | 289 | |
294 | 290 | orig_blk_offset = orig_page_offset * blocks_per_page + |
295 | 291 | data_offset_in_page; |
fs/kernfs/file.c
... | ... | @@ -448,27 +448,6 @@ |
448 | 448 | return pol; |
449 | 449 | } |
450 | 450 | |
451 | -static int kernfs_vma_migrate(struct vm_area_struct *vma, | |
452 | - const nodemask_t *from, const nodemask_t *to, | |
453 | - unsigned long flags) | |
454 | -{ | |
455 | - struct file *file = vma->vm_file; | |
456 | - struct kernfs_open_file *of = kernfs_of(file); | |
457 | - int ret; | |
458 | - | |
459 | - if (!of->vm_ops) | |
460 | - return 0; | |
461 | - | |
462 | - if (!kernfs_get_active(of->kn)) | |
463 | - return 0; | |
464 | - | |
465 | - ret = 0; | |
466 | - if (of->vm_ops->migrate) | |
467 | - ret = of->vm_ops->migrate(vma, from, to, flags); | |
468 | - | |
469 | - kernfs_put_active(of->kn); | |
470 | - return ret; | |
471 | -} | |
472 | 451 | #endif |
473 | 452 | |
474 | 453 | static const struct vm_operations_struct kernfs_vm_ops = { |
... | ... | @@ -479,7 +458,6 @@ |
479 | 458 | #ifdef CONFIG_NUMA |
480 | 459 | .set_policy = kernfs_vma_set_policy, |
481 | 460 | .get_policy = kernfs_vma_get_policy, |
482 | - .migrate = kernfs_vma_migrate, | |
483 | 461 | #endif |
484 | 462 | }; |
485 | 463 |
fs/proc_namespace.c
... | ... | @@ -91,6 +91,7 @@ |
91 | 91 | |
92 | 92 | static int show_vfsmnt(struct seq_file *m, struct vfsmount *mnt) |
93 | 93 | { |
94 | + struct proc_mounts *p = proc_mounts(m); | |
94 | 95 | struct mount *r = real_mount(mnt); |
95 | 96 | int err = 0; |
96 | 97 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; |
... | ... | @@ -104,7 +105,10 @@ |
104 | 105 | mangle(m, r->mnt_devname ? r->mnt_devname : "none"); |
105 | 106 | } |
106 | 107 | seq_putc(m, ' '); |
107 | - seq_path(m, &mnt_path, " \t\n\\"); | |
108 | + /* mountpoints outside of chroot jail will give SEQ_SKIP on this */ | |
109 | + err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\"); | |
110 | + if (err) | |
111 | + goto out; | |
108 | 112 | seq_putc(m, ' '); |
109 | 113 | show_type(m, sb); |
110 | 114 | seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw"); |
... | ... | @@ -125,7 +129,6 @@ |
125 | 129 | struct mount *r = real_mount(mnt); |
126 | 130 | struct super_block *sb = mnt->mnt_sb; |
127 | 131 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; |
128 | - struct path root = p->root; | |
129 | 132 | int err = 0; |
130 | 133 | |
131 | 134 | seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id, |
... | ... | @@ -139,7 +142,7 @@ |
139 | 142 | seq_putc(m, ' '); |
140 | 143 | |
141 | 144 | /* mountpoints outside of chroot jail will give SEQ_SKIP on this */ |
142 | - err = seq_path_root(m, &mnt_path, &root, " \t\n\"); | |
145 | + err = seq_path_root(m, &mnt_path, &p->root, " \t\n\"); | |
143 | 146 | if (err) |
144 | 147 | goto out; |
145 | 148 | |
... | ... | @@ -182,6 +185,7 @@ |
182 | 185 | |
183 | 186 | static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt) |
184 | 187 | { |
188 | + struct proc_mounts *p = proc_mounts(m); | |
185 | 189 | struct mount *r = real_mount(mnt); |
186 | 190 | struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt }; |
187 | 191 | struct super_block *sb = mnt_path.dentry->d_sb; |
... | ... | @@ -201,7 +205,10 @@ |
201 | 205 | |
202 | 206 | /* mount point */ |
203 | 207 | seq_puts(m, " mounted on "); |
204 | - seq_path(m, &mnt_path, " \t\n\\"); | |
208 | + /* mountpoints outside of chroot jail will give SEQ_SKIP on this */ | |
209 | + err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\"); | |
210 | + if (err) | |
211 | + goto out; | |
205 | 212 | seq_putc(m, ' '); |
206 | 213 | |
207 | 214 | /* file system type */ |
... | ... | @@ -216,6 +223,7 @@ |
216 | 223 | } |
217 | 224 | |
218 | 225 | seq_putc(m, '\n'); |
226 | +out: | |
219 | 227 | return err; |
220 | 228 | } |
221 | 229 |
include/linux/migrate.h
... | ... | @@ -36,9 +36,6 @@ |
36 | 36 | |
37 | 37 | extern int migrate_prep(void); |
38 | 38 | extern int migrate_prep_local(void); |
39 | -extern int migrate_vmas(struct mm_struct *mm, | |
40 | - const nodemask_t *from, const nodemask_t *to, | |
41 | - unsigned long flags); | |
42 | 39 | extern void migrate_page_copy(struct page *newpage, struct page *page); |
43 | 40 | extern int migrate_huge_page_move_mapping(struct address_space *mapping, |
44 | 41 | struct page *newpage, struct page *page); |
... | ... | @@ -56,13 +53,6 @@ |
56 | 53 | |
57 | 54 | static inline int migrate_prep(void) { return -ENOSYS; } |
58 | 55 | static inline int migrate_prep_local(void) { return -ENOSYS; } |
59 | - | |
60 | -static inline int migrate_vmas(struct mm_struct *mm, | |
61 | - const nodemask_t *from, const nodemask_t *to, | |
62 | - unsigned long flags) | |
63 | -{ | |
64 | - return -ENOSYS; | |
65 | -} | |
66 | 56 | |
67 | 57 | static inline void migrate_page_copy(struct page *newpage, |
68 | 58 | struct page *page) {} |
include/linux/mm.h
... | ... | @@ -286,8 +286,6 @@ |
286 | 286 | */ |
287 | 287 | struct mempolicy *(*get_policy)(struct vm_area_struct *vma, |
288 | 288 | unsigned long addr); |
289 | - int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from, | |
290 | - const nodemask_t *to, unsigned long flags); | |
291 | 289 | #endif |
292 | 290 | /* called by sys_remap_file_pages() to populate non-linear mapping */ |
293 | 291 | int (*remap_pages)(struct vm_area_struct *vma, unsigned long addr, |
include/linux/uio.h
... | ... | @@ -101,6 +101,11 @@ |
101 | 101 | return i->count; |
102 | 102 | } |
103 | 103 | |
104 | +static inline bool iter_is_iovec(struct iov_iter *i) | |
105 | +{ | |
106 | + return !(i->type & (ITER_BVEC | ITER_KVEC)); | |
107 | +} | |
108 | + | |
104 | 109 | /* |
105 | 110 | * Cap the iov_iter by given limit; note that the second argument is |
106 | 111 | * *not* the new size - it's upper limit for such. Passing it a value |
init/do_mounts.c
... | ... | @@ -395,8 +395,6 @@ |
395 | 395 | case 0: |
396 | 396 | goto out; |
397 | 397 | case -EACCES: |
398 | - flags |= MS_RDONLY; | |
399 | - goto retry; | |
400 | 398 | case -EINVAL: |
401 | 399 | continue; |
402 | 400 | } |
... | ... | @@ -418,6 +416,10 @@ |
418 | 416 | "explicit textual name for \"root=\" boot option.\n"); |
419 | 417 | #endif |
420 | 418 | panic("VFS: Unable to mount root fs on %s", b); |
419 | + } | |
420 | + if (!(flags & MS_RDONLY)) { | |
421 | + flags |= MS_RDONLY; | |
422 | + goto retry; | |
421 | 423 | } |
422 | 424 | |
423 | 425 | printk("List of all partitions:\n"); |
mm/filemap.c
mm/mempolicy.c
... | ... | @@ -1041,10 +1041,6 @@ |
1041 | 1041 | |
1042 | 1042 | down_read(&mm->mmap_sem); |
1043 | 1043 | |
1044 | - err = migrate_vmas(mm, from, to, flags); | |
1045 | - if (err) | |
1046 | - goto out; | |
1047 | - | |
1048 | 1044 | /* |
1049 | 1045 | * Find a 'source' bit set in 'tmp' whose corresponding 'dest' |
1050 | 1046 | * bit in 'to' is not also set in 'tmp'. Clear the found 'source' |
... | ... | @@ -1124,7 +1120,6 @@ |
1124 | 1120 | if (err < 0) |
1125 | 1121 | break; |
1126 | 1122 | } |
1127 | -out: | |
1128 | 1123 | up_read(&mm->mmap_sem); |
1129 | 1124 | if (err < 0) |
1130 | 1125 | return err; |
mm/migrate.c
... | ... | @@ -1536,27 +1536,6 @@ |
1536 | 1536 | return err; |
1537 | 1537 | } |
1538 | 1538 | |
1539 | -/* | |
1540 | - * Call migration functions in the vma_ops that may prepare | |
1541 | - * memory in a vm for migration. migration functions may perform | |
1542 | - * the migration for vmas that do not have an underlying page struct. | |
1543 | - */ | |
1544 | -int migrate_vmas(struct mm_struct *mm, const nodemask_t *to, | |
1545 | - const nodemask_t *from, unsigned long flags) | |
1546 | -{ | |
1547 | - struct vm_area_struct *vma; | |
1548 | - int err = 0; | |
1549 | - | |
1550 | - for (vma = mm->mmap; vma && !err; vma = vma->vm_next) { | |
1551 | - if (vma->vm_ops && vma->vm_ops->migrate) { | |
1552 | - err = vma->vm_ops->migrate(vma, to, from, flags); | |
1553 | - if (err) | |
1554 | - break; | |
1555 | - } | |
1556 | - } | |
1557 | - return err; | |
1558 | -} | |
1559 | - | |
1560 | 1539 | #ifdef CONFIG_NUMA_BALANCING |
1561 | 1540 | /* |
1562 | 1541 | * Returns true if this is a safe migration target node for misplaced NUMA |
mm/shmem.c
... | ... | @@ -1536,7 +1536,7 @@ |
1536 | 1536 | * holes of a sparse file, we actually need to allocate those pages, |
1537 | 1537 | * and even mark them dirty, so it cannot exceed the max_blocks limit. |
1538 | 1538 | */ |
1539 | - if (segment_eq(get_fs(), KERNEL_DS)) | |
1539 | + if (!iter_is_iovec(to)) | |
1540 | 1540 | sgp = SGP_DIRTY; |
1541 | 1541 | |
1542 | 1542 | index = *ppos >> PAGE_CACHE_SHIFT; |
net/socket.c