summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-thin-metadata.h
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2014-02-14 11:58:41 -0500
committerMike Snitzer <snitzer@redhat.com>2014-03-05 15:25:35 -0500
commit07f2b6e0382ec4c59887d5954683f1a0b265574e (patch)
tree4863593c0fb83c54cb2865f4f0f6a44969aa28a6 /drivers/md/dm-thin-metadata.h
parentcdc2b4158405f1975f9d5205096f08430eda1c0e (diff)
downloadtalos-obmc-linux-07f2b6e0382ec4c59887d5954683f1a0b265574e.tar.gz
talos-obmc-linux-07f2b6e0382ec4c59887d5954683f1a0b265574e.zip
dm thin: ensure user takes action to validate data and metadata consistency
If a thin metadata operation fails the current transaction will abort, whereby causing potential for IO layers up the stack (e.g. filesystems) to have data loss. As such, set THIN_METADATA_NEEDS_CHECK_FLAG in the thin metadata's superblock which: 1) requires the user verify the thin metadata is consistent (e.g. use thin_check, etc) 2) suggests the user verify the thin data is consistent (e.g. use fsck) The only way to clear the superblock's THIN_METADATA_NEEDS_CHECK_FLAG is to run thin_repair. On metadata operation failure: abort current metadata transaction, set pool in read-only mode, and now set the needs_check flag. As part of this change, constraints are introduced or relaxed: * don't allow a pool to transition to write mode if needs_check is set * don't allow data or metadata space to be resized if needs_check is set * if a thin pool's metadata space is exhausted: the kernel will now force the user to take the pool offline for repair before the kernel will allow the metadata space to be extended. Also, update Documentation to include information about when the thin provisioning target commits metadata, how it handles metadata failures and running out of space. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Joe Thornber <ejt@redhat.com>
Diffstat (limited to 'drivers/md/dm-thin-metadata.h')
-rw-r--r--drivers/md/dm-thin-metadata.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/md/dm-thin-metadata.h b/drivers/md/dm-thin-metadata.h
index 82ea384d36ff..e3c857db195a 100644
--- a/drivers/md/dm-thin-metadata.h
+++ b/drivers/md/dm-thin-metadata.h
@@ -25,6 +25,11 @@
/*----------------------------------------------------------------*/
+/*
+ * Thin metadata superblock flags.
+ */
+#define THIN_METADATA_NEEDS_CHECK_FLAG (1 << 0)
+
struct dm_pool_metadata;
struct dm_thin_device;
@@ -202,6 +207,12 @@ int dm_pool_register_metadata_threshold(struct dm_pool_metadata *pmd,
dm_sm_threshold_fn fn,
void *context);
+/*
+ * Updates the superblock immediately.
+ */
+int dm_pool_metadata_set_needs_check(struct dm_pool_metadata *pmd);
+bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd);
+
/*----------------------------------------------------------------*/
#endif
OpenPOWER on IntegriCloud