dm cache: add fail io mode and needs_check flag
If a cache metadata operation fails (e.g. transaction commit) the cache's metadata device will abort the current transaction, set a new needs_check flag, and the cache will transition to "read-only" mode. If aborting the transaction or setting the needs_check flag fails the cache will transition to "fail-io" mode. Once needs_check is set the cache device will not be allowed to activate. Activation requires write access to metadata. Future work is needed to add proper support for running the cache in read-only mode. Once in fail-io mode the cache will report a status of "Fail". Also, add commit() wrapper that will disallow commits if in read_only or fail mode. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:

committed by
Mike Snitzer

parent
88bf5184fa
commit
028ae9f76f
@@ -89,13 +89,15 @@ static inline void policy_tick(struct dm_cache_policy *p)
|
||||
return p->tick(p);
|
||||
}
|
||||
|
||||
static inline int policy_emit_config_values(struct dm_cache_policy *p, char *result, unsigned maxlen)
|
||||
static inline int policy_emit_config_values(struct dm_cache_policy *p, char *result,
|
||||
unsigned maxlen, ssize_t *sz_ptr)
|
||||
{
|
||||
ssize_t sz = 0;
|
||||
ssize_t sz = *sz_ptr;
|
||||
if (p->emit_config_values)
|
||||
return p->emit_config_values(p, result, maxlen);
|
||||
return p->emit_config_values(p, result, maxlen, sz_ptr);
|
||||
|
||||
DMEMIT("0");
|
||||
DMEMIT("0 ");
|
||||
*sz_ptr = sz;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user