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()
This commit is contained in:
Linus Torvalds 2011-03-21 10:06:51 -07:00
commit 10effcb548
20 changed files with 67 additions and 51 deletions

View File

@ -847,4 +847,5 @@ ia32_sys_call_table:
.quad sys_name_to_handle_at
.quad compat_sys_open_by_handle_at
.quad compat_sys_clock_adjtime
.quad sys_syncfs
ia32_syscall_end:

View File

@ -349,10 +349,11 @@
#define __NR_name_to_handle_at 341
#define __NR_open_by_handle_at 342
#define __NR_clock_adjtime 343
#define __NR_syncfs 344
#ifdef __KERNEL__
#define NR_syscalls 344
#define NR_syscalls 345
#define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR

View File

@ -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)
#define __NR_clock_adjtime 305
__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
#define __NR_syncfs 306
__SYSCALL(__NR_syncfs, sys_syncfs)
#ifndef __NO_STUBS
#define __ARCH_WANT_OLD_READDIR

View File

@ -343,3 +343,4 @@ ENTRY(sys_call_table)
.long sys_name_to_handle_at
.long sys_open_by_handle_at
.long sys_clock_adjtime
.long sys_syncfs

View File

@ -97,7 +97,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
if (!inode)
return -ENOSPC;
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) {
mutex_unlock(&info->bfs_lock);
iput(inode);

View File

@ -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
* 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,
compat_ulong_t __user *outp, compat_ulong_t __user *exp,
struct timespec *end_time)

View File

@ -479,6 +479,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
struct dentry *root = sb->s_root;
struct pts_fs_info *fsi = DEVPTS_SB(sb);
struct pts_mount_opts *opts = &fsi->mount_opts;
int ret = 0;
char s[12];
/* 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)
if (!IS_ERR(dentry)) {
d_add(dentry, inode);
fsnotify_create(root->d_inode, dentry);
} else {
iput(inode);
ret = -ENOMEM;
}
mutex_unlock(&root->d_inode->i_mutex);
return 0;
return ret;
}
struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
@ -544,17 +548,12 @@ void devpts_pty_kill(struct tty_struct *tty)
mutex_lock(&root->d_inode->i_mutex);
dentry = d_find_alias(inode);
if (IS_ERR(dentry))
goto out;
if (dentry) {
inode->i_nlink--;
d_delete(dentry);
dput(dentry); /* d_alloc_name() in devpts_pty_new() */
}
inode->i_nlink--;
d_delete(dentry);
dput(dentry); /* d_alloc_name() in devpts_pty_new() */
dput(dentry); /* d_find_alias above */
out:
mutex_unlock(&root->d_inode->i_mutex);
}

View 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
* to collect the core in userspace. Specifically
* it sets up a pipe and installs it as fd 0 (stdin)

View File

@ -66,8 +66,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
/* suppress POLLHUP until we have
* seen a writer */
filp->f_version = pipe->w_counter;
} else
{
} else {
wait_for_partner(inode, &pipe->w_counter);
if(signal_pending(current))
goto err_rd;

View File

@ -1715,7 +1715,7 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev)
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
* @dir: Directory inode
* @mode: mode of the new inode

View File

@ -64,6 +64,7 @@ extern int copy_mount_string(const void __user *, char **);
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 path *);
extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
struct vfsmount *);
extern void release_mounts(struct list_head *);

View File

@ -548,6 +548,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
{
int error = 0;
int __user *argp = (int __user *)arg;
struct inode *inode = filp->f_path.dentry->d_inode;
switch (cmd) {
case FIOCLEX:
@ -567,13 +568,11 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
break;
case FIOQSIZE:
if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) ||
S_ISREG(filp->f_path.dentry->d_inode->i_mode) ||
S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) {
loff_t res =
inode_get_bytes(filp->f_path.dentry->d_inode);
error = copy_to_user((loff_t __user *)arg, &res,
sizeof(res)) ? -EFAULT : 0;
if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode) ||
S_ISLNK(inode->i_mode)) {
loff_t res = inode_get_bytes(inode);
error = copy_to_user(argp, &res, sizeof(res)) ?
-EFAULT : 0;
} else
error = -ENOTTY;
break;
@ -590,14 +589,10 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
return ioctl_fiemap(filp, arg);
case FIGETBSZ:
{
struct inode *inode = filp->f_path.dentry->d_inode;
int __user *p = (int __user *)arg;
return put_user(inode->i_sb->s_blocksize, p);
}
return put_user(inode->i_sb->s_blocksize, argp);
default:
if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
if (S_ISREG(inode->i_mode))
error = file_ioctl(filp, cmd, arg);
else
error = vfs_ioctl(filp, cmd, arg);

View File

@ -98,7 +98,7 @@ rename_retry:
namelen--;
buflen -= namelen;
if (buflen < 0) {
spin_lock(&dentry->d_lock);
spin_unlock(&dentry->d_lock);
rcu_read_unlock();
goto Elong;
}
@ -108,7 +108,7 @@ rename_retry:
rcu_read_unlock();
return end;
Elong_unlock:
spin_lock(&dentry->d_lock);
spin_unlock(&dentry->d_lock);
rcu_read_unlock();
if (read_seqretry(&rename_lock, seq))
goto rename_retry;

View File

@ -835,17 +835,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,
validate_creds(cred);
/*
* We must always pass in a valid mount pointer. Historically
* 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);
}
/* We must always pass in a valid mount pointer. */
BUG_ON(!mnt);
error = -ENFILE;
f = get_empty_filp();

View File

@ -73,11 +73,16 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry)
struct pstore_private *p = dentry->d_inode->i_private;
p->erase(p->id);
kfree(p);
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 = {
.lookup = simple_lookup,
.unlink = pstore_unlink,
@ -110,6 +115,7 @@ static struct inode *pstore_get_inode(struct super_block *sb,
static const struct super_operations pstore_ops = {
.statfs = simple_statfs,
.drop_inode = generic_delete_inode,
.evict_inode = pstore_evict_inode,
.show_options = generic_show_options,
};

View File

@ -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
* 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,
fd_set __user *exp, struct timespec *end_time)
{

View File

@ -7,6 +7,7 @@
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/namei.h>
#include <linux/sched.h>
#include <linux/writeback.h>
#include <linux/syscalls.h>
@ -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
* @file: file to sync

View File

@ -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)
#define __NR_clock_adjtime 266
__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
#define __NR_syncfs 264
__SYSCALL(__NR_syncfs, sys_syncfs)
#undef __NR_syscalls
#define __NR_syscalls 267
#define __NR_syscalls 268
/*
* All syscalls below here should go away really,

View File

@ -416,7 +416,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
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 int sysctl_vfs_cache_pressure;

View File

@ -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,
u64 mask, int fd,
const char __user *pathname);
asmlinkage long sys_syncfs(int fd);
int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);