Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull misc vfs updates from Al Viro:
"Assorted stuff, really no common topic here"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
vfs: grab the lock instead of blocking in __fd_install during resizing
vfs: stop clearing close on exec when closing a fd
include/linux/fs.h: fix comment about struct address_space
fs: make fiemap work from compat_ioctl
coda: fix 'kernel memory exposure attempt' in fsync
pstore: remove unneeded unlikely()
vfs: remove unneeded unlikely()
stubs for mount_bdev() and kill_block_super() in !CONFIG_BLOCK case
make vfs_ustat() static
do_handle_open() should be static
elf_fdpic: fix unused variable warning
fold destroy_super() into __put_super()
new helper: destroy_unused_super()
fix address space warnings in ipc/
acct.h: get rid of detritus

+60 -52
-4
Documentation/filesystems/porting
··· 502 502 store it as cookie. 503 503 -- 504 504 [mandatory] 505 - __fd_install() & fd_install() can now sleep. Callers should not 506 - hold a spinlock or other resources that do not allow a schedule. 507 - -- 508 - [mandatory] 509 505 any symlink that might use page_follow_link_light/page_put_link() must 510 506 have inode_nohighmem(inode) called before anything might start playing with 511 507 its pagecache. No highmem pages should end up in the pagecache of such
+2
fs/binfmt_elf_fdpic.c
··· 1498 1498 struct vm_area_struct *vma; 1499 1499 1500 1500 for (vma = current->mm->mmap; vma; vma = vma->vm_next) { 1501 + #ifdef CONFIG_MMU 1501 1502 unsigned long addr; 1503 + #endif 1502 1504 1503 1505 if (!maydump(vma, cprm->mm_flags)) 1504 1506 continue;
+1 -2
fs/coda/upcall.c
··· 447 447 UPARG(CODA_FSYNC); 448 448 449 449 inp->coda_fsync.VFid = *fid; 450 - error = coda_upcall(coda_vcp(sb), sizeof(union inputArgs), 451 - &outsize, inp); 450 + error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); 452 451 453 452 CODA_FREE(inp, insize); 454 453 return error;
+1
fs/compat_ioctl.c
··· 1458 1458 case FICLONE: 1459 1459 case FICLONERANGE: 1460 1460 case FIDEDUPERANGE: 1461 + case FS_IOC_FIEMAP: 1461 1462 goto do_ioctl; 1462 1463 1463 1464 case FIBMAP:
+2 -2
fs/fhandle.c
··· 213 213 return retval; 214 214 } 215 215 216 - long do_handle_open(int mountdirfd, 217 - struct file_handle __user *ufh, int open_flag) 216 + static long do_handle_open(int mountdirfd, struct file_handle __user *ufh, 217 + int open_flag) 218 218 { 219 219 long retval = 0; 220 220 struct path path;
+7 -5
fs/file.c
··· 593 593 { 594 594 struct fdtable *fdt; 595 595 596 - might_sleep(); 597 596 rcu_read_lock_sched(); 598 597 599 - while (unlikely(files->resize_in_progress)) { 598 + if (unlikely(files->resize_in_progress)) { 600 599 rcu_read_unlock_sched(); 601 - wait_event(files->resize_wait, !files->resize_in_progress); 602 - rcu_read_lock_sched(); 600 + spin_lock(&files->file_lock); 601 + fdt = files_fdtable(files); 602 + BUG_ON(fdt->fd[fd] != NULL); 603 + rcu_assign_pointer(fdt->fd[fd], file); 604 + spin_unlock(&files->file_lock); 605 + return; 603 606 } 604 607 /* coupled with smp_wmb() in expand_fdtable() */ 605 608 smp_rmb(); ··· 635 632 if (!file) 636 633 goto out_unlock; 637 634 rcu_assign_pointer(fdt->fd[fd], NULL); 638 - __clear_close_on_exec(fd, fdt); 639 635 __put_unused_fd(files, fd); 640 636 spin_unlock(&files->file_lock); 641 637 return filp_close(file, files);
+1 -1
fs/namei.c
··· 3459 3459 goto out; 3460 3460 child = vfs_tmpfile(path.dentry, op->mode, op->open_flag); 3461 3461 error = PTR_ERR(child); 3462 - if (unlikely(IS_ERR(child))) 3462 + if (IS_ERR(child)) 3463 3463 goto out2; 3464 3464 dput(path.dentry); 3465 3465 path.dentry = child;
+1 -1
fs/pstore/platform.c
··· 651 651 return -EINVAL; 652 652 653 653 record->buf = memdup_user(buf, record->size); 654 - if (unlikely(IS_ERR(record->buf))) { 654 + if (IS_ERR(record->buf)) { 655 655 ret = PTR_ERR(record->buf); 656 656 goto out; 657 657 }
+1 -1
fs/statfs.c
··· 217 217 return error; 218 218 } 219 219 220 - int vfs_ustat(dev_t dev, struct kstatfs *sbuf) 220 + static int vfs_ustat(dev_t dev, struct kstatfs *sbuf) 221 221 { 222 222 struct super_block *s = user_get_super(dev); 223 223 int err;
+21 -25
fs/super.c
··· 155 155 schedule_work(&s->destroy_work); 156 156 } 157 157 158 - /** 159 - * destroy_super - frees a superblock 160 - * @s: superblock to free 161 - * 162 - * Frees a superblock. 163 - */ 164 - static void destroy_super(struct super_block *s) 158 + /* Free a superblock that has never been seen by anyone */ 159 + static void destroy_unused_super(struct super_block *s) 165 160 { 161 + if (!s) 162 + return; 163 + up_write(&s->s_umount); 166 164 list_lru_destroy(&s->s_dentry_lru); 167 165 list_lru_destroy(&s->s_inode_lru); 168 166 security_sb_free(s); 169 - WARN_ON(!list_empty(&s->s_mounts)); 170 167 put_user_ns(s->s_user_ns); 171 168 kfree(s->s_subtype); 172 - call_rcu(&s->rcu, destroy_super_rcu); 169 + /* no delays needed */ 170 + destroy_super_work(&s->destroy_work); 173 171 } 174 172 175 173 /** ··· 255 257 return s; 256 258 257 259 fail: 258 - destroy_super(s); 260 + destroy_unused_super(s); 259 261 return NULL; 260 262 } 261 263 ··· 264 266 /* 265 267 * Drop a superblock's refcount. The caller must hold sb_lock. 266 268 */ 267 - static void __put_super(struct super_block *sb) 269 + static void __put_super(struct super_block *s) 268 270 { 269 - if (!--sb->s_count) { 270 - list_del_init(&sb->s_list); 271 - destroy_super(sb); 271 + if (!--s->s_count) { 272 + list_del_init(&s->s_list); 273 + WARN_ON(s->s_dentry_lru.node); 274 + WARN_ON(s->s_inode_lru.node); 275 + WARN_ON(!list_empty(&s->s_mounts)); 276 + security_sb_free(s); 277 + put_user_ns(s->s_user_ns); 278 + kfree(s->s_subtype); 279 + call_rcu(&s->rcu, destroy_super_rcu); 272 280 } 273 281 } 274 282 ··· 489 485 continue; 490 486 if (user_ns != old->s_user_ns) { 491 487 spin_unlock(&sb_lock); 492 - if (s) { 493 - up_write(&s->s_umount); 494 - destroy_super(s); 495 - } 488 + destroy_unused_super(s); 496 489 return ERR_PTR(-EBUSY); 497 490 } 498 491 if (!grab_super(old)) 499 492 goto retry; 500 - if (s) { 501 - up_write(&s->s_umount); 502 - destroy_super(s); 503 - s = NULL; 504 - } 493 + destroy_unused_super(s); 505 494 return old; 506 495 } 507 496 } ··· 509 512 err = set(s, data); 510 513 if (err) { 511 514 spin_unlock(&sb_lock); 512 - up_write(&s->s_umount); 513 - destroy_super(s); 515 + destroy_unused_super(s); 514 516 return ERR_PTR(err); 515 517 } 516 518 s->s_type = type;
-3
include/linux/acct.h
··· 20 20 21 21 22 22 #ifdef CONFIG_BSD_PROCESS_ACCT 23 - struct vfsmount; 24 - struct super_block; 25 - struct pacct_struct; 26 23 struct pid_namespace; 27 24 extern int acct_parm[]; /* for sysctl */ 28 25 extern void acct_collect(long exitcode, int group_dead);
+16 -1
include/linux/fs.h
··· 2098 2098 extern struct dentry *mount_ns(struct file_system_type *fs_type, 2099 2099 int flags, void *data, void *ns, struct user_namespace *user_ns, 2100 2100 int (*fill_super)(struct super_block *, void *, int)); 2101 + #ifdef CONFIG_BLOCK 2101 2102 extern struct dentry *mount_bdev(struct file_system_type *fs_type, 2102 2103 int flags, const char *dev_name, void *data, 2103 2104 int (*fill_super)(struct super_block *, void *, int)); 2105 + #else 2106 + static inline struct dentry *mount_bdev(struct file_system_type *fs_type, 2107 + int flags, const char *dev_name, void *data, 2108 + int (*fill_super)(struct super_block *, void *, int)) 2109 + { 2110 + return ERR_PTR(-ENODEV); 2111 + } 2112 + #endif 2104 2113 extern struct dentry *mount_single(struct file_system_type *fs_type, 2105 2114 int flags, void *data, 2106 2115 int (*fill_super)(struct super_block *, void *, int)); ··· 2118 2109 int (*fill_super)(struct super_block *, void *, int)); 2119 2110 extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path); 2120 2111 void generic_shutdown_super(struct super_block *sb); 2112 + #ifdef CONFIG_BLOCK 2121 2113 void kill_block_super(struct super_block *sb); 2114 + #else 2115 + static inline void kill_block_super(struct super_block *sb) 2116 + { 2117 + BUG(); 2118 + } 2119 + #endif 2122 2120 void kill_anon_super(struct super_block *sb); 2123 2121 void kill_litter_super(struct super_block *sb); 2124 2122 void deactivate_super(struct super_block *sb); ··· 2189 2173 extern int vfs_statfs(const struct path *, struct kstatfs *); 2190 2174 extern int user_statfs(const char __user *, struct kstatfs *); 2191 2175 extern int fd_statfs(int, struct kstatfs *); 2192 - extern int vfs_ustat(dev_t, struct kstatfs *); 2193 2176 extern int freeze_super(struct super_block *super); 2194 2177 extern int thaw_super(struct super_block *super); 2195 2178 extern bool our_mnt(struct vfsmount *mnt);
+2 -2
ipc/msg.c
··· 591 591 { 592 592 memset(out, 0, sizeof(*out)); 593 593 if (version == IPC_64) { 594 - struct compat_msqid64_ds *p = buf; 594 + struct compat_msqid64_ds __user *p = buf; 595 595 if (get_compat_ipc64_perm(&out->msg_perm, &p->msg_perm)) 596 596 return -EFAULT; 597 597 if (get_user(out->msg_qbytes, &p->msg_qbytes)) 598 598 return -EFAULT; 599 599 } else { 600 - struct compat_msqid_ds *p = buf; 600 + struct compat_msqid_ds __user *p = buf; 601 601 if (get_compat_ipc_perm(&out->msg_perm, &p->msg_perm)) 602 602 return -EFAULT; 603 603 if (get_user(out->msg_qbytes, &p->msg_qbytes))
+2 -2
ipc/sem.c
··· 1637 1637 { 1638 1638 memset(out, 0, sizeof(*out)); 1639 1639 if (version == IPC_64) { 1640 - struct compat_semid64_ds *p = buf; 1640 + struct compat_semid64_ds __user *p = buf; 1641 1641 return get_compat_ipc64_perm(&out->sem_perm, &p->sem_perm); 1642 1642 } else { 1643 - struct compat_semid_ds *p = buf; 1643 + struct compat_semid_ds __user *p = buf; 1644 1644 return get_compat_ipc_perm(&out->sem_perm, &p->sem_perm); 1645 1645 } 1646 1646 }
+2 -2
ipc/shm.c
··· 1194 1194 { 1195 1195 memset(out, 0, sizeof(*out)); 1196 1196 if (version == IPC_64) { 1197 - struct compat_shmid64_ds *p = buf; 1197 + struct compat_shmid64_ds __user *p = buf; 1198 1198 return get_compat_ipc64_perm(&out->shm_perm, &p->shm_perm); 1199 1199 } else { 1200 - struct compat_shmid_ds *p = buf; 1200 + struct compat_shmid_ds __user *p = buf; 1201 1201 return get_compat_ipc_perm(&out->shm_perm, &p->shm_perm); 1202 1202 } 1203 1203 }
+1 -1
ipc/syscall.c
··· 172 172 COMPAT_SHMLBA); 173 173 if (err < 0) 174 174 return err; 175 - return put_user(raddr, (compat_ulong_t *)compat_ptr(third)); 175 + return put_user(raddr, (compat_ulong_t __user *)compat_ptr(third)); 176 176 } 177 177 case SHMDT: 178 178 return sys_shmdt(compat_ptr(ptr));