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 <jack@suse.cz>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
committed by
Miklos Szeredi
parent
11cbfb1077
commit
bfe219d373
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user