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