vfs: wrap write f_ops with file_{start,end}_write()

Before calling write f_ops, call file_start_write() instead
of sb_start_write().

Replace {sb,file}_start_write() for {copy,clone}_file_range() and
for fallocate().

Beyond correct semantics, this avoids freeze protection to sb when
operating on special inodes, such as fallocate() on a blockdev.

Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: Amir Goldstein <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
This commit is contained in:
Amir Goldstein 2017-01-31 10:34:57 +02:00 • committed by Miklos Szeredi
commit bfe219d373
3 changed files with 17 additions and 17 deletions

View file

@ -314,7 +314,7 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
if (!file->f_op->fallocate)
return -EOPNOTSUPP;
sb_start_write(inode->i_sb);
file_start_write(file);
ret = file->f_op->fallocate(file, mode, offset, len);
/*
@ -327,7 +327,7 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
if (ret == 0)
fsnotify_modify(file);
sb_end_write(inode->i_sb);
file_end_write(file);
return ret;
}
EXPORT_SYMBOL_GPL(vfs_fallocate);