Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
FS: lookup_mnt() is only used in the core fs routines now
bfs: fix bitmap size argument to find_first_zero_bit()
fs: Use BUG_ON(!mnt) at dentry_open().
fs: devpts_pty_new() return -ENOMEM if dentry allocation failed
nfs: lock() vs unlock() typo
pstore: fix leaking ->i_private
introduce sys_syncfs to sync a single file system
Small typo fix...
Filesystem: fifo: Fixed coding style issue.
fs/inode: Fix kernel-doc format for inode_init_owner
select: remove unused MAX_SELECT_SECONDS
vfs: cleanup do_vfs_ioctl()

+67 -51
+1
arch/x86/ia32/ia32entry.S
··· 847 .quad sys_name_to_handle_at 848 .quad compat_sys_open_by_handle_at 849 .quad compat_sys_clock_adjtime 850 ia32_syscall_end:
··· 847 .quad sys_name_to_handle_at 848 .quad compat_sys_open_by_handle_at 849 .quad compat_sys_clock_adjtime 850 + .quad sys_syncfs 851 ia32_syscall_end:
+2 -1
arch/x86/include/asm/unistd_32.h
··· 349 #define __NR_name_to_handle_at 341 350 #define __NR_open_by_handle_at 342 351 #define __NR_clock_adjtime 343 352 353 #ifdef __KERNEL__ 354 355 - #define NR_syscalls 344 356 357 #define __ARCH_WANT_IPC_PARSE_VERSION 358 #define __ARCH_WANT_OLD_READDIR
··· 349 #define __NR_name_to_handle_at 341 350 #define __NR_open_by_handle_at 342 351 #define __NR_clock_adjtime 343 352 + #define __NR_syncfs 344 353 354 #ifdef __KERNEL__ 355 356 + #define NR_syscalls 345 357 358 #define __ARCH_WANT_IPC_PARSE_VERSION 359 #define __ARCH_WANT_OLD_READDIR
+2
arch/x86/include/asm/unistd_64.h
··· 675 __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) 676 #define __NR_clock_adjtime 305 677 __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) 678 679 #ifndef __NO_STUBS 680 #define __ARCH_WANT_OLD_READDIR
··· 675 __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) 676 #define __NR_clock_adjtime 305 677 __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) 678 + #define __NR_syncfs 306 679 + __SYSCALL(__NR_syncfs, sys_syncfs) 680 681 #ifndef __NO_STUBS 682 #define __ARCH_WANT_OLD_READDIR
+1
arch/x86/kernel/syscall_table_32.S
··· 343 .long sys_name_to_handle_at 344 .long sys_open_by_handle_at 345 .long sys_clock_adjtime
··· 343 .long sys_name_to_handle_at 344 .long sys_open_by_handle_at 345 .long sys_clock_adjtime 346 + .long sys_syncfs
+1 -1
fs/bfs/dir.c
··· 97 if (!inode) 98 return -ENOSPC; 99 mutex_lock(&info->bfs_lock); 100 - ino = find_first_zero_bit(info->si_imap, info->si_lasti); 101 if (ino > info->si_lasti) { 102 mutex_unlock(&info->bfs_lock); 103 iput(inode);
··· 97 if (!inode) 98 return -ENOSPC; 99 mutex_lock(&info->bfs_lock); 100 + ino = find_first_zero_bit(info->si_imap, info->si_lasti + 1); 101 if (ino > info->si_lasti) { 102 mutex_unlock(&info->bfs_lock); 103 iput(inode);
-3
fs/compat.c
··· 1671 * Update: ERESTARTSYS breaks at least the xview clock binary, so 1672 * I'm trying ERESTARTNOHAND which restart only when you want to. 1673 */ 1674 - #define MAX_SELECT_SECONDS \ 1675 - ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1) 1676 - 1677 int compat_core_sys_select(int n, compat_ulong_t __user *inp, 1678 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1679 struct timespec *end_time)
··· 1671 * Update: ERESTARTSYS breaks at least the xview clock binary, so 1672 * I'm trying ERESTARTNOHAND which restart only when you want to. 1673 */ 1674 int compat_core_sys_select(int n, compat_ulong_t __user *inp, 1675 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1676 struct timespec *end_time)
+9 -10
fs/devpts/inode.c
··· 479 struct dentry *root = sb->s_root; 480 struct pts_fs_info *fsi = DEVPTS_SB(sb); 481 struct pts_mount_opts *opts = &fsi->mount_opts; 482 char s[12]; 483 484 /* We're supposed to be given the slave end of a pty */ ··· 505 if (!IS_ERR(dentry)) { 506 d_add(dentry, inode); 507 fsnotify_create(root->d_inode, dentry); 508 } 509 510 mutex_unlock(&root->d_inode->i_mutex); 511 512 - return 0; 513 } 514 515 struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) ··· 548 mutex_lock(&root->d_inode->i_mutex); 549 550 dentry = d_find_alias(inode); 551 - if (IS_ERR(dentry)) 552 - goto out; 553 554 - if (dentry) { 555 - inode->i_nlink--; 556 - d_delete(dentry); 557 - dput(dentry); /* d_alloc_name() in devpts_pty_new() */ 558 - } 559 - 560 dput(dentry); /* d_find_alias above */ 561 - out: 562 mutex_unlock(&root->d_inode->i_mutex); 563 } 564
··· 479 struct dentry *root = sb->s_root; 480 struct pts_fs_info *fsi = DEVPTS_SB(sb); 481 struct pts_mount_opts *opts = &fsi->mount_opts; 482 + int ret = 0; 483 char s[12]; 484 485 /* We're supposed to be given the slave end of a pty */ ··· 504 if (!IS_ERR(dentry)) { 505 d_add(dentry, inode); 506 fsnotify_create(root->d_inode, dentry); 507 + } else { 508 + iput(inode); 509 + ret = -ENOMEM; 510 } 511 512 mutex_unlock(&root->d_inode->i_mutex); 513 514 + return ret; 515 } 516 517 struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) ··· 544 mutex_lock(&root->d_inode->i_mutex); 545 546 dentry = d_find_alias(inode); 547 548 + inode->i_nlink--; 549 + d_delete(dentry); 550 + dput(dentry); /* d_alloc_name() in devpts_pty_new() */ 551 dput(dentry); /* d_find_alias above */ 552 + 553 mutex_unlock(&root->d_inode->i_mutex); 554 } 555
+1 -1
fs/exec.c
··· 1875 1876 1877 /* 1878 - * uhm_pipe_setup 1879 * helper function to customize the process used 1880 * to collect the core in userspace. Specifically 1881 * it sets up a pipe and installs it as fd 0 (stdin)
··· 1875 1876 1877 /* 1878 + * umh_pipe_setup 1879 * helper function to customize the process used 1880 * to collect the core in userspace. Specifically 1881 * it sets up a pipe and installs it as fd 0 (stdin)
+1 -2
fs/fifo.c
··· 66 /* suppress POLLHUP until we have 67 * seen a writer */ 68 filp->f_version = pipe->w_counter; 69 - } else 70 - { 71 wait_for_partner(inode, &pipe->w_counter); 72 if(signal_pending(current)) 73 goto err_rd;
··· 66 /* suppress POLLHUP until we have 67 * seen a writer */ 68 filp->f_version = pipe->w_counter; 69 + } else { 70 wait_for_partner(inode, &pipe->w_counter); 71 if(signal_pending(current)) 72 goto err_rd;
+1 -1
fs/inode.c
··· 1715 EXPORT_SYMBOL(init_special_inode); 1716 1717 /** 1718 - * Init uid,gid,mode for new inode according to posix standards 1719 * @inode: New inode 1720 * @dir: Directory inode 1721 * @mode: mode of the new inode
··· 1715 EXPORT_SYMBOL(init_special_inode); 1716 1717 /** 1718 + * inode_init_owner - Init uid,gid,mode for new inode according to posix standards 1719 * @inode: New inode 1720 * @dir: Directory inode 1721 * @mode: mode of the new inode
+1
fs/internal.h
··· 64 65 extern unsigned int mnt_get_count(struct vfsmount *mnt); 66 extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int); 67 extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *, 68 struct vfsmount *); 69 extern void release_mounts(struct list_head *);
··· 64 65 extern unsigned int mnt_get_count(struct vfsmount *mnt); 66 extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int); 67 + extern struct vfsmount *lookup_mnt(struct path *); 68 extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *, 69 struct vfsmount *); 70 extern void release_mounts(struct list_head *);
+8 -13
fs/ioctl.c
··· 548 { 549 int error = 0; 550 int __user *argp = (int __user *)arg; 551 552 switch (cmd) { 553 case FIOCLEX: ··· 568 break; 569 570 case FIOQSIZE: 571 - if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) || 572 - S_ISREG(filp->f_path.dentry->d_inode->i_mode) || 573 - S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) { 574 - loff_t res = 575 - inode_get_bytes(filp->f_path.dentry->d_inode); 576 - error = copy_to_user((loff_t __user *)arg, &res, 577 - sizeof(res)) ? -EFAULT : 0; 578 } else 579 error = -ENOTTY; 580 break; ··· 589 return ioctl_fiemap(filp, arg); 590 591 case FIGETBSZ: 592 - { 593 - struct inode *inode = filp->f_path.dentry->d_inode; 594 - int __user *p = (int __user *)arg; 595 - return put_user(inode->i_sb->s_blocksize, p); 596 - } 597 598 default: 599 - if (S_ISREG(filp->f_path.dentry->d_inode->i_mode)) 600 error = file_ioctl(filp, cmd, arg); 601 else 602 error = vfs_ioctl(filp, cmd, arg);
··· 548 { 549 int error = 0; 550 int __user *argp = (int __user *)arg; 551 + struct inode *inode = filp->f_path.dentry->d_inode; 552 553 switch (cmd) { 554 case FIOCLEX: ··· 567 break; 568 569 case FIOQSIZE: 570 + if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode) || 571 + S_ISLNK(inode->i_mode)) { 572 + loff_t res = inode_get_bytes(inode); 573 + error = copy_to_user(argp, &res, sizeof(res)) ? 574 + -EFAULT : 0; 575 } else 576 error = -ENOTTY; 577 break; ··· 590 return ioctl_fiemap(filp, arg); 591 592 case FIGETBSZ: 593 + return put_user(inode->i_sb->s_blocksize, argp); 594 595 default: 596 + if (S_ISREG(inode->i_mode)) 597 error = file_ioctl(filp, cmd, arg); 598 else 599 error = vfs_ioctl(filp, cmd, arg);
+2 -2
fs/nfs/namespace.c
··· 98 namelen--; 99 buflen -= namelen; 100 if (buflen < 0) { 101 - spin_lock(&dentry->d_lock); 102 rcu_read_unlock(); 103 goto Elong; 104 } ··· 108 rcu_read_unlock(); 109 return end; 110 Elong_unlock: 111 - spin_lock(&dentry->d_lock); 112 rcu_read_unlock(); 113 if (read_seqretry(&rename_lock, seq)) 114 goto rename_retry;
··· 98 namelen--; 99 buflen -= namelen; 100 if (buflen < 0) { 101 + spin_unlock(&dentry->d_lock); 102 rcu_read_unlock(); 103 goto Elong; 104 } ··· 108 rcu_read_unlock(); 109 return end; 110 Elong_unlock: 111 + spin_unlock(&dentry->d_lock); 112 rcu_read_unlock(); 113 if (read_seqretry(&rename_lock, seq)) 114 goto rename_retry;
+2 -11
fs/open.c
··· 835 836 validate_creds(cred); 837 838 - /* 839 - * We must always pass in a valid mount pointer. Historically 840 - * callers got away with not passing it, but we must enforce this at 841 - * the earliest possible point now to avoid strange problems deep in the 842 - * filesystem stack. 843 - */ 844 - if (!mnt) { 845 - printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__); 846 - dump_stack(); 847 - return ERR_PTR(-EINVAL); 848 - } 849 850 error = -ENFILE; 851 f = get_empty_filp();
··· 835 836 validate_creds(cred); 837 838 + /* We must always pass in a valid mount pointer. */ 839 + BUG_ON(!mnt); 840 841 error = -ENFILE; 842 f = get_empty_filp();
+7 -1
fs/pstore/inode.c
··· 73 struct pstore_private *p = dentry->d_inode->i_private; 74 75 p->erase(p->id); 76 - kfree(p); 77 78 return simple_unlink(dir, dentry); 79 } 80 81 static const struct inode_operations pstore_dir_inode_operations = { ··· 115 static const struct super_operations pstore_ops = { 116 .statfs = simple_statfs, 117 .drop_inode = generic_delete_inode, 118 .show_options = generic_show_options, 119 }; 120
··· 73 struct pstore_private *p = dentry->d_inode->i_private; 74 75 p->erase(p->id); 76 77 return simple_unlink(dir, dentry); 78 + } 79 + 80 + static void pstore_evict_inode(struct inode *inode) 81 + { 82 + end_writeback(inode); 83 + kfree(inode->i_private); 84 } 85 86 static const struct inode_operations pstore_dir_inode_operations = { ··· 110 static const struct super_operations pstore_ops = { 111 .statfs = simple_statfs, 112 .drop_inode = generic_delete_inode, 113 + .evict_inode = pstore_evict_inode, 114 .show_options = generic_show_options, 115 }; 116
-3
fs/select.c
··· 517 * Update: ERESTARTSYS breaks at least the xview clock binary, so 518 * I'm trying ERESTARTNOHAND which restart only when you want to. 519 */ 520 - #define MAX_SELECT_SECONDS \ 521 - ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1) 522 - 523 int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, 524 fd_set __user *exp, struct timespec *end_time) 525 {
··· 517 * Update: ERESTARTSYS breaks at least the xview clock binary, so 518 * I'm trying ERESTARTNOHAND which restart only when you want to. 519 */ 520 int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, 521 fd_set __user *exp, struct timespec *end_time) 522 {
+24
fs/sync.c
··· 7 #include <linux/fs.h> 8 #include <linux/slab.h> 9 #include <linux/module.h> 10 #include <linux/sched.h> 11 #include <linux/writeback.h> 12 #include <linux/syscalls.h> ··· 127 INIT_WORK(work, do_sync_work); 128 schedule_work(work); 129 } 130 } 131 132 /**
··· 7 #include <linux/fs.h> 8 #include <linux/slab.h> 9 #include <linux/module.h> 10 + #include <linux/namei.h> 11 #include <linux/sched.h> 12 #include <linux/writeback.h> 13 #include <linux/syscalls.h> ··· 126 INIT_WORK(work, do_sync_work); 127 schedule_work(work); 128 } 129 + } 130 + 131 + /* 132 + * sync a single super 133 + */ 134 + SYSCALL_DEFINE1(syncfs, int, fd) 135 + { 136 + struct file *file; 137 + struct super_block *sb; 138 + int ret; 139 + int fput_needed; 140 + 141 + file = fget_light(fd, &fput_needed); 142 + if (!file) 143 + return -EBADF; 144 + sb = file->f_dentry->d_sb; 145 + 146 + down_read(&sb->s_umount); 147 + ret = sync_filesystem(sb); 148 + up_read(&sb->s_umount); 149 + 150 + fput_light(file, fput_needed); 151 + return ret; 152 } 153 154 /**
+3 -1
include/asm-generic/unistd.h
··· 652 __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) 653 #define __NR_clock_adjtime 266 654 __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) 655 656 #undef __NR_syscalls 657 - #define __NR_syscalls 267 658 659 /* 660 * All syscalls below here should go away really,
··· 652 __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) 653 #define __NR_clock_adjtime 266 654 __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) 655 + #define __NR_syncfs 264 656 + __SYSCALL(__NR_syncfs, sys_syncfs) 657 658 #undef __NR_syscalls 659 + #define __NR_syscalls 268 660 661 /* 662 * All syscalls below here should go away really,
-1
include/linux/dcache.h
··· 416 return dentry->d_flags & DCACHE_MOUNTED; 417 } 418 419 - extern struct vfsmount *lookup_mnt(struct path *); 420 extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); 421 422 extern int sysctl_vfs_cache_pressure;
··· 416 return dentry->d_flags & DCACHE_MOUNTED; 417 } 418 419 extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); 420 421 extern int sysctl_vfs_cache_pressure;
+1
include/linux/syscalls.h
··· 825 asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, 826 u64 mask, int fd, 827 const char __user *pathname); 828 829 int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 830
··· 825 asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, 826 u64 mask, int fd, 827 const char __user *pathname); 828 + asmlinkage long sys_syncfs(int fd); 829 830 int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 831