alistair23-linux/drivers/nvdimm
Robert Elliott 254a4cd50b linvdimm, pmem: Preserve read-only setting for pmem devices
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 20bd1d026a ("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: 5813882094 ("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>
2018-05-31 21:07:33 -07:00
..
badrange.c libnvdimm, badrange: remove a WARN for list_empty 2017-11-02 10:42:30 -07:00
blk.c for-4.17/block-20180402 2018-04-05 14:27:02 -07:00
btt.c for-4.17/block-20180402 2018-04-05 14:27:02 -07:00
btt.h libnvdimm, btt: Fix an incompatibility in the log layout 2017-12-21 14:59:27 -08:00
btt_devs.c libnvdimm: remove redundant __func__ in dev_dbg 2018-03-06 08:44:17 -08:00
bus.c linvdimm, pmem: Preserve read-only setting for pmem devices 2018-05-31 21:07:33 -07:00
claim.c libnvdimm: remove redundant __func__ in dev_dbg 2018-03-06 08:44:17 -08:00
core.c libnvdimm: remove redundant __func__ in dev_dbg 2018-03-06 08:44:17 -08:00
dax_devs.c libnvdimm: remove redundant __func__ in dev_dbg 2018-03-06 08:44:17 -08:00
dimm.c libnvdimm, dimm: fix dpa reservation vs uninitialized label area 2018-04-06 22:59:32 -07:00
dimm_devs.c libnvdimm, dimm: handle EACCES failures from label reads 2018-04-16 08:18:51 -07:00
e820.c libnvdimm, e820: use module_platform_driver 2016-12-05 08:52:21 -08:00
Kconfig Revert "libnvdimm, of_pmem: workaround OF_NUMA=n build error" 2018-04-19 15:10:56 -07:00
label.c libnvdimm, label: change nvdimm_num_label_slots per UEFI 2.7 2018-03-15 13:59:57 -07:00
label.h libnvdimm, label: change min label storage size per UEFI 2.7 2018-03-15 10:44:32 -07:00
Makefile libnvdimm: Add device-tree based driver 2018-04-07 07:53:23 -07:00
namespace_devs.c libnvdimm, namespace: use a safe lookup for dimm device name 2018-04-06 22:59:39 -07:00
nd-core.h libnvdimm: move poison list functions to a new 'badrange' file 2017-11-02 10:42:30 -07:00
nd.h libnvdimm for 4.17 2018-04-10 10:25:57 -07:00
of_pmem.c libnvdimm, of_pmem: use dev_to_node() instead of of_node_to_nid() 2018-04-19 15:07:10 -07:00
pfn.h libnvdimm, dax: autodetect support 2016-05-20 22:02:57 -07:00
pfn_devs.c Merge branch 'for-4.17/libnvdimm' into libnvdimm-for-next 2018-04-09 10:50:08 -07:00
pmem.c libnvdimm for 4.17 2018-04-10 10:25:57 -07:00
pmem.h memremap: change devm_memremap_pages interface to use struct dev_pagemap 2018-01-08 11:46:23 -08:00
region.c libnvdimm, region: quiet region probe 2018-04-07 07:47:10 -07:00
region_devs.c Merge branch 'for-4.17/libnvdimm' into libnvdimm-for-next 2018-04-09 10:50:08 -07:00