Skip to content

Commit 2a79f17

Browse files
author
Al Viro
committed
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: Al Viro <viro@zeniv.linux.org.uk>
1 parent 8c9379e commit 2a79f17

22 files changed

Lines changed: 55 additions & 48 deletions

File tree

‎fs/btrfs/ioctl.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
259259

260260
btrfs_end_transaction(trans, root);
261261

262-
mnt_drop_write(file->f_path.mnt);
262+
mnt_drop_write_file(file);
263263

264264
ret = 0;
265265
out_unlock:
@@ -1971,7 +1971,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
19711971
dput(dentry);
19721972
out_unlock_dir:
19731973
mutex_unlock(&dir->i_mutex);
1974-
mnt_drop_write(file->f_path.mnt);
1974+
mnt_drop_write_file(file);
19751975
out:
19761976
kfree(vol_args);
19771977
return err;
@@ -2040,7 +2040,7 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
20402040
ret = -EINVAL;
20412041
}
20422042
out:
2043-
mnt_drop_write(file->f_path.mnt);
2043+
mnt_drop_write_file(file);
20442044
return ret;
20452045
}
20462046

@@ -2510,7 +2510,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
25102510
out_fput:
25112511
fput(src_file);
25122512
out_drop_write:
2513-
mnt_drop_write(file->f_path.mnt);
2513+
mnt_drop_write_file(file);
25142514
return ret;
25152515
}
25162516

@@ -2565,7 +2565,7 @@ static long btrfs_ioctl_trans_start(struct file *file)
25652565

25662566
out_drop:
25672567
atomic_dec(&root->fs_info->open_ioctl_trans);
2568-
mnt_drop_write(file->f_path.mnt);
2568+
mnt_drop_write_file(file);
25692569
out:
25702570
return ret;
25712571
}
@@ -2800,7 +2800,7 @@ long btrfs_ioctl_trans_end(struct file *file)
28002800

28012801
atomic_dec(&root->fs_info->open_ioctl_trans);
28022802

2803-
mnt_drop_write(file->f_path.mnt);
2803+
mnt_drop_write_file(file);
28042804
return 0;
28052805
}
28062806

‎fs/ext2/ioctl.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
8383
inode->i_ctime = CURRENT_TIME_SEC;
8484
mark_inode_dirty(inode);
8585
setflags_out:
86-
mnt_drop_write(filp->f_path.mnt);
86+
mnt_drop_write_file(filp);
8787
return ret;
8888
}
8989
case EXT2_IOC_GETVERSION:
@@ -100,7 +100,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
100100
inode->i_ctime = CURRENT_TIME_SEC;
101101
mark_inode_dirty(inode);
102102
}
103-
mnt_drop_write(filp->f_path.mnt);
103+
mnt_drop_write_file(filp);
104104
return ret;
105105
case EXT2_IOC_GETRSVSZ:
106106
if (test_opt(inode->i_sb, RESERVATION)
@@ -145,7 +145,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
145145
rsv->rsv_goal_size = rsv_window_size;
146146
}
147147
mutex_unlock(&ei->truncate_mutex);
148-
mnt_drop_write(filp->f_path.mnt);
148+
mnt_drop_write_file(filp);
149149
return 0;
150150
}
151151
default:

‎fs/ext3/ioctl.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
110110
err = ext3_change_inode_journal_flag(inode, jflag);
111111
flags_out:
112112
mutex_unlock(&inode->i_mutex);
113-
mnt_drop_write(filp->f_path.mnt);
113+
mnt_drop_write_file(filp);
114114
return err;
115115
}
116116
case EXT3_IOC_GETVERSION:
@@ -147,7 +147,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
147147
}
148148
ext3_journal_stop(handle);
149149
setversion_out:
150-
mnt_drop_write(filp->f_path.mnt);
150+
mnt_drop_write_file(filp);
151151
return err;
152152
}
153153
case EXT3_IOC_GETRSVSZ:
@@ -195,7 +195,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
195195
}
196196
mutex_unlock(&ei->truncate_mutex);
197197
setrsvsz_out:
198-
mnt_drop_write(filp->f_path.mnt);
198+
mnt_drop_write_file(filp);
199199
return err;
200200
}
201201
case EXT3_IOC_GROUP_EXTEND: {
@@ -221,7 +221,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
221221
if (err == 0)
222222
err = err2;
223223
group_extend_out:
224-
mnt_drop_write(filp->f_path.mnt);
224+
mnt_drop_write_file(filp);
225225
return err;
226226
}
227227
case EXT3_IOC_GROUP_ADD: {
@@ -249,7 +249,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
249249
if (err == 0)
250250
err = err2;
251251
group_add_out:
252-
mnt_drop_write(filp->f_path.mnt);
252+
mnt_drop_write_file(filp);
253253
return err;
254254
}
255255
case FITRIM: {

‎fs/ext4/ioctl.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
134134
err = ext4_ext_migrate(inode);
135135
flags_out:
136136
mutex_unlock(&inode->i_mutex);
137-
mnt_drop_write(filp->f_path.mnt);
137+
mnt_drop_write_file(filp);
138138
return err;
139139
}
140140
case EXT4_IOC_GETVERSION:
@@ -171,7 +171,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
171171
}
172172
ext4_journal_stop(handle);
173173
setversion_out:
174-
mnt_drop_write(filp->f_path.mnt);
174+
mnt_drop_write_file(filp);
175175
return err;
176176
}
177177
case EXT4_IOC_GROUP_EXTEND: {
@@ -204,7 +204,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
204204
}
205205
if (err == 0)
206206
err = err2;
207-
mnt_drop_write(filp->f_path.mnt);
207+
mnt_drop_write_file(filp);
208208
ext4_resize_end(sb);
209209

210210
return err;
@@ -246,7 +246,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
246246

247247
err = ext4_move_extents(filp, donor_filp, me.orig_start,
248248
me.donor_start, me.len, &me.moved_len);
249-
mnt_drop_write(filp->f_path.mnt);
249+
mnt_drop_write_file(filp);
250250
if (me.moved_len > 0)
251251
file_remove_suid(donor_filp);
252252

@@ -289,7 +289,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
289289
}
290290
if (err == 0)
291291
err = err2;
292-
mnt_drop_write(filp->f_path.mnt);
292+
mnt_drop_write_file(filp);
293293
ext4_resize_end(sb);
294294

295295
return err;
@@ -313,7 +313,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
313313
mutex_lock(&(inode->i_mutex));
314314
err = ext4_ext_migrate(inode);
315315
mutex_unlock(&(inode->i_mutex));
316-
mnt_drop_write(filp->f_path.mnt);
316+
mnt_drop_write_file(filp);
317317
return err;
318318
}
319319

@@ -327,7 +327,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
327327
if (err)
328328
return err;
329329
err = ext4_alloc_da_blocks(inode);
330-
mnt_drop_write(filp->f_path.mnt);
330+
mnt_drop_write_file(filp);
331331
return err;
332332
}
333333

‎fs/fat/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
108108
fat_save_attrs(inode, attr);
109109
mark_inode_dirty(inode);
110110
out_drop_write:
111-
mnt_drop_write(file->f_path.mnt);
111+
mnt_drop_write_file(file);
112112
out_unlock_inode:
113113
mutex_unlock(&inode->i_mutex);
114114
out:

‎fs/gfs2/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
285285
out:
286286
gfs2_glock_dq_uninit(&gh);
287287
out_drop_write:
288-
mnt_drop_write(filp->f_path.mnt);
288+
mnt_drop_write_file(filp);
289289
return error;
290290
}
291291

‎fs/hfsplus/ioctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
9494
out_unlock_inode:
9595
mutex_unlock(&inode->i_mutex);
9696
out_drop_write:
97-
mnt_drop_write(file->f_path.mnt);
97+
mnt_drop_write_file(file);
9898
out:
9999
return err;
100100
}

‎fs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ void file_update_time(struct file *file)
15081508
if (sync_it & S_MTIME)
15091509
inode->i_mtime = now;
15101510
mark_inode_dirty_sync(inode);
1511-
mnt_drop_write(file->f_path.mnt);
1511+
mnt_drop_write_file(file);
15121512
}
15131513
EXPORT_SYMBOL(file_update_time);
15141514

‎fs/jfs/ioctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
120120
inode->i_ctime = CURRENT_TIME_SEC;
121121
mark_inode_dirty(inode);
122122
setflags_out:
123-
mnt_drop_write(filp->f_path.mnt);
123+
mnt_drop_write_file(filp);
124124
return err;
125125
}
126126
default:

‎fs/namespace.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ void mnt_drop_write(struct vfsmount *mnt)
392392
}
393393
EXPORT_SYMBOL_GPL(mnt_drop_write);
394394

395+
void mnt_drop_write_file(struct file *file)
396+
{
397+
mnt_drop_write(file->f_path.mnt);
398+
}
399+
EXPORT_SYMBOL(mnt_drop_write_file);
400+
395401
static int mnt_make_readonly(struct vfsmount *mnt)
396402
{
397403
int ret = 0;

0 commit comments

Comments
 (0)