]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
libnvdimm, btt: fix a missed NVDIMM_IO_ATOMIC case in the write path
authorVishal Verma <vishal.l.verma@intel.com>
Thu, 31 Aug 2017 01:35:58 +0000 (19:35 -0600)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 21 Sep 2017 16:46:56 +0000 (11:46 -0500)
BugLink: http://bugs.launchpad.net/bugs/1704350
The IO context conversion for rw_bytes missed a case in the BTT write
path (btt_map_write) which should've been marked as atomic.

In reality this should not cause a problem, because map writes are to
small for nsio_rw_bytes to attempt error clearing, but it should be
fixed for posterity.

Add a might_sleep() in the non-atomic section of nsio_rw_bytes so that
things like the nfit unit tests, which don't actually sleep, can catch
bugs like this.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
(cherry picked from commit 1db1f3cea1d8886c686832d4618b346ae16c03c8)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/nvdimm/btt.c
drivers/nvdimm/claim.c

index 7ec6393b6ba1299468a0c3b833da5a5ec598d95e..a5e4134e1ed0267cac953387e854193419697582 100644 (file)
@@ -1156,7 +1156,8 @@ static int btt_write_pg(struct btt *btt, struct bio_integrity_payload *bip,
                if (ret)
                        goto out_map;
 
-               ret = btt_map_write(arena, premap, new_postmap, 0, 0, 0);
+               ret = btt_map_write(arena, premap, new_postmap, 0, 0,
+                       NVDIMM_IO_ATOMIC);
                if (ret)
                        goto out_map;
 
index 47770460f3d324745b5ea6f1f251ae21df0a8c1d..3e6404f1ba5ab5b1bb69f444af4b3b6aafe9626d 100644 (file)
@@ -292,6 +292,7 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
                                && !(flags & NVDIMM_IO_ATOMIC)) {
                        long cleared;
 
+                       might_sleep();
                        cleared = nvdimm_clear_poison(&ndns->dev,
                                        nsio->res.start + offset, size);
                        if (cleared < size)