[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210914233132.3680546-4-jane.chu@oracle.com>
Date: Tue, 14 Sep 2021 17:31:31 -0600
From: Jane Chu <jane.chu@...cle.com>
To: dan.j.williams@...el.com, vishal.l.verma@...el.com,
dave.jiang@...el.com, ira.weiny@...el.com, viro@...iv.linux.org.uk,
willy@...radead.org, jack@...e.cz, nvdimm@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH 2/3] dax: introduce dax clear poison to page aligned dax pwrite operation
Currenty, when pwrite(2) s issued to a dax range that contains poison,
the pwrite(2) fails with EIO. Well, if the hardware backend of the
dax device is capable of clearing poison, try that and resume the write.
Signed-off-by: Jane Chu <jane.chu@...cle.com>
---
fs/dax.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/dax.c b/fs/dax.c
index 99b4e78d888f..592a156abbf2 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1156,8 +1156,17 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
if (ret)
break;
+ /*
+ * If WRITE operation encounters media error in a page aligned
+ * range, try to clear the error, then resume, for just once.
+ */
map_len = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size),
&kaddr, NULL);
+ if ((map_len == -EIO) && (iov_iter_rw(iter) == WRITE)) {
+ if (dax_clear_poison(dax_dev, pgoff, PHYS_PFN(size)) == 0)
+ map_len = dax_direct_access(dax_dev, pgoff,
+ PHYS_PFN(size), &kaddr, NULL);
+ }
if (map_len < 0) {
ret = map_len;
break;
--
2.18.4
Powered by blists - more mailing lists