Allow creation of items with no value

Item creation always tried to allocate a value.  We have some item types
which don't have values.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-01-24 14:44:11 -08:00
parent 8f63196318
commit 9d68e272cc

View File

@@ -100,8 +100,12 @@ static struct cached_item *alloc_item(struct super_block *sb,
item = kzalloc(sizeof(struct cached_item), GFP_NOFS);
if (item) {
if (!val)
scoutfs_kvec_init_null(item->val);
item->key = scoutfs_key_dup(sb, key);
if (!item->key || scoutfs_kvec_dup_flatten(item->val, val)) {
if (!item->key ||
(val && scoutfs_kvec_dup_flatten(item->val, val))) {
free_item(sb, item);
item = NULL;
}