Commit 2a79f17e authored by Al Viro's avatar Al Viro

vfs: mnt_drop_write_file()

new helper (wrapper around mnt_drop_write()) to be used in pair with
mnt_want_write_file().
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 8c9379e9
...@@ -259,7 +259,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) ...@@ -259,7 +259,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
btrfs_end_transaction(trans, root); btrfs_end_transaction(trans, root);
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
ret = 0; ret = 0;
out_unlock: out_unlock:
...@@ -1971,7 +1971,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, ...@@ -1971,7 +1971,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
dput(dentry); dput(dentry);
out_unlock_dir: out_unlock_dir:
mutex_unlock(&dir->i_mutex); mutex_unlock(&dir->i_mutex);
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
out: out:
kfree(vol_args); kfree(vol_args);
return err; return err;
...@@ -2040,7 +2040,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) ...@@ -2040,7 +2040,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
ret = -EINVAL; ret = -EINVAL;
} }
out: out:
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
return ret; return ret;
} }
...@@ -2510,7 +2510,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, ...@@ -2510,7 +2510,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
out_fput: out_fput:
fput(src_file); fput(src_file);
out_drop_write: out_drop_write:
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
return ret; return ret;
} }
...@@ -2565,7 +2565,7 @@ static long btrfs_ioctl_trans_start(struct file *file) ...@@ -2565,7 +2565,7 @@ static long btrfs_ioctl_trans_start(struct file *file)
out_drop: out_drop:
atomic_dec(&root->fs_info->open_ioctl_trans); atomic_dec(&root->fs_info->open_ioctl_trans);
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
out: out:
return ret; return ret;
} }
...@@ -2800,7 +2800,7 @@ long btrfs_ioctl_trans_end(struct file *file) ...@@ -2800,7 +2800,7 @@ long btrfs_ioctl_trans_end(struct file *file)
atomic_dec(&root->fs_info->open_ioctl_trans); atomic_dec(&root->fs_info->open_ioctl_trans);
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
return 0; return 0;
} }
......
...@@ -83,7 +83,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -83,7 +83,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
inode->i_ctime = CURRENT_TIME_SEC; inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode); mark_inode_dirty(inode);
setflags_out: setflags_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return ret; return ret;
} }
case EXT2_IOC_GETVERSION: case EXT2_IOC_GETVERSION:
...@@ -100,7 +100,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -100,7 +100,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
inode->i_ctime = CURRENT_TIME_SEC; inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return ret; return ret;
case EXT2_IOC_GETRSVSZ: case EXT2_IOC_GETRSVSZ:
if (test_opt(inode->i_sb, RESERVATION) if (test_opt(inode->i_sb, RESERVATION)
...@@ -145,7 +145,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -145,7 +145,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
rsv->rsv_goal_size = rsv_window_size; rsv->rsv_goal_size = rsv_window_size;
} }
mutex_unlock(&ei->truncate_mutex); mutex_unlock(&ei->truncate_mutex);
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return 0; return 0;
} }
default: default:
......
...@@ -110,7 +110,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -110,7 +110,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
err = ext3_change_inode_journal_flag(inode, jflag); err = ext3_change_inode_journal_flag(inode, jflag);
flags_out: flags_out:
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
case EXT3_IOC_GETVERSION: case EXT3_IOC_GETVERSION:
...@@ -147,7 +147,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -147,7 +147,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
ext3_journal_stop(handle); ext3_journal_stop(handle);
setversion_out: setversion_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
case EXT3_IOC_GETRSVSZ: case EXT3_IOC_GETRSVSZ:
...@@ -195,7 +195,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -195,7 +195,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
mutex_unlock(&ei->truncate_mutex); mutex_unlock(&ei->truncate_mutex);
setrsvsz_out: setrsvsz_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
case EXT3_IOC_GROUP_EXTEND: { case EXT3_IOC_GROUP_EXTEND: {
...@@ -221,7 +221,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -221,7 +221,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (err == 0) if (err == 0)
err = err2; err = err2;
group_extend_out: group_extend_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
case EXT3_IOC_GROUP_ADD: { case EXT3_IOC_GROUP_ADD: {
...@@ -249,7 +249,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -249,7 +249,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (err == 0) if (err == 0)
err = err2; err = err2;
group_add_out: group_add_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
case FITRIM: { case FITRIM: {
......
...@@ -134,7 +134,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -134,7 +134,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
err = ext4_ext_migrate(inode); err = ext4_ext_migrate(inode);
flags_out: flags_out:
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
case EXT4_IOC_GETVERSION: case EXT4_IOC_GETVERSION:
...@@ -171,7 +171,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -171,7 +171,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
ext4_journal_stop(handle); ext4_journal_stop(handle);
setversion_out: setversion_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
case EXT4_IOC_GROUP_EXTEND: { case EXT4_IOC_GROUP_EXTEND: {
...@@ -204,7 +204,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -204,7 +204,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
if (err == 0) if (err == 0)
err = err2; err = err2;
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
ext4_resize_end(sb); ext4_resize_end(sb);
return err; return err;
...@@ -246,7 +246,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -246,7 +246,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
err = ext4_move_extents(filp, donor_filp, me.orig_start, err = ext4_move_extents(filp, donor_filp, me.orig_start,
me.donor_start, me.len, &me.moved_len); me.donor_start, me.len, &me.moved_len);
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
if (me.moved_len > 0) if (me.moved_len > 0)
file_remove_suid(donor_filp); file_remove_suid(donor_filp);
...@@ -289,7 +289,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -289,7 +289,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
if (err == 0) if (err == 0)
err = err2; err = err2;
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
ext4_resize_end(sb); ext4_resize_end(sb);
return err; return err;
...@@ -313,7 +313,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -313,7 +313,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
mutex_lock(&(inode->i_mutex)); mutex_lock(&(inode->i_mutex));
err = ext4_ext_migrate(inode); err = ext4_ext_migrate(inode);
mutex_unlock(&(inode->i_mutex)); mutex_unlock(&(inode->i_mutex));
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
...@@ -327,7 +327,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -327,7 +327,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
if (err) if (err)
return err; return err;
err = ext4_alloc_da_blocks(inode); err = ext4_alloc_da_blocks(inode);
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
......
...@@ -108,7 +108,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) ...@@ -108,7 +108,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
fat_save_attrs(inode, attr); fat_save_attrs(inode, attr);
mark_inode_dirty(inode); mark_inode_dirty(inode);
out_drop_write: out_drop_write:
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
out_unlock_inode: out_unlock_inode:
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
out: out:
......
...@@ -285,7 +285,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) ...@@ -285,7 +285,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
out: out:
gfs2_glock_dq_uninit(&gh); gfs2_glock_dq_uninit(&gh);
out_drop_write: out_drop_write:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return error; return error;
} }
......
...@@ -94,7 +94,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) ...@@ -94,7 +94,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
out_unlock_inode: out_unlock_inode:
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
out_drop_write: out_drop_write:
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
out: out:
return err; return err;
} }
......
...@@ -1508,7 +1508,7 @@ void file_update_time(struct file *file) ...@@ -1508,7 +1508,7 @@ void file_update_time(struct file *file)
if (sync_it & S_MTIME) if (sync_it & S_MTIME)
inode->i_mtime = now; inode->i_mtime = now;
mark_inode_dirty_sync(inode); mark_inode_dirty_sync(inode);
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
} }
EXPORT_SYMBOL(file_update_time); EXPORT_SYMBOL(file_update_time);
......
...@@ -120,7 +120,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -120,7 +120,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
inode->i_ctime = CURRENT_TIME_SEC; inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode); mark_inode_dirty(inode);
setflags_out: setflags_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return err; return err;
} }
default: default:
......
...@@ -392,6 +392,12 @@ void mnt_drop_write(struct vfsmount *mnt) ...@@ -392,6 +392,12 @@ void mnt_drop_write(struct vfsmount *mnt)
} }
EXPORT_SYMBOL_GPL(mnt_drop_write); EXPORT_SYMBOL_GPL(mnt_drop_write);
void mnt_drop_write_file(struct file *file)
{
mnt_drop_write(file->f_path.mnt);
}
EXPORT_SYMBOL(mnt_drop_write_file);
static int mnt_make_readonly(struct vfsmount *mnt) static int mnt_make_readonly(struct vfsmount *mnt)
{ {
int ret = 0; int ret = 0;
......
...@@ -901,7 +901,7 @@ long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -901,7 +901,7 @@ long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
ret = __ncp_ioctl(inode, cmd, arg); ret = __ncp_ioctl(inode, cmd, arg);
outDropWrite: outDropWrite:
if (need_drop_write) if (need_drop_write)
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
out: out:
return ret; return ret;
} }
......
...@@ -151,7 +151,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) ...@@ -151,7 +151,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
if (status) if (status)
goto out_put; goto out_put;
status = vfs_mkdir(dir->d_inode, dentry, S_IRWXU); status = vfs_mkdir(dir->d_inode, dentry, S_IRWXU);
mnt_drop_write(rec_file->f_path.mnt); mnt_drop_write_file(rec_file);
out_put: out_put:
dput(dentry); dput(dentry);
out_unlock: out_unlock:
...@@ -281,7 +281,7 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp) ...@@ -281,7 +281,7 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)
nfs4_reset_creds(original_cred); nfs4_reset_creds(original_cred);
if (status == 0) if (status == 0)
vfs_fsync(rec_file, 0); vfs_fsync(rec_file, 0);
mnt_drop_write(rec_file->f_path.mnt); mnt_drop_write_file(rec_file);
out: out:
if (status) if (status)
printk("NFSD: Failed to remove expired client state directory" printk("NFSD: Failed to remove expired client state directory"
...@@ -317,7 +317,7 @@ nfsd4_recdir_purge_old(void) { ...@@ -317,7 +317,7 @@ nfsd4_recdir_purge_old(void) {
status = nfsd4_list_rec_dir(purge_old); status = nfsd4_list_rec_dir(purge_old);
if (status == 0) if (status == 0)
vfs_fsync(rec_file, 0); vfs_fsync(rec_file, 0);
mnt_drop_write(rec_file->f_path.mnt); mnt_drop_write_file(rec_file);
out: out:
if (status) if (status)
printk("nfsd4: failed to purge old clients from recovery" printk("nfsd4: failed to purge old clients from recovery"
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <linux/uaccess.h> /* copy_from_user(), copy_to_user() */ #include <linux/uaccess.h> /* copy_from_user(), copy_to_user() */
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/compat.h> /* compat_ptr() */ #include <linux/compat.h> /* compat_ptr() */
#include <linux/mount.h> /* mnt_want_write_file(), mnt_drop_write() */ #include <linux/mount.h> /* mnt_want_write_file(), mnt_drop_write_file() */
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/nilfs2_fs.h> #include <linux/nilfs2_fs.h>
#include "nilfs.h" #include "nilfs.h"
...@@ -154,7 +154,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp, ...@@ -154,7 +154,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp,
ret = nilfs_transaction_commit(inode->i_sb); ret = nilfs_transaction_commit(inode->i_sb);
out: out:
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return ret; return ret;
} }
...@@ -194,7 +194,7 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp, ...@@ -194,7 +194,7 @@ static int nilfs_ioctl_change_cpmode(struct inode *inode, struct file *filp,
up_read(&inode->i_sb->s_umount); up_read(&inode->i_sb->s_umount);
out: out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return ret; return ret;
} }
...@@ -225,7 +225,7 @@ nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp, ...@@ -225,7 +225,7 @@ nilfs_ioctl_delete_checkpoint(struct inode *inode, struct file *filp,
else else
nilfs_transaction_commit(inode->i_sb); /* never fails */ nilfs_transaction_commit(inode->i_sb); /* never fails */
out: out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return ret; return ret;
} }
...@@ -675,7 +675,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, ...@@ -675,7 +675,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp,
vfree(kbufs[n]); vfree(kbufs[n]);
kfree(kbufs[4]); kfree(kbufs[4]);
out: out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return ret; return ret;
} }
...@@ -721,7 +721,7 @@ static int nilfs_ioctl_resize(struct inode *inode, struct file *filp, ...@@ -721,7 +721,7 @@ static int nilfs_ioctl_resize(struct inode *inode, struct file *filp,
ret = nilfs_resize_fs(inode->i_sb, newsize); ret = nilfs_resize_fs(inode->i_sb, newsize);
out_drop_write: out_drop_write:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
out: out:
return ret; return ret;
} }
......
...@@ -911,7 +911,7 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -911,7 +911,7 @@ long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
return status; return status;
status = ocfs2_set_inode_attr(inode, flags, status = ocfs2_set_inode_attr(inode, flags,
OCFS2_FL_MODIFIABLE); OCFS2_FL_MODIFIABLE);
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return status; return status;
case OCFS2_IOC_RESVSP: case OCFS2_IOC_RESVSP:
case OCFS2_IOC_RESVSP64: case OCFS2_IOC_RESVSP64:
......
...@@ -1145,7 +1145,7 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp) ...@@ -1145,7 +1145,7 @@ int ocfs2_ioctl_move_extents(struct file *filp, void __user *argp)
kfree(context); kfree(context);
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
return status; return status;
} }
...@@ -608,7 +608,7 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group) ...@@ -608,7 +608,7 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
dentry = file->f_path.dentry; dentry = file->f_path.dentry;
audit_inode(NULL, dentry); audit_inode(NULL, dentry);
error = chown_common(&file->f_path, user, group); error = chown_common(&file->f_path, user, group);
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
out_fput: out_fput:
fput(file); fput(file);
out: out:
......
...@@ -96,7 +96,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -96,7 +96,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
inode->i_ctime = CURRENT_TIME_SEC; inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode); mark_inode_dirty(inode);
setflags_out: setflags_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
break; break;
} }
case REISERFS_IOC_GETVERSION: case REISERFS_IOC_GETVERSION:
...@@ -117,7 +117,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -117,7 +117,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
inode->i_ctime = CURRENT_TIME_SEC; inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode); mark_inode_dirty(inode);
setversion_out: setversion_out:
mnt_drop_write(filp->f_path.mnt); mnt_drop_write_file(filp);
break; break;
default: default:
err = -ENOTTY; err = -ENOTTY;
......
...@@ -178,7 +178,7 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -178,7 +178,7 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return err; return err;
dbg_gen("set flags: %#x, i_flags %#x", flags, inode->i_flags); dbg_gen("set flags: %#x, i_flags %#x", flags, inode->i_flags);
err = setflags(inode, flags); err = setflags(inode, flags);
mnt_drop_write(file->f_path.mnt); mnt_drop_write_file(file);
return err; return err;
} }
......
...@@ -397,7 +397,7 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, ...@@ -397,7 +397,7 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
error = mnt_want_write_file(f); error = mnt_want_write_file(f);
if (!error) { if (!error) {
error = setxattr(dentry, name, value, size, flags); error = setxattr(dentry, name, value, size, flags);
mnt_drop_write(f->f_path.mnt); mnt_drop_write_file(f);
} }
fput(f); fput(f);
return error; return error;
...@@ -624,7 +624,7 @@ SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) ...@@ -624,7 +624,7 @@ SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
error = mnt_want_write_file(f); error = mnt_want_write_file(f);
if (!error) { if (!error) {
error = removexattr(dentry, name); error = removexattr(dentry, name);
mnt_drop_write(f->f_path.mnt); mnt_drop_write_file(f);
} }
fput(f); fput(f);
return error; return error;
......
...@@ -566,7 +566,7 @@ xfs_attrmulti_by_handle( ...@@ -566,7 +566,7 @@ xfs_attrmulti_by_handle(
dentry->d_inode, attr_name, dentry->d_inode, attr_name,
ops[i].am_attrvalue, ops[i].am_length, ops[i].am_attrvalue, ops[i].am_length,
ops[i].am_flags); ops[i].am_flags);
mnt_drop_write(parfilp->f_path.mnt); mnt_drop_write_file(parfilp);
break; break;
case ATTR_OP_REMOVE: case ATTR_OP_REMOVE:
ops[i].am_error = mnt_want_write_file(parfilp); ops[i].am_error = mnt_want_write_file(parfilp);
...@@ -575,7 +575,7 @@ xfs_attrmulti_by_handle( ...@@ -575,7 +575,7 @@ xfs_attrmulti_by_handle(
ops[i].am_error = xfs_attrmulti_attr_remove( ops[i].am_error = xfs_attrmulti_attr_remove(
dentry->d_inode, attr_name, dentry->d_inode, attr_name,
ops[i].am_flags); ops[i].am_flags);
mnt_drop_write(parfilp->f_path.mnt); mnt_drop_write_file(parfilp);
break; break;
default: default:
ops[i].am_error = EINVAL; ops[i].am_error = EINVAL;
......
...@@ -461,7 +461,7 @@ xfs_compat_attrmulti_by_handle( ...@@ -461,7 +461,7 @@ xfs_compat_attrmulti_by_handle(
dentry->d_inode, attr_name, dentry->d_inode, attr_name,
compat_ptr(ops[i].am_attrvalue), compat_ptr(ops[i].am_attrvalue),
ops[i].am_length, ops[i].am_flags); ops[i].am_length, ops[i].am_flags);
mnt_drop_write(parfilp->f_path.mnt); mnt_drop_write_file(parfilp);
break; break;
case ATTR_OP_REMOVE: case ATTR_OP_REMOVE:
ops[i].am_error = mnt_want_write_file(parfilp); ops[i].am_error = mnt_want_write_file(parfilp);
...@@ -470,7 +470,7 @@ xfs_compat_attrmulti_by_handle( ...@@ -470,7 +470,7 @@ xfs_compat_attrmulti_by_handle(
ops[i].am_error = xfs_attrmulti_attr_remove( ops[i].am_error = xfs_attrmulti_attr_remove(
dentry->d_inode, attr_name, dentry->d_inode, attr_name,
ops[i].am_flags); ops[i].am_flags);
mnt_drop_write(parfilp->f_path.mnt); mnt_drop_write_file(parfilp);
break; break;
default: default:
ops[i].am_error = EINVAL; ops[i].am_error = EINVAL;
......
...@@ -94,6 +94,7 @@ extern int mnt_want_write(struct vfsmount *mnt); ...@@ -94,6 +94,7 @@ extern int mnt_want_write(struct vfsmount *mnt);
extern int mnt_want_write_file(struct file *file); extern int mnt_want_write_file(struct file *file);
extern int mnt_clone_write(struct vfsmount *mnt); extern int mnt_clone_write(struct vfsmount *mnt);
extern void mnt_drop_write(struct vfsmount *mnt); extern void mnt_drop_write(struct vfsmount *mnt);
extern void mnt_drop_write_file(struct file *file);
extern void mntput(struct vfsmount *mnt); extern void mntput(struct vfsmount *mnt);
extern struct vfsmount *mntget(struct vfsmount *mnt); extern struct vfsmount *mntget(struct vfsmount *mnt);
extern void mnt_pin(struct vfsmount *mnt); extern void mnt_pin(struct vfsmount *mnt);
......
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