- fix race condition in dm-cache-policy-smq
-----BEGIN PGP SIGNATURE----- iIoEABYIADIWIQRnH8MwLyZDhyYfesYTAyx9YGnhbQUCah2mPxQcbXBhdG9ja2FA cmVkaGF0LmNvbQAKCRATAyx9YGnhbVGGAQDNaDwK2kE1az7Jpgu91U23R8fSxeBz SomeFHmqEHcEQAEAk2/3vG20zshIWFbz9Y1ZdZ9q9RKLrAh/83i3YVLbkQQ= =D0RT -----END PGP SIGNATURE----- Merge tag 'for-7.1/dm-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm Pull device mapper fix from Mikulas Patocka: - fix race condition in dm-cache-policy-smq * tag 'for-7.1/dm-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm cache policy smq: check allocation under invalidate lockmaster
commit
6f3ed7fec7
|
|
@ -1590,18 +1590,22 @@ static int smq_invalidate_mapping(struct dm_cache_policy *p, dm_cblock_t cblock)
|
||||||
struct smq_policy *mq = to_smq_policy(p);
|
struct smq_policy *mq = to_smq_policy(p);
|
||||||
struct entry *e = get_entry(&mq->cache_alloc, from_cblock(cblock));
|
struct entry *e = get_entry(&mq->cache_alloc, from_cblock(cblock));
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
int r = 0;
|
||||||
if (!e->allocated)
|
|
||||||
return -ENODATA;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&mq->lock, flags);
|
spin_lock_irqsave(&mq->lock, flags);
|
||||||
|
if (!e->allocated) {
|
||||||
|
r = -ENODATA;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
// FIXME: what if this block has pending background work?
|
// FIXME: what if this block has pending background work?
|
||||||
del_queue(mq, e);
|
del_queue(mq, e);
|
||||||
h_remove(&mq->table, e);
|
h_remove(&mq->table, e);
|
||||||
free_entry(&mq->cache_alloc, e);
|
free_entry(&mq->cache_alloc, e);
|
||||||
|
|
||||||
|
out:
|
||||||
spin_unlock_irqrestore(&mq->lock, flags);
|
spin_unlock_irqrestore(&mq->lock, flags);
|
||||||
|
|
||||||
return 0;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t smq_get_hint(struct dm_cache_policy *p, dm_cblock_t cblock)
|
static uint32_t smq_get_hint(struct dm_cache_policy *p, dm_cblock_t cblock)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue