Commit cee37d83 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'work.read_write' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull read/write fix from Al Viro:
 "file_start_write()/file_end_write() got mixed into vfs_iter_write() by
  accident; that's a deadlock for all existing callers - they already do
  that, some - quite a bit outside.

  Easily fixed, fortunately"

* 'work.read_write' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  move file_{start,end}_write() out of do_iter_write()
parents 6a37e940 62473a2d
...@@ -925,12 +925,10 @@ static ssize_t do_iter_write(struct file *file, struct iov_iter *iter, ...@@ -925,12 +925,10 @@ static ssize_t do_iter_write(struct file *file, struct iov_iter *iter,
if (ret < 0) if (ret < 0)
return ret; return ret;
file_start_write(file);
if (file->f_op->write_iter) if (file->f_op->write_iter)
ret = do_iter_readv_writev(file, iter, pos, WRITE, flags); ret = do_iter_readv_writev(file, iter, pos, WRITE, flags);
else else
ret = do_loop_readv_writev(file, iter, pos, WRITE, flags); ret = do_loop_readv_writev(file, iter, pos, WRITE, flags);
file_end_write(file);
if (ret > 0) if (ret > 0)
fsnotify_modify(file); fsnotify_modify(file);
return ret; return ret;
...@@ -973,7 +971,9 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec, ...@@ -973,7 +971,9 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
ret = import_iovec(WRITE, vec, vlen, ARRAY_SIZE(iovstack), &iov, &iter); ret = import_iovec(WRITE, vec, vlen, ARRAY_SIZE(iovstack), &iov, &iter);
if (ret >= 0) { if (ret >= 0) {
file_start_write(file);
ret = do_iter_write(file, &iter, pos, flags); ret = do_iter_write(file, &iter, pos, flags);
file_end_write(file);
kfree(iov); kfree(iov);
} }
return ret; return ret;
...@@ -1241,7 +1241,9 @@ static size_t compat_writev(struct file *file, ...@@ -1241,7 +1241,9 @@ static size_t compat_writev(struct file *file,
ret = compat_import_iovec(WRITE, vec, vlen, UIO_FASTIOV, &iov, &iter); ret = compat_import_iovec(WRITE, vec, vlen, UIO_FASTIOV, &iov, &iter);
if (ret >= 0) { if (ret >= 0) {
file_start_write(file);
ret = do_iter_write(file, &iter, pos, flags); ret = do_iter_write(file, &iter, pos, flags);
file_end_write(file);
kfree(iov); kfree(iov);
} }
if (ret > 0) if (ret > 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment