summaryrefslogtreecommitdiffstats
path: root/fs/dax.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2018-06-09 00:16:44 +0200
committerDan Williams <dan.j.williams@intel.com>2018-06-09 00:16:44 +0200
commit930218affeadd1325ea17e053f0dcecf218f5a4f (patch)
tree203c293668a88e03b9f292cf4d5a294ca8a4275a /fs/dax.c
parentMerge branch 'for-4.18/dax' into libnvdimm-for-next (diff)
parentx86, nfit_test: Add unit test for memcpy_mcsafe() (diff)
downloadlinux-930218affeadd1325ea17e053f0dcecf218f5a4f.tar.xz
linux-930218affeadd1325ea17e053f0dcecf218f5a4f.zip
Merge branch 'for-4.18/mcsafe' into libnvdimm-for-next
Diffstat (limited to 'fs/dax.c')
-rw-r--r--fs/dax.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 31e9f51ac917..1f5f14a2ce4c 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -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);