aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zpl_file.c
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2017-02-02 09:43:42 -0800
committerBrian Behlendorf <[email protected]>2017-02-02 09:43:42 -0800
commitc7af63d62aba273554d6c8457e26c870ed207b40 (patch)
tree568ce21d01bf2a6b9542b466edc876b0e37818b5 /module/zfs/zpl_file.c
parentfc386db1916dd946512d9b965d4d354582be1f9e (diff)
Fix write(2) returns zero bug from 933ec99
For generic_write_checks with 2 args, we can exit when it returns zero because it means count is zero. However this is not the case for generic_write_checks with 4 args, where zero means no error. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Haakan T Johansson <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes #5720 Closes #5726
Diffstat (limited to 'module/zfs/zpl_file.c')
-rw-r--r--module/zfs/zpl_file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c
index 75a3b55d1..b625d8412 100644
--- a/module/zfs/zpl_file.c
+++ b/module/zfs/zpl_file.c
@@ -387,6 +387,8 @@ zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)
count = iov_iter_count(from);
ret = generic_write_checks(file, &kiocb->ki_pos, &count, isblk);
+ if (ret)
+ return (ret);
#else
/*
* XXX - ideally this check should be in the same lock region with
@@ -394,10 +396,10 @@ zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)
* append and someone else grow the file.
*/
ret = generic_write_checks(kiocb, from);
- count = ret;
-#endif
if (ret <= 0)
return (ret);
+ count = ret;
+#endif
if (from->type & ITER_KVEC)
seg = UIO_SYSSPACE;