aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-08 00:48:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-08 00:48:15 -0400
commitcee37d83e6d9ada1c2254c73bac7955f9e048d22 (patch)
treea8abe8b3009748260c9108fdaf50045c39f170ae
parent6a37e94009b1a76d415b2759755f5cc7854c4ff6 (diff)
parent62473a2d6f513296e896b64ccfd7ceb7b963795e (diff)
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()
-rw-r--r--fs/read_write.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index a2cbc8303dae..0cc7033aa413 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -925,12 +925,10 @@ static ssize_t do_iter_write(struct file *file, struct iov_iter *iter,
925 if (ret < 0) 925 if (ret < 0)
926 return ret; 926 return ret;
927 927
928 file_start_write(file);
929 if (file->f_op->write_iter) 928 if (file->f_op->write_iter)
930 ret = do_iter_readv_writev(file, iter, pos, WRITE, flags); 929 ret = do_iter_readv_writev(file, iter, pos, WRITE, flags);
931 else 930 else
932 ret = do_loop_readv_writev(file, iter, pos, WRITE, flags); 931 ret = do_loop_readv_writev(file, iter, pos, WRITE, flags);
933 file_end_write(file);
934 if (ret > 0) 932 if (ret > 0)
935 fsnotify_modify(file); 933 fsnotify_modify(file);
936 return ret; 934 return ret;
@@ -973,7 +971,9 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
973 971
974 ret = import_iovec(WRITE, vec, vlen, ARRAY_SIZE(iovstack), &iov, &iter); 972 ret = import_iovec(WRITE, vec, vlen, ARRAY_SIZE(iovstack), &iov, &iter);
975 if (ret >= 0) { 973 if (ret >= 0) {
974 file_start_write(file);
976 ret = do_iter_write(file, &iter, pos, flags); 975 ret = do_iter_write(file, &iter, pos, flags);
976 file_end_write(file);
977 kfree(iov); 977 kfree(iov);
978 } 978 }
979 return ret; 979 return ret;
@@ -1241,7 +1241,9 @@ static size_t compat_writev(struct file *file,
1241 1241
1242 ret = compat_import_iovec(WRITE, vec, vlen, UIO_FASTIOV, &iov, &iter); 1242 ret = compat_import_iovec(WRITE, vec, vlen, UIO_FASTIOV, &iov, &iter);
1243 if (ret >= 0) { 1243 if (ret >= 0) {
1244 file_start_write(file);
1244 ret = do_iter_write(file, &iter, pos, flags); 1245 ret = do_iter_write(file, &iter, pos, flags);
1246 file_end_write(file);
1245 kfree(iov); 1247 kfree(iov);
1246 } 1248 }
1247 if (ret > 0) 1249 if (ret > 0)