Commit 520c8534 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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:
  inotify: fix type errors in interfaces
  fix breakage in reiserfs_new_inode()
  fix the treatment of jfs special inodes
  vfs: remove duplicate code in get_fs_type()
  add a vfs_fsync helper
  sys_execve and sys_uselib do not call into fsnotify
  zero i_uid/i_gid on inode allocation
  inode->i_op is never NULL
  ntfs: don't NULL i_op
  isofs check for NULL ->i_op in root directory is dead code
  affs: do not zero ->i_op
  kill suid bit only for regular files
  vfs: lseek(fd, 0, SEEK_CUR) race condition
parents e8c82c2e 4ae8978c
...@@ -97,7 +97,6 @@ spufs_new_inode(struct super_block *sb, int mode) ...@@ -97,7 +97,6 @@ spufs_new_inode(struct super_block *sb, int mode)
inode->i_mode = mode; inode->i_mode = mode;
inode->i_uid = current_fsuid(); inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid(); inode->i_gid = current_fsgid();
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
out: out:
return inode; return inode;
......
...@@ -106,7 +106,6 @@ static struct inode *hypfs_make_inode(struct super_block *sb, int mode) ...@@ -106,7 +106,6 @@ static struct inode *hypfs_make_inode(struct super_block *sb, int mode)
ret->i_mode = mode; ret->i_mode = mode;
ret->i_uid = hypfs_info->uid; ret->i_uid = hypfs_info->uid;
ret->i_gid = hypfs_info->gid; ret->i_gid = hypfs_info->gid;
ret->i_blocks = 0;
ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
if (mode & S_IFDIR) if (mode & S_IFDIR)
ret->i_nlink = 2; ret->i_nlink = 2;
......
...@@ -57,9 +57,6 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry, ...@@ -57,9 +57,6 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
} }
inode->i_mode = mode; inode->i_mode = mode;
inode->i_uid = 0;
inode->i_gid = 0;
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
inode->i_private = data; inode->i_private = data;
if ((mode & S_IFMT) == S_IFDIR) { if ((mode & S_IFMT) == S_IFDIR) {
......
...@@ -111,8 +111,6 @@ capifs_fill_super(struct super_block *s, void *data, int silent) ...@@ -111,8 +111,6 @@ capifs_fill_super(struct super_block *s, void *data, int silent)
goto fail; goto fail;
inode->i_ino = 1; inode->i_ino = 1;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_blocks = 0;
inode->i_uid = inode->i_gid = 0;
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
inode->i_op = &simple_dir_inode_operations; inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations; inode->i_fop = &simple_dir_operations;
......
...@@ -146,8 +146,6 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode) ...@@ -146,8 +146,6 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
if (ret) { if (ret) {
ret->i_mode = mode; ret->i_mode = mode;
ret->i_uid = ret->i_gid = 0;
ret->i_blocks = 0;
ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
} }
return ret; return ret;
......
...@@ -29,9 +29,6 @@ static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode) ...@@ -29,9 +29,6 @@ static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
if (inode) { if (inode) {
inode->i_mode = mode; inode->i_mode = mode;
inode->i_uid = 0;
inode->i_gid = 0;
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
} }
return inode; return inode;
......
...@@ -279,7 +279,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de ...@@ -279,7 +279,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de
inode->i_mode = mode; inode->i_mode = mode;
inode->i_uid = current_fsuid(); inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid(); inode->i_gid = current_fsgid();
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
default: default:
......
...@@ -1863,26 +1863,10 @@ static int do_write(struct fsg_dev *fsg) ...@@ -1863,26 +1863,10 @@ static int do_write(struct fsg_dev *fsg)
static int fsync_sub(struct lun *curlun) static int fsync_sub(struct lun *curlun)
{ {
struct file *filp = curlun->filp; struct file *filp = curlun->filp;
struct inode *inode;
int rc, err;
if (curlun->ro || !filp) if (curlun->ro || !filp)
return 0; return 0;
if (!filp->f_op->fsync) return vfs_fsync(filp, filp->f_path.dentry, 1);
return -EINVAL;
inode = filp->f_path.dentry->d_inode;
mutex_lock(&inode->i_mutex);
rc = filemap_fdatawrite(inode->i_mapping);
err = filp->f_op->fsync(filp, filp->f_path.dentry, 1);
if (!rc)
rc = err;
err = filemap_fdatawait(inode->i_mapping);
if (!rc)
rc = err;
mutex_unlock(&inode->i_mutex);
VLDBG(curlun, "fdatasync -> %d\n", rc);
return rc;
} }
static void fsync_all(struct fsg_dev *fsg) static void fsync_all(struct fsg_dev *fsg)
......
...@@ -2001,7 +2001,6 @@ gadgetfs_make_inode (struct super_block *sb, ...@@ -2001,7 +2001,6 @@ gadgetfs_make_inode (struct super_block *sb,
inode->i_mode = mode; inode->i_mode = mode;
inode->i_uid = default_uid; inode->i_uid = default_uid;
inode->i_gid = default_gid; inode->i_gid = default_gid;
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime inode->i_atime = inode->i_mtime = inode->i_ctime
= CURRENT_TIME; = CURRENT_TIME;
inode->i_private = data; inode->i_private = data;
......
...@@ -119,8 +119,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) ...@@ -119,8 +119,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
goto bad_inode; goto bad_inode;
#else #else
inode->i_mode |= S_IFDIR; inode->i_mode |= S_IFDIR;
inode->i_op = NULL; /* ... and leave ->i_op and ->i_fop pointing to empty */
inode->i_fop = NULL;
break; break;
#endif #endif
case ST_LINKFILE: case ST_LINKFILE:
......
...@@ -251,13 +251,11 @@ struct inode *autofs_iget(struct super_block *sb, unsigned long ino) ...@@ -251,13 +251,11 @@ struct inode *autofs_iget(struct super_block *sb, unsigned long ino)
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO; inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
inode->i_nlink = 2; inode->i_nlink = 2;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_blocks = 0;
if (ino == AUTOFS_ROOT_INO) { if (ino == AUTOFS_ROOT_INO) {
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
inode->i_op = &autofs_root_inode_operations; inode->i_op = &autofs_root_inode_operations;
inode->i_fop = &autofs_root_operations; inode->i_fop = &autofs_root_operations;
inode->i_uid = inode->i_gid = 0; /* Changed in read_super */
goto done; goto done;
} }
......
...@@ -455,11 +455,7 @@ struct inode *autofs4_get_inode(struct super_block *sb, ...@@ -455,11 +455,7 @@ struct inode *autofs4_get_inode(struct super_block *sb,
if (sb->s_root) { if (sb->s_root) {
inode->i_uid = sb->s_root->d_inode->i_uid; inode->i_uid = sb->s_root->d_inode->i_uid;
inode->i_gid = sb->s_root->d_inode->i_gid; inode->i_gid = sb->s_root->d_inode->i_gid;
} else {
inode->i_uid = 0;
inode->i_gid = 0;
} }
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
if (S_ISDIR(inf->mode)) { if (S_ISDIR(inf->mode)) {
......
...@@ -496,9 +496,6 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode) ...@@ -496,9 +496,6 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)
if (inode) { if (inode) {
inode->i_mode = mode; inode->i_mode = mode;
inode->i_uid = 0;
inode->i_gid = 0;
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = inode->i_atime = inode->i_mtime = inode->i_ctime =
current_fs_time(inode->i_sb); current_fs_time(inode->i_sb);
} }
......
...@@ -1641,7 +1641,7 @@ static int cifs_vmtruncate(struct inode *inode, loff_t offset) ...@@ -1641,7 +1641,7 @@ static int cifs_vmtruncate(struct inode *inode, loff_t offset)
i_size_write(inode, offset); i_size_write(inode, offset);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
out_truncate: out_truncate:
if (inode->i_op && inode->i_op->truncate) if (inode->i_op->truncate)
inode->i_op->truncate(inode); inode->i_op->truncate(inode);
return 0; return 0;
out_sig: out_sig:
......
...@@ -201,8 +201,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file) ...@@ -201,8 +201,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync) int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
{ {
struct file *host_file; struct file *host_file;
struct dentry *host_dentry; struct inode *coda_inode = coda_dentry->d_inode;
struct inode *host_inode, *coda_inode = coda_dentry->d_inode;
struct coda_file_info *cfi; struct coda_file_info *cfi;
int err = 0; int err = 0;
...@@ -214,14 +213,7 @@ int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync) ...@@ -214,14 +213,7 @@ int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
host_file = cfi->cfi_container; host_file = cfi->cfi_container;
if (host_file->f_op && host_file->f_op->fsync) { err = vfs_fsync(host_file, host_file->f_path.dentry, datasync);
host_dentry = host_file->f_path.dentry;
host_inode = host_dentry->d_inode;
mutex_lock(&host_inode->i_mutex);
err = host_file->f_op->fsync(host_file, host_dentry, datasync);
mutex_unlock(&host_inode->i_mutex);
}
if ( !err && !datasync ) { if ( !err && !datasync ) {
lock_kernel(); lock_kernel();
err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode)); err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode));
......
...@@ -117,8 +117,6 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr) ...@@ -117,8 +117,6 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
static inline void set_default_inode_attr(struct inode * inode, mode_t mode) static inline void set_default_inode_attr(struct inode * inode, mode_t mode)
{ {
inode->i_mode = mode; inode->i_mode = mode;
inode->i_uid = 0;
inode->i_gid = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
} }
...@@ -136,7 +134,6 @@ struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd) ...@@ -136,7 +134,6 @@ struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd)
{ {
struct inode * inode = new_inode(configfs_sb); struct inode * inode = new_inode(configfs_sb);
if (inode) { if (inode) {
inode->i_blocks = 0;
inode->i_mapping->a_ops = &configfs_aops; inode->i_mapping->a_ops = &configfs_aops;
inode->i_mapping->backing_dev_info = &configfs_backing_dev_info; inode->i_mapping->backing_dev_info = &configfs_backing_dev_info;
inode->i_op = &configfs_inode_operations; inode->i_op = &configfs_inode_operations;
......
...@@ -83,8 +83,6 @@ static struct inode *get_cramfs_inode(struct super_block *sb, ...@@ -83,8 +83,6 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
inode->i_op = &page_symlink_inode_operations; inode->i_op = &page_symlink_inode_operations;
inode->i_data.a_ops = &cramfs_aops; inode->i_data.a_ops = &cramfs_aops;
} else { } else {
inode->i_size = 0;
inode->i_blocks = 0;
init_special_inode(inode, inode->i_mode, init_special_inode(inode, inode->i_mode,
old_decode_dev(cramfs_inode->size)); old_decode_dev(cramfs_inode->size));
} }
......
...@@ -37,9 +37,6 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d ...@@ -37,9 +37,6 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
if (inode) { if (inode) {
inode->i_mode = mode; inode->i_mode = mode;
inode->i_uid = 0;
inode->i_gid = 0;
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
default: default:
......
...@@ -189,8 +189,6 @@ static int mknod_ptmx(struct super_block *sb) ...@@ -189,8 +189,6 @@ static int mknod_ptmx(struct super_block *sb)
} }
inode->i_ino = 2; inode->i_ino = 2;
inode->i_uid = inode->i_gid = 0;
inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
mode = S_IFCHR|opts->ptmxmode; mode = S_IFCHR|opts->ptmxmode;
...@@ -300,8 +298,6 @@ devpts_fill_super(struct super_block *s, void *data, int silent) ...@@ -300,8 +298,6 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
goto free_fsi; goto free_fsi;
inode->i_ino = 1; inode->i_ino = 1;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
inode->i_blocks = 0;
inode->i_uid = inode->i_gid = 0;
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
inode->i_op = &simple_dir_inode_operations; inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations; inode->i_fop = &simple_dir_operations;
......
...@@ -275,18 +275,9 @@ static int ecryptfs_release(struct inode *inode, struct file *file) ...@@ -275,18 +275,9 @@ static int ecryptfs_release(struct inode *inode, struct file *file)
static int static int
ecryptfs_fsync(struct file *file, struct dentry *dentry, int datasync) ecryptfs_fsync(struct file *file, struct dentry *dentry, int datasync)
{ {
struct file *lower_file = ecryptfs_file_to_lower(file); return vfs_fsync(ecryptfs_file_to_lower(file),
struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); ecryptfs_dentry_to_lower(dentry),
struct inode *lower_inode = lower_dentry->d_inode; datasync);
int rc = -EINVAL;
if (lower_inode->i_fop->fsync) {
mutex_lock(&lower_inode->i_mutex);
rc = lower_inode->i_fop->fsync(lower_file, lower_dentry,
datasync);
mutex_unlock(&lower_inode->i_mutex);
}
return rc;
} }
static int ecryptfs_fasync(int fd, struct file *file, int flag) static int ecryptfs_fasync(int fd, struct file *file, int flag)
......
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