diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-06-24 02:08:34 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-06-26 17:23:38 +0200 |
commit | 581388209405902b56d055f644b4dd124a206112 (patch) | |
tree | 2160b6616cf072396067ca654cd5231e139fc304 /drivers/nvdimm/blk.c | |
parent | pmem: flag pmem block devices as non-rotational (diff) | |
download | linux-581388209405902b56d055f644b4dd124a206112.tar.xz linux-581388209405902b56d055f644b4dd124a206112.zip |
libnvdimm, nfit: handle unarmed dimms, mark namespaces read-only
Upon detection of an unarmed dimm in a region, arrange for descendant
BTT, PMEM, or BLK instances to be read-only. A dimm is primarily marked
"unarmed" via flags passed by platform firmware (NFIT).
The flags in the NFIT memory device sub-structure indicate the state of
the data on the nvdimm relative to its energy source or last "flush to
persistence". For the most part there is nothing the driver can do but
advertise the state of these flags in sysfs and emit a message if
firmware indicates that the contents of the device may be corrupted.
However, for the case of ACPI_NFIT_MEM_ARMED, the driver can arrange for
the block devices incorporating that nvdimm to be marked read-only.
This is a safe default as the data is still available and new writes are
held off until the administrator either forces read-write mode, or the
energy source becomes armed.
A 'read_only' attribute is added to REGION devices to allow for
overriding the default read-only policy of all descendant block devices.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/blk.c')
-rw-r--r-- | drivers/nvdimm/blk.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c index 96ef38ceeceb..4f97b248c236 100644 --- a/drivers/nvdimm/blk.c +++ b/drivers/nvdimm/blk.c @@ -232,6 +232,7 @@ static int nd_blk_rw_bytes(struct nd_namespace_common *ndns, static const struct block_device_operations nd_blk_fops = { .owner = THIS_MODULE, + .revalidate_disk = nvdimm_revalidate_disk, }; static int nd_blk_attach_disk(struct nd_namespace_common *ndns, @@ -283,6 +284,7 @@ static int nd_blk_attach_disk(struct nd_namespace_common *ndns, } set_capacity(disk, available_disk_size >> SECTOR_SHIFT); + revalidate_disk(disk); return 0; } |