Message ID | 20200508092222.2097-2-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/11] fs: call file_{start,end}_write from __kernel_write | expand |
diff --git a/fs/read_write.c b/fs/read_write.c index bbfa9b12b15eb..d5aaf3a4198b9 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -508,6 +508,7 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t if (!(file->f_mode & FMODE_CAN_WRITE)) return -EINVAL; + file_start_write(file); old_fs = get_fs(); set_fs(KERNEL_DS); p = (__force const char __user *)buf; @@ -520,6 +521,7 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t add_wchar(current, ret); } inc_syscw(current); + file_end_write(file); return ret; } EXPORT_SYMBOL(__kernel_write);
We always need to take a reference on the file system we are writing to. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/read_write.c | 2 ++ 1 file changed, 2 insertions(+)