Commit 10effcb5 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents c3ca48f0 0f60f240
...@@ -847,4 +847,5 @@ ia32_sys_call_table: ...@@ -847,4 +847,5 @@ ia32_sys_call_table:
.quad sys_name_to_handle_at .quad sys_name_to_handle_at
.quad compat_sys_open_by_handle_at .quad compat_sys_open_by_handle_at
.quad compat_sys_clock_adjtime .quad compat_sys_clock_adjtime
.quad sys_syncfs
ia32_syscall_end: ia32_syscall_end:
...@@ -349,10 +349,11 @@ ...@@ -349,10 +349,11 @@
#define __NR_name_to_handle_at 341 #define __NR_name_to_handle_at 341
#define __NR_open_by_handle_at 342 #define __NR_open_by_handle_at 342
#define __NR_clock_adjtime 343 #define __NR_clock_adjtime 343
#define __NR_syncfs 344
#ifdef __KERNEL__ #ifdef __KERNEL__
#define NR_syscalls 344 #define NR_syscalls 345
#define __ARCH_WANT_IPC_PARSE_VERSION #define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_READDIR
......
...@@ -675,6 +675,8 @@ __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) ...@@ -675,6 +675,8 @@ __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
#define __NR_clock_adjtime 305 #define __NR_clock_adjtime 305
__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
#define __NR_syncfs 306
__SYSCALL(__NR_syncfs, sys_syncfs)
#ifndef __NO_STUBS #ifndef __NO_STUBS
#define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_READDIR
......
...@@ -343,3 +343,4 @@ ENTRY(sys_call_table) ...@@ -343,3 +343,4 @@ ENTRY(sys_call_table)
.long sys_name_to_handle_at .long sys_name_to_handle_at
.long sys_open_by_handle_at .long sys_open_by_handle_at
.long sys_clock_adjtime .long sys_clock_adjtime
.long sys_syncfs
...@@ -97,7 +97,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode, ...@@ -97,7 +97,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
if (!inode) if (!inode)
return -ENOSPC; return -ENOSPC;
mutex_lock(&info->bfs_lock); mutex_lock(&info->bfs_lock);
ino = find_first_zero_bit(info->si_imap, info->si_lasti); ino = find_first_zero_bit(info->si_imap, info->si_lasti + 1);
if (ino > info->si_lasti) { if (ino > info->si_lasti) {
mutex_unlock(&info->bfs_lock); mutex_unlock(&info->bfs_lock);
iput(inode); iput(inode);
......
...@@ -1671,9 +1671,6 @@ int compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset, ...@@ -1671,9 +1671,6 @@ int compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
* Update: ERESTARTSYS breaks at least the xview clock binary, so * Update: ERESTARTSYS breaks at least the xview clock binary, so
* I'm trying ERESTARTNOHAND which restart only when you want to. * I'm trying ERESTARTNOHAND which restart only when you want to.
*/ */
#define MAX_SELECT_SECONDS \
((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
int compat_core_sys_select(int n, compat_ulong_t __user *inp, int compat_core_sys_select(int n, compat_ulong_t __user *inp,
compat_ulong_t __user *outp, compat_ulong_t __user *exp, compat_ulong_t __user *outp, compat_ulong_t __user *exp,
struct timespec *end_time) struct timespec *end_time)
......
...@@ -479,6 +479,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) ...@@ -479,6 +479,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
struct dentry *root = sb->s_root; struct dentry *root = sb->s_root;
struct pts_fs_info *fsi = DEVPTS_SB(sb); struct pts_fs_info *fsi = DEVPTS_SB(sb);
struct pts_mount_opts *opts = &fsi->mount_opts; struct pts_mount_opts *opts = &fsi->mount_opts;
int ret = 0;
char s[12]; char s[12];
/* We're supposed to be given the slave end of a pty */ /* We're supposed to be given the slave end of a pty */
...@@ -504,11 +505,14 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) ...@@ -504,11 +505,14 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
if (!IS_ERR(dentry)) { if (!IS_ERR(dentry)) {
d_add(dentry, inode); d_add(dentry, inode);
fsnotify_create(root->d_inode, dentry); fsnotify_create(root->d_inode, dentry);
} else {
iput(inode);
ret = -ENOMEM;
} }
mutex_unlock(&root->d_inode->i_mutex); mutex_unlock(&root->d_inode->i_mutex);
return 0; return ret;
} }
struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number) struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
...@@ -544,17 +548,12 @@ void devpts_pty_kill(struct tty_struct *tty) ...@@ -544,17 +548,12 @@ void devpts_pty_kill(struct tty_struct *tty)
mutex_lock(&root->d_inode->i_mutex); mutex_lock(&root->d_inode->i_mutex);
dentry = d_find_alias(inode); dentry = d_find_alias(inode);
if (IS_ERR(dentry))
goto out;
if (dentry) {
inode->i_nlink--; inode->i_nlink--;
d_delete(dentry); d_delete(dentry);
dput(dentry); /* d_alloc_name() in devpts_pty_new() */ dput(dentry); /* d_alloc_name() in devpts_pty_new() */
}
dput(dentry); /* d_find_alias above */ dput(dentry); /* d_find_alias above */
out:
mutex_unlock(&root->d_inode->i_mutex); mutex_unlock(&root->d_inode->i_mutex);
} }
......
...@@ -1875,7 +1875,7 @@ static void wait_for_dump_helpers(struct file *file) ...@@ -1875,7 +1875,7 @@ static void wait_for_dump_helpers(struct file *file)
/* /*
* uhm_pipe_setup * umh_pipe_setup
* helper function to customize the process used * helper function to customize the process used
* to collect the core in userspace. Specifically * to collect the core in userspace. Specifically
* it sets up a pipe and installs it as fd 0 (stdin) * it sets up a pipe and installs it as fd 0 (stdin)
......
...@@ -66,8 +66,7 @@ static int fifo_open(struct inode *inode, struct file *filp) ...@@ -66,8 +66,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
/* suppress POLLHUP until we have /* suppress POLLHUP until we have
* seen a writer */ * seen a writer */
filp->f_version = pipe->w_counter; filp->f_version = pipe->w_counter;
} else } else {
{
wait_for_partner(inode, &pipe->w_counter); wait_for_partner(inode, &pipe->w_counter);
if(signal_pending(current)) if(signal_pending(current))
goto err_rd; goto err_rd;
......
...@@ -1715,7 +1715,7 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev) ...@@ -1715,7 +1715,7 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev)
EXPORT_SYMBOL(init_special_inode); EXPORT_SYMBOL(init_special_inode);
/** /**
* Init uid,gid,mode for new inode according to posix standards * inode_init_owner - Init uid,gid,mode for new inode according to posix standards
* @inode: New inode * @inode: New inode
* @dir: Directory inode * @dir: Directory inode
* @mode: mode of the new inode * @mode: mode of the new inode
......
...@@ -64,6 +64,7 @@ extern int copy_mount_string(const void __user *, char **); ...@@ -64,6 +64,7 @@ extern int copy_mount_string(const void __user *, char **);
extern unsigned int mnt_get_count(struct vfsmount *mnt); extern unsigned int mnt_get_count(struct vfsmount *mnt);
extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int); extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
extern struct vfsmount *lookup_mnt(struct path *);
extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *, extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
struct vfsmount *); struct vfsmount *);
extern void release_mounts(struct list_head *); extern void release_mounts(struct list_head *);
......
...@@ -548,6 +548,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, ...@@ -548,6 +548,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
{ {
int error = 0; int error = 0;
int __user *argp = (int __user *)arg; int __user *argp = (int __user *)arg;
struct inode *inode = filp->f_path.dentry->d_inode;
switch (cmd) { switch (cmd) {
case FIOCLEX: case FIOCLEX:
...@@ -567,13 +568,11 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, ...@@ -567,13 +568,11 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
break; break;
case FIOQSIZE: case FIOQSIZE:
if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) || if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode) ||
S_ISREG(filp->f_path.dentry->d_inode->i_mode) || S_ISLNK(inode->i_mode)) {
S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) { loff_t res = inode_get_bytes(inode);
loff_t res = error = copy_to_user(argp, &res, sizeof(res)) ?
inode_get_bytes(filp->f_path.dentry->d_inode); -EFAULT : 0;
error = copy_to_user((loff_t __user *)arg, &res,
sizeof(res)) ? -EFAULT : 0;
} else } else
error = -ENOTTY; error = -ENOTTY;
break; break;
...@@ -590,14 +589,10 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, ...@@ -590,14 +589,10 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
return ioctl_fiemap(filp, arg); return ioctl_fiemap(filp, arg);
case FIGETBSZ: case FIGETBSZ:
{ return put_user(inode->i_sb->s_blocksize, argp);
struct inode *inode = filp->f_path.dentry->d_inode;
int __user *p = (int __user *)arg;
return put_user(inode->i_sb->s_blocksize, p);
}
default: default:
if (S_ISREG(filp->f_path.dentry->d_inode->i_mode)) if (S_ISREG(inode->i_mode))
error = file_ioctl(filp, cmd, arg); error = file_ioctl(filp, cmd, arg);
else else
error = vfs_ioctl(filp, cmd, arg); error = vfs_ioctl(filp, cmd, arg);
......
...@@ -98,7 +98,7 @@ char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen) ...@@ -98,7 +98,7 @@ char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)
namelen--; namelen--;
buflen -= namelen; buflen -= namelen;
if (buflen < 0) { if (buflen < 0) {
spin_lock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
rcu_read_unlock(); rcu_read_unlock();
goto Elong; goto Elong;
} }
...@@ -108,7 +108,7 @@ char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen) ...@@ -108,7 +108,7 @@ char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)
rcu_read_unlock(); rcu_read_unlock();
return end; return end;
Elong_unlock: Elong_unlock:
spin_lock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
rcu_read_unlock(); rcu_read_unlock();
if (read_seqretry(&rename_lock, seq)) if (read_seqretry(&rename_lock, seq))
goto rename_retry; goto rename_retry;
......
...@@ -835,17 +835,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags, ...@@ -835,17 +835,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,
validate_creds(cred); validate_creds(cred);
/* /* We must always pass in a valid mount pointer. */
* We must always pass in a valid mount pointer. Historically BUG_ON(!mnt);
* callers got away with not passing it, but we must enforce this at
* the earliest possible point now to avoid strange problems deep in the
* filesystem stack.
*/
if (!mnt) {
printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
dump_stack();
return ERR_PTR(-EINVAL);
}
error = -ENFILE; error = -ENFILE;
f = get_empty_filp(); f = get_empty_filp();
......
...@@ -73,11 +73,16 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry) ...@@ -73,11 +73,16 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry)
struct pstore_private *p = dentry->d_inode->i_private; struct pstore_private *p = dentry->d_inode->i_private;
p->erase(p->id); p->erase(p->id);
kfree(p);
return simple_unlink(dir, dentry); return simple_unlink(dir, dentry);
} }
static void pstore_evict_inode(struct inode *inode)
{
end_writeback(inode);
kfree(inode->i_private);
}
static const struct inode_operations pstore_dir_inode_operations = { static const struct inode_operations pstore_dir_inode_operations = {
.lookup = simple_lookup, .lookup = simple_lookup,
.unlink = pstore_unlink, .unlink = pstore_unlink,
...@@ -110,6 +115,7 @@ static struct inode *pstore_get_inode(struct super_block *sb, ...@@ -110,6 +115,7 @@ static struct inode *pstore_get_inode(struct super_block *sb,
static const struct super_operations pstore_ops = { static const struct super_operations pstore_ops = {
.statfs = simple_statfs, .statfs = simple_statfs,
.drop_inode = generic_delete_inode, .drop_inode = generic_delete_inode,
.evict_inode = pstore_evict_inode,
.show_options = generic_show_options, .show_options = generic_show_options,
}; };
......
...@@ -517,9 +517,6 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time) ...@@ -517,9 +517,6 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
* Update: ERESTARTSYS breaks at least the xview clock binary, so * Update: ERESTARTSYS breaks at least the xview clock binary, so
* I'm trying ERESTARTNOHAND which restart only when you want to. * I'm trying ERESTARTNOHAND which restart only when you want to.
*/ */
#define MAX_SELECT_SECONDS \
((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
fd_set __user *exp, struct timespec *end_time) fd_set __user *exp, struct timespec *end_time)
{ {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/namei.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/writeback.h> #include <linux/writeback.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
...@@ -128,6 +129,29 @@ void emergency_sync(void) ...@@ -128,6 +129,29 @@ void emergency_sync(void)
} }
} }
/*
* sync a single super
*/
SYSCALL_DEFINE1(syncfs, int, fd)
{
struct file *file;
struct super_block *sb;
int ret;
int fput_needed;
file = fget_light(fd, &fput_needed);
if (!file)
return -EBADF;
sb = file->f_dentry->d_sb;
down_read(&sb->s_umount);
ret = sync_filesystem(sb);
up_read(&sb->s_umount);
fput_light(file, fput_needed);
return ret;
}
/** /**
* vfs_fsync_range - helper to sync a range of data & metadata to disk * vfs_fsync_range - helper to sync a range of data & metadata to disk
* @file: file to sync * @file: file to sync
......
...@@ -652,9 +652,11 @@ __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) ...@@ -652,9 +652,11 @@ __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
#define __NR_clock_adjtime 266 #define __NR_clock_adjtime 266
__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime) __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
#define __NR_syncfs 264
__SYSCALL(__NR_syncfs, sys_syncfs)
#undef __NR_syscalls #undef __NR_syscalls
#define __NR_syscalls 267 #define __NR_syscalls 268
/* /*
* All syscalls below here should go away really, * All syscalls below here should go away really,
......
...@@ -416,7 +416,6 @@ static inline bool d_mountpoint(struct dentry *dentry) ...@@ -416,7 +416,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
return dentry->d_flags & DCACHE_MOUNTED; return dentry->d_flags & DCACHE_MOUNTED;
} }
extern struct vfsmount *lookup_mnt(struct path *);
extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
extern int sysctl_vfs_cache_pressure; extern int sysctl_vfs_cache_pressure;
......
...@@ -825,6 +825,7 @@ asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags ...@@ -825,6 +825,7 @@ asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags
asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
u64 mask, int fd, u64 mask, int fd,
const char __user *pathname); const char __user *pathname);
asmlinkage long sys_syncfs(int fd);
int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment