summaryrefslogtreecommitdiff
path: root/fs/open.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-01-31 11:34:57 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2017-02-07 17:05:04 +0300
commitbfe219d373cadab761373aeea4c70406bc27ea2c (patch)
tree781b1664565d45394b4272cc783932b857de67cf /fs/open.c
parent11cbfb10775aa2a01cee966d118049ede9d0bdf2 (diff)
downloadlinux-bfe219d373cadab761373aeea4c70406bc27ea2c.tar.xz
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>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/open.c b/fs/open.c
index f9118f4113e7..949cef29c3bb 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -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);