Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-08-08 15:12:29 +0200
committerTakashi Iwai <tiwai@suse.de>2018-08-08 15:12:29 +0200
commit6d7c6eae3119cfa614ea49c152f344e223d45f4f (patch)
treef44d722b2876c3071ec098c43448fe1ac4ba7281
parentfe89fabe72871da3a6ec00943e5fb359831efef9 (diff)
parent34be89084068d620be0647767a93bf3e9083e4ef (diff)
Merge branch 'users/jthumshirn/SLE15/for-next' into SLE15
Pull dax fix from Johannes Thumshirn
-rw-r--r--patches.fixes/linvdimm-pmem-Preserve-read-only-setting-for-pmem-de.patch77
-rw-r--r--patches.suse/0201-dax-dm-allow-device-mapper-to-operate-without-dax-su.patch291
-rw-r--r--series.conf2
3 files changed, 78 insertions, 292 deletions
diff --git a/patches.fixes/linvdimm-pmem-Preserve-read-only-setting-for-pmem-de.patch b/patches.fixes/linvdimm-pmem-Preserve-read-only-setting-for-pmem-de.patch
new file mode 100644
index 0000000000..0a86a1a0b6
--- /dev/null
+++ b/patches.fixes/linvdimm-pmem-Preserve-read-only-setting-for-pmem-de.patch
@@ -0,0 +1,77 @@
+From: Robert Elliott <elliott@hpe.com>
+Date: Thu, 31 May 2018 18:36:36 -0500
+Subject: linvdimm, pmem: Preserve read-only setting for pmem devices
+Patch-mainline: v4.18-rc1
+Git-commit: 254a4cd50b9fe2291a12b8902e08e56dcc4e9b10
+References: git-fixes
+
+The pmem driver does not honor a forced read-only setting for very long:
+ $ blockdev --setro /dev/pmem0
+ $ blockdev --getro /dev/pmem0
+ 1
+
+followed by various commands like these:
+ $ blockdev --rereadpt /dev/pmem0
+ or
+ $ mkfs.ext4 /dev/pmem0
+
+results in this in the kernel serial log:
+ nd_pmem namespace0.0: region0 read-write, marking pmem0 read-write
+
+with the read-only setting lost:
+ $ blockdev --getro /dev/pmem0
+ 0
+
+That's from bus.c nvdimm_revalidate_disk(), which always applies the
+setting from nd_region (which is initially based on the ACPI NFIT
+NVDIMM state flags not_armed bit).
+
+In contrast, commit 20bd1d026aac ("scsi: sd: Keep disk read-only when
+re-reading partition") fixed this issue for SCSI devices to preserve
+the previous setting if it was set to read-only.
+
+This patch modifies bus.c to preserve any previous read-only setting.
+It also eliminates the kernel serial log print except for cases where
+read-write is changed to read-only, so it doesn't print read-only to
+read-only non-changes.
+
+Cc: <stable@vger.kernel.org>
+Fixes: 581388209405 ("libnvdimm, nfit: handle unarmed dimms, mark namespaces read-only")
+Signed-off-by: Robert Elliott <elliott@hpe.com>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ drivers/nvdimm/bus.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
+index a64023690cad..b9e0d30e317a 100644
+--- a/drivers/nvdimm/bus.c
++++ b/drivers/nvdimm/bus.c
+@@ -566,14 +566,18 @@ int nvdimm_revalidate_disk(struct gendisk *disk)
+ {
+ struct device *dev = disk_to_dev(disk)->parent;
+ struct nd_region *nd_region = to_nd_region(dev->parent);
+- const char *pol = nd_region->ro ? "only" : "write";
++ int disk_ro = get_disk_ro(disk);
+
+- if (nd_region->ro == get_disk_ro(disk))
++ /*
++ * Upgrade to read-only if the region is read-only preserve as
++ * read-only if the disk is already read-only.
++ */
++ if (disk_ro || nd_region->ro == disk_ro)
+ return 0;
+
+- dev_info(dev, "%s read-%s, marking %s read-%s\n",
+- dev_name(&nd_region->dev), pol, disk->disk_name, pol);
+- set_disk_ro(disk, nd_region->ro);
++ dev_info(dev, "%s read-only, marking %s read-only\n",
++ dev_name(&nd_region->dev), disk->disk_name);
++ set_disk_ro(disk, 1);
+
+ return 0;
+
+--
+2.12.3
+
diff --git a/patches.suse/0201-dax-dm-allow-device-mapper-to-operate-without-dax-su.patch b/patches.suse/0201-dax-dm-allow-device-mapper-to-operate-without-dax-su.patch
deleted file mode 100644
index d2d1a36166..0000000000
--- a/patches.suse/0201-dax-dm-allow-device-mapper-to-operate-without-dax-su.patch
+++ /dev/null
@@ -1,291 +0,0 @@
-From 976431b02c2ef92ae3f8b6a7d699fc554025e118 Mon Sep 17 00:00:00 2001
-From: Dan Williams <dan.j.williams@intel.com>
-Date: Thu, 29 Mar 2018 17:22:13 -0700
-Subject: [PATCH] dax, dm: allow device-mapper to operate without dax support
-Git-commit: 976431b02c2ef92ae3f8b6a7d699fc554025e118
-Patch-mainline: v4.17-rc1
-References: bsc#1093023
-
-Change device-mapper's DAX dependency to require the presence of at
-least one DAX_DRIVER. This allows device-mapper to be built without
-bringing the DAX core along which is especially wasteful when there are
-no DAX drivers, like BLK_DEV_PMEM, configured.
-
-Cc: Alasdair Kergon <agk@redhat.com>
-Reported-by: Bart Van Assche <Bart.VanAssche@wdc.com>
-Reported-by: kbuild test robot <lkp@intel.com>
-Reported-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Mike Snitzer <snitzer@redhat.com>
-Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-Signed-off-by: Coly Li <colyli@suse.de>
-
----
- drivers/md/Kconfig | 2
- drivers/md/dm-linear.c | 6 ++
- drivers/md/dm-log-writes.c | 95 +++++++++++++++++++++++----------------------
- drivers/md/dm-stripe.c | 6 ++
- drivers/md/dm.c | 10 ++--
- include/linux/dax.h | 30 +++++++++++---
- 6 files changed, 93 insertions(+), 56 deletions(-)
-
---- a/drivers/md/Kconfig
-+++ b/drivers/md/Kconfig
-@@ -201,7 +201,7 @@ config BLK_DEV_DM_BUILTIN
- config BLK_DEV_DM
- tristate "Device mapper support"
- select BLK_DEV_DM_BUILTIN
-- select DAX
-+ depends on DAX || DAX=n
- ---help---
- Device-mapper is a low level volume manager. It works by allowing
- people to specify mappings for ranges of logical sectors. Various
---- a/drivers/md/dm-linear.c
-+++ b/drivers/md/dm-linear.c
-@@ -154,6 +154,7 @@ static int linear_iterate_devices(struct
- return fn(ti, lc->dev, lc->start, ti->len, data);
- }
-
-+#if IS_ENABLED(CONFIG_DAX_DRIVER)
- static long linear_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
- long nr_pages, void **kaddr, pfn_t *pfn)
- {
-@@ -184,6 +185,11 @@ static size_t linear_dax_copy_from_iter(
- return dax_copy_from_iter(dax_dev, pgoff, addr, bytes, i);
- }
-
-+#else
-+#define linear_dax_direct_access NULL
-+#define linear_dax_copy_from_iter NULL
-+#endif
-+
- static struct target_type linear_target = {
- .name = "linear",
- .version = {1, 4, 0},
---- a/drivers/md/dm-log-writes.c
-+++ b/drivers/md/dm-log-writes.c
-@@ -611,51 +611,6 @@ static int log_mark(struct log_writes_c
- return 0;
- }
-
--static int log_dax(struct log_writes_c *lc, sector_t sector, size_t bytes,
-- struct iov_iter *i)
--{
-- struct pending_block *block;
--
-- if (!bytes)
-- return 0;
--
-- block = kzalloc(sizeof(struct pending_block), GFP_KERNEL);
-- if (!block) {
-- DMERR("Error allocating dax pending block");
-- return -ENOMEM;
-- }
--
-- block->data = kzalloc(bytes, GFP_KERNEL);
-- if (!block->data) {
-- DMERR("Error allocating dax data space");
-- kfree(block);
-- return -ENOMEM;
-- }
--
-- /* write data provided via the iterator */
-- if (!copy_from_iter(block->data, bytes, i)) {
-- DMERR("Error copying dax data");
-- kfree(block->data);
-- kfree(block);
-- return -EIO;
-- }
--
-- /* rewind the iterator so that the block driver can use it */
-- iov_iter_revert(i, bytes);
--
-- block->datalen = bytes;
-- block->sector = bio_to_dev_sectors(lc, sector);
-- block->nr_sectors = ALIGN(bytes, lc->sectorsize) >> lc->sectorshift;
--
-- atomic_inc(&lc->pending_blocks);
-- spin_lock_irq(&lc->blocks_lock);
-- list_add_tail(&block->list, &lc->unflushed_blocks);
-- spin_unlock_irq(&lc->blocks_lock);
-- wake_up_process(lc->log_kthread);
--
-- return 0;
--}
--
- static void log_writes_dtr(struct dm_target *ti)
- {
- struct log_writes_c *lc = ti->private;
-@@ -925,6 +880,52 @@ static void log_writes_io_hints(struct d
- limits->io_min = limits->physical_block_size;
- }
-
-+#if IS_ENABLED(CONFIG_DAX_DRIVER)
-+static int log_dax(struct log_writes_c *lc, sector_t sector, size_t bytes,
-+ struct iov_iter *i)
-+{
-+ struct pending_block *block;
-+
-+ if (!bytes)
-+ return 0;
-+
-+ block = kzalloc(sizeof(struct pending_block), GFP_KERNEL);
-+ if (!block) {
-+ DMERR("Error allocating dax pending block");
-+ return -ENOMEM;
-+ }
-+
-+ block->data = kzalloc(bytes, GFP_KERNEL);
-+ if (!block->data) {
-+ DMERR("Error allocating dax data space");
-+ kfree(block);
-+ return -ENOMEM;
-+ }
-+
-+ /* write data provided via the iterator */
-+ if (!copy_from_iter(block->data, bytes, i)) {
-+ DMERR("Error copying dax data");
-+ kfree(block->data);
-+ kfree(block);
-+ return -EIO;
-+ }
-+
-+ /* rewind the iterator so that the block driver can use it */
-+ iov_iter_revert(i, bytes);
-+
-+ block->datalen = bytes;
-+ block->sector = bio_to_dev_sectors(lc, sector);
-+ block->nr_sectors = ALIGN(bytes, lc->sectorsize) >> lc->sectorshift;
-+
-+ atomic_inc(&lc->pending_blocks);
-+ spin_lock_irq(&lc->blocks_lock);
-+ list_add_tail(&block->list, &lc->unflushed_blocks);
-+ spin_unlock_irq(&lc->blocks_lock);
-+ wake_up_process(lc->log_kthread);
-+
-+ return 0;
-+}
-+
- static long log_writes_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
- long nr_pages, void **kaddr, pfn_t *pfn)
- {
-@@ -961,6 +962,10 @@ static size_t log_writes_dax_copy_from_i
- dax_copy:
- return dax_copy_from_iter(lc->dev->dax_dev, pgoff, addr, bytes, i);
- }
-+#else
-+#define log_writes_dax_direct_access NULL
-+#define log_writes_dax_copy_from_iter NULL
-+#endif
-
- static struct target_type log_writes_target = {
- .name = "log-writes",
---- a/drivers/md/dm-stripe.c
-+++ b/drivers/md/dm-stripe.c
-@@ -313,6 +313,7 @@ static int stripe_map(struct dm_target *
- return DM_MAPIO_REMAPPED;
- }
-
-+#if IS_ENABLED(CONFIG_DAX_DRIVER)
- static long stripe_dax_direct_access(struct dm_target *ti, pgoff_t pgoff,
- long nr_pages, void **kaddr, pfn_t *pfn)
- {
-@@ -353,6 +354,11 @@ static size_t stripe_dax_copy_from_iter(
- return dax_copy_from_iter(dax_dev, pgoff, addr, bytes, i);
- }
-
-+#else
-+#define stripe_dax_direct_access NULL
-+#define stripe_dax_copy_from_iter NULL
-+#endif
-+
- /*
- * Stripe status:
- *
---- a/drivers/md/dm.c
-+++ b/drivers/md/dm.c
-@@ -1826,7 +1826,7 @@ static void cleanup_mapped_device(struct
- static struct mapped_device *alloc_dev(int minor)
- {
- int r, numa_node_id = dm_get_numa_node();
-- struct dax_device *dax_dev;
-+ struct dax_device *dax_dev = NULL;
- struct mapped_device *md;
- void *old_md;
-
-@@ -1892,9 +1892,11 @@ static struct mapped_device *alloc_dev(i
- md->disk->private_data = md;
- sprintf(md->disk->disk_name, "dm-%d", minor);
-
-- dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops);
-- if (!dax_dev)
-- goto bad;
-+ if (IS_ENABLED(CONFIG_DAX_DRIVER)) {
-+ dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops);
-+ if (!dax_dev)
-+ goto bad;
-+ }
- md->dax_dev = dax_dev;
-
- add_disk(md->disk);
---- a/include/linux/dax.h
-+++ b/include/linux/dax.h
-@@ -25,16 +25,39 @@ extern struct attribute_group dax_attrib
-
- #if IS_ENABLED(CONFIG_DAX)
- struct dax_device *dax_get_by_host(const char *host);
-+struct dax_device *alloc_dax(void *private, const char *host,
-+ const struct dax_operations *ops);
- void put_dax(struct dax_device *dax_dev);
-+void kill_dax(struct dax_device *dax_dev);
-+void dax_write_cache(struct dax_device *dax_dev, bool wc);
-+bool dax_write_cache_enabled(struct dax_device *dax_dev);
- #else
- static inline struct dax_device *dax_get_by_host(const char *host)
- {
- return NULL;
- }
--
-+static inline struct dax_device *alloc_dax(void *private, const char *host,
-+ const struct dax_operations *ops)
-+{
-+ /*
-+ * Callers should check IS_ENABLED(CONFIG_DAX) to know if this
-+ * NULL is an error or expected.
-+ */
-+ return NULL;
-+}
- static inline void put_dax(struct dax_device *dax_dev)
- {
- }
-+static inline void kill_dax(struct dax_device *dax_dev)
-+{
-+}
-+static inline void dax_write_cache(struct dax_device *dax_dev, bool wc)
-+{
-+}
-+static inline bool dax_write_cache_enabled(struct dax_device *dax_dev)
-+{
-+ return false;
-+}
- #endif
-
- int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff);
-@@ -79,18 +102,13 @@ static inline struct dax_device *fs_dax_
-
- int dax_read_lock(void);
- void dax_read_unlock(int id);
--struct dax_device *alloc_dax(void *private, const char *host,
-- const struct dax_operations *ops);
- bool dax_alive(struct dax_device *dax_dev);
--void kill_dax(struct dax_device *dax_dev);
- void *dax_get_private(struct dax_device *dax_dev);
- long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
- void **kaddr, pfn_t *pfn);
- size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
- size_t bytes, struct iov_iter *i);
- void dax_flush(struct dax_device *dax_dev, void *addr, size_t size);
--void dax_write_cache(struct dax_device *dax_dev, bool wc);
--bool dax_write_cache_enabled(struct dax_device *dax_dev);
-
- /*
- * We use lowest available bit in exceptional entry for locking, one bit for
diff --git a/series.conf b/series.conf
index 9d3966a2fa..659d06e6eb 100644
--- a/series.conf
+++ b/series.conf
@@ -14154,7 +14154,6 @@
patches.drivers/nfit-address-range-scrub-determine-one-platform-max_.patch
patches.drivers/nfit-address-range-scrub-rework-and-simplify-ARS-sta.patch
patches.drivers/nfit-address-range-scrub-add-module-option-to-skip-i.patch
- patches.suse/0201-dax-dm-allow-device-mapper-to-operate-without-dax-su.patch
patches.drivers/dmaengine-at_xdmac-fix-rare-residue-corruption
patches.drivers/dmaengine-pl330-fix-a-race-condition-in-case-of-thre
patches.drivers/dmaengine-qcom-bam_dma-get-num-channels-and-num-ees-
@@ -15199,6 +15198,7 @@
patches.drivers/nvme-rdma-correctly-check-for-target-keyed-sgl-suppo.patch
patches.drivers/nvmet-filter-newlines-from-user-input.patch
patches.drivers/nvme-cleanup-double-shift-issue.patch
+ patches.fixes/linvdimm-pmem-Preserve-read-only-setting-for-pmem-de.patch
patches.drivers/libnvdimm-pmem-Unconditionally-deep-flush-on-sync.patch
patches.drivers/libnvdimm-pmem-Do-not-flush-power-fail-protected-CPU.patch
patches.drivers/staging-iio-ade7854-Fix-error-handling-on-read-write