From 72d82e21d44c48a3823156afa900eb071b3eb144 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Sat, 18 Aug 2012 22:03:46 +0200 Subject: [PATCH] dev-cache: Make it possible to pass in a NULL filter. --- lib/device/dev-cache.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index c92e11e9e..1da9a7750 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -971,21 +971,23 @@ struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan) if (dev_scan && !trust_cache()) { /* Flag gets reset between each command */ - if (!full_scan_done()) + if (!full_scan_done() && f) persistent_filter_wipe(f); /* Calls _full_scan(1) */ } else _full_scan(0); di->current = btree_first(_cache.devices); di->filter = f; - di->filter->use_count++; + if (di->filter) + di->filter->use_count++; return di; } void dev_iter_destroy(struct dev_iter *iter) { - iter->filter->use_count--; + if (iter->filter) + iter->filter->use_count--; dm_free(iter); }