From: Heinz Mauelshagen <heinzm@redhat.com>
To: dm-devel@redhat.com
Subject: Re: [PATCH 06/24] dm cache policy mq: return NULL if mq->free list is empty in alloc_entry
Date: Sat, 26 Oct 2013 00:36:44 +0200 [thread overview]
Message-ID: <526AF27C.8000501@redhat.com> (raw)
In-Reply-To: <20131025204442.GF4804@redhat.com>
On 10/25/2013 10:44 PM, Mike Snitzer wrote:
> On Fri, Oct 25 2013 at 12:37pm -0400,
> Alasdair G Kergon <agk@redhat.com> wrote:
>
>> On Thu, Oct 24, 2013 at 02:30:19PM -0400, Mike Snitzer wrote:
>>> From: Heinz Mauelshagen <heinzm@redhat.com>
>>> Addresses callers' (insert_in*cache()) requirement that alloc_entry()
>>> return NULL when an entry isn't able to be allocated.
>>
>> What is the code path that leads to the requirement for this patch?
>>
>>> +++ b/drivers/md/dm-cache-policy-mq.c
>>> static struct entry *alloc_entry(struct mq_policy *mq)
>>> + struct entry *e = NULL;
>>>
>>> if (mq->nr_entries_allocated >= mq->nr_entries) {
>>> BUG_ON(!list_empty(&mq->free));
>>> return NULL;
>>> }
>>>
>>> - e = list_entry(list_pop(&mq->free), struct entry, list);
>>> - INIT_LIST_HEAD(&e->list);
>>> - INIT_HLIST_NODE(&e->hlist);
>>> + if (!list_empty(&mq->free)) {
>>> + e = list_entry(list_pop(&mq->free), struct entry, list);
>>> + INIT_LIST_HEAD(&e->list);
>>> + INIT_HLIST_NODE(&e->hlist);
>>> + mq->nr_entries_allocated++;
>>> + }
>> In other words, under what circumstances is mq->nr_entries_allocated
>> less then mq->nr_entries, yet the mq->free list is empty?
>>
>> Is it better to apply a patch like this, or rather to fix whatever situation
>> leads to those circumstances? Has the bug/race always been there or is it a
>> regression?
> Fair questions, Heinz should explain further.
>
> IIRC this change was needed as a prereq for the conversion of his
> out-of-tree "background" policy to a shim (layered ontop of mq).
Has nothing to do with that.
It is a fix for existing callers presuming that alloc_entry() could
return NULL but the
callee did not handle this properly.
>
> So will drop for now, can revisit if/when the need is clearer (e.g. when
> background policy goes upstream). TBD if we need it in the near-term,
> but will table this for now. Dropping patch until more context from
> Heinz is provided.
Leave it in for the aforementioned reason.
Heinz
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2013-10-25 22:36 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 18:30 [PATCH 00/24] dm cache: proposed changes for v3.13 merge Mike Snitzer
2013-10-24 18:30 ` [PATCH 01/24] dm: nest targets used for testing under DM_TEST_TARGETS Mike Snitzer
2013-10-24 23:17 ` Alasdair G Kergon
2013-10-25 19:25 ` Mike Snitzer
2013-10-25 19:29 ` Alasdair G Kergon
2013-10-24 23:51 ` Alasdair G Kergon
2013-10-24 18:30 ` [PATCH 02/24] dm space map disk: optimise sm_disk_dec_block Mike Snitzer
2013-10-24 18:30 ` [PATCH 03/24] dm cache policy: remove return from void policy_remove_mapping Mike Snitzer
2013-10-24 18:30 ` [PATCH 04/24] dm cache policy mq: a few small fixes Mike Snitzer
2013-10-24 18:30 ` [PATCH 05/24] dm cache policy mq: implement writeback_work() and mq_{set, clear}_dirty() Mike Snitzer
2013-10-25 16:06 ` Alasdair G Kergon
2013-10-25 19:18 ` Mike Snitzer
2013-10-24 18:30 ` [PATCH 06/24] dm cache policy mq: return NULL if mq->free list is empty in alloc_entry Mike Snitzer
2013-10-25 16:37 ` Alasdair G Kergon
2013-10-25 20:44 ` Mike Snitzer
2013-10-25 22:36 ` Heinz Mauelshagen [this message]
2013-10-29 14:49 ` [PATCH 06/24 v2] dm cache policy mq: return NULL from alloc_entry if cache is full Mike Snitzer
2013-10-24 18:30 ` [PATCH 07/24] dm cache: be much more aggressive about promoting writes to discarded blocks Mike Snitzer
2013-10-24 18:30 ` [PATCH 08/24] dm cache metadata: return bool from __superblock_all_zeroes Mike Snitzer
2013-10-24 18:30 ` [PATCH 09/24] dm cache metadata: check the metadata version when reading the superblock Mike Snitzer
2013-10-25 17:07 ` Alasdair G Kergon
2013-10-25 19:53 ` Mike Snitzer
2013-10-24 18:30 ` [PATCH 10/24] dm cache policy: variable hints support Mike Snitzer
2013-10-24 18:30 ` [PATCH 11/24] dm table: print error on preresume failure Mike Snitzer
2013-10-25 19:22 ` Alasdair G Kergon
2013-10-25 19:58 ` Mike Snitzer
2013-10-24 18:30 ` [PATCH 12/24] dm cache: add passthrough mode Mike Snitzer
2013-10-24 18:30 ` [PATCH 13/24] dm cache policy: have policy_writeback_work return -ENODATA by default Mike Snitzer
2013-10-24 18:30 ` [PATCH 14/24] dm cache: use is_write_io() in more places Mike Snitzer
2013-10-25 19:53 ` Alasdair G Kergon
2013-10-25 20:11 ` Mike Snitzer
2013-10-24 18:30 ` [PATCH 15/24] dm cache: use cell_defer() boolean argument consistently Mike Snitzer
2013-10-24 18:30 ` [PATCH 16/24] dm cache: log error message if dm_kcopyd_copy() fails Mike Snitzer
2013-11-08 13:33 ` Alasdair G Kergon
2013-10-24 18:30 ` [PATCH 17/24] dm cache: use a boolean when setting cache->quiescing Mike Snitzer
2013-11-06 15:02 ` Alasdair G Kergon
2013-11-06 15:25 ` Mike Snitzer
2013-10-24 18:30 ` [PATCH 18/24] dm cache: optimize commit_if_needed Mike Snitzer
2013-10-24 18:30 ` [PATCH 19/24] dm cache: support for stackable caching policies Mike Snitzer
2013-10-24 18:30 ` [PATCH 20/24] dm cache: add era policy shim Mike Snitzer
2013-10-24 18:30 ` [PATCH 21/24] dm cache: add trc " Mike Snitzer
2013-10-25 20:13 ` Alasdair G Kergon
2013-10-25 21:08 ` Mike Snitzer
2013-10-25 22:44 ` Mike Snitzer
2013-11-01 21:39 ` Steven Rostedt
2013-11-01 23:38 ` Mike Snitzer
2013-10-24 18:30 ` [PATCH 22/24] dm cache: add hints policy Mike Snitzer
2013-10-24 18:30 ` [PATCH 23/24] dm cache: add cache block invalidation API Mike Snitzer
2013-10-24 18:30 ` [PATCH 24/24] dm cache policy era: add cache block invalidation support Mike Snitzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=526AF27C.8000501@redhat.com \
--to=heinzm@redhat.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.