diff options
author | Dan Williams <dan.j.williams@intel.com> | 2018-06-08 15:16:44 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2018-06-08 15:16:44 -0700 |
commit | 930218affeadd1325ea17e053f0dcecf218f5a4f (patch) | |
tree | 203c293668a88e03b9f292cf4d5a294ca8a4275a /fs | |
parent | b56845794e1e93121acb74ca325db965035d5545 (diff) | |
parent | 5d8beee20d89e34ff1dcb0da84adf7607858c59d (diff) | |
download | linux-930218affeadd1325ea17e053f0dcecf218f5a4f.tar.bz2 |
Merge branch 'for-4.18/mcsafe' into libnvdimm-for-next
Diffstat (limited to 'fs')
-rw-r--r-- | fs/dax.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1082,6 +1082,7 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, struct iov_iter *iter = data; loff_t end = pos + length, done = 0; ssize_t ret = 0; + size_t xfer; int id; if (iov_iter_rw(iter) == READ) { @@ -1145,18 +1146,20 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, * vfs_write(), depending on which operation we are doing. */ if (iov_iter_rw(iter) == WRITE) - map_len = dax_copy_from_iter(dax_dev, pgoff, kaddr, + xfer = dax_copy_from_iter(dax_dev, pgoff, kaddr, map_len, iter); else - map_len = copy_to_iter(kaddr, map_len, iter); - if (map_len <= 0) { - ret = map_len ? map_len : -EFAULT; - break; - } + xfer = dax_copy_to_iter(dax_dev, pgoff, kaddr, + map_len, iter); - pos += map_len; - length -= map_len; - done += map_len; + pos += xfer; + length -= xfer; + done += xfer; + + if (xfer == 0) + ret = -EFAULT; + if (xfer < map_len) + break; } dax_read_unlock(id); |