diff mbox

[1/2] dax: Fix read() of a hole

Message ID 1449168183-20378-2-git-send-email-willy@linux.intel.com (mailing list archive)
State Superseded
Headers show

Commit Message

Matthew Wilcox Dec. 3, 2015, 6:43 p.m. UTC
The dax->addr is set to an errno in order to indicate that there is no
current mapping (and therefore we don't need to call blk_queue_exit()).
When we read() from a hole, we were unconditionally incrementing
dax->addr, until it no longer represented an eror value.

Check that dax->addr is not an errno before incrementing it.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
 fs/dax.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/fs/dax.c b/fs/dax.c
index 6662de3..727af65 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -207,7 +207,8 @@  static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
 		}
 
 		pos += len;
-		dax.addr += len;
+		if (!IS_ERR(dax.addr))
+			dax.addr += len;
 	}
 
 	if (need_wmb)