diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2015-08-21 00:36:39 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-01-18 20:22:31 -0900 |
commit | 18a4c671266816d4e46c7733d057af19723ecd9c (patch) | |
tree | e22180bc4a8489e195271be91cb50bc392acdaf3 | |
parent | a60c493aba08790e50ee14ba865a089c403a9f9a (diff) |
bcache: Fix an assertion in alloc.c +265
This was because of bkey_cmpxchg() racing - the race itself was harmeless
(bkey_cmpxchg() would have failed and we would have subtracted off the sector
counts we added), but prevent it to suppress the assertion.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | drivers/md/bcache/buckets.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/md/bcache/buckets.c b/drivers/md/bcache/buckets.c index 8808dda9efb2..4c6a2c65087a 100644 --- a/drivers/md/bcache/buckets.c +++ b/drivers/md/bcache/buckets.c @@ -199,6 +199,15 @@ u8 bch_mark_data_bucket(struct cache_set *c, struct cache *ca, struct bkey *k, if (!gc && gc_will_visit_key(c, k)) return 0; + /* + * Disallowed state transition - this means a bkey_cmpxchg() + * operation is racing; just treat it like the pointer was + * already stale + */ + if (!gc && dirty && + is_available_bucket(old)) + return 1; + BUG_ON(old.is_metadata); if (dirty && new.dirty_sectors == GC_MAX_SECTORS_USED && |