From 877237f0962b9bc0cbfb7ceb536b47c4abe1b93c Mon Sep 17 00:00:00 2001 From: Haomai Wang Date: Wed, 19 Nov 2014 10:48:28 +0800 Subject: [PATCH] KeyValueStore: Return -ENODATA if collection_getattr is nonexist Signed-off-by: Haomai Wang --- src/os/KeyValueStore.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/os/KeyValueStore.cc b/src/os/KeyValueStore.cc index 2ed74b7b64f01..505f06fee776c 100644 --- a/src/os/KeyValueStore.cc +++ b/src/os/KeyValueStore.cc @@ -2268,12 +2268,16 @@ int KeyValueStore::collection_getattr(coll_t c, const char *name, r = -EINVAL; } - if (out.size()) + if (out.size()) { bl.swap(out.begin()->second); + r = bl.length(); + } else { + r = -ENODATA; + } dout(10) << __func__ << " " << c.to_str() << " '" << name << "' len " << bl.length() << " = " << r << dendl; - return bl.length(); + return r; } int KeyValueStore::collection_getattrs(coll_t cid, -- 2.39.5