summaryrefslogtreecommitdiffstats
path: root/src/os/FuseStore.cc
diff options
context:
space:
mode:
authorSage Weil <sage@redhat.com>2016-01-07 16:47:28 +0100
committerSage Weil <sage@redhat.com>2016-01-27 20:06:13 +0100
commit57289de42b7d5e1f0b88d1c2f2f40a74851ad04e (patch)
treecde3187b1e3cf8a874f22666e14629cffde29b71 /src/os/FuseStore.cc
parentos/FuseStore: hide bitwise_hash_end if bits unknown; add bitwise_hash_bits (diff)
downloadceph-57289de42b7d5e1f0b88d1c2f2f40a74851ad04e.tar.xz
ceph-57289de42b7d5e1f0b88d1c2f2f40a74851ad04e.zip
os/FuseStore: more ENOENT on getattr for non-existent items
Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/os/FuseStore.cc')
-rw-r--r--src/os/FuseStore.cc29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/os/FuseStore.cc b/src/os/FuseStore.cc
index 0c9e0edb15d..35f54e66781 100644
--- a/src/os/FuseStore.cc
+++ b/src/os/FuseStore.cc
@@ -211,28 +211,43 @@ static int os_getattr(const char *path, struct stat *stbuf)
stbuf->st_mode = S_IFREG | 0700;
switch (t) {
- case FN_OBJECT:
case FN_OBJECT_OMAP:
case FN_OBJECT_ATTR:
+ case FN_OBJECT:
+ if (!fs->store->exists(cid, oid))
+ return -ENOENT;
+ // fall-thru
case FN_ALL:
case FN_HASH_DIR:
case FN_HASH_VAL:
- case FN_ROOT:
case FN_COLLECTION:
+ if (!fs->store->collection_exists(cid))
+ return -ENOENT;
+ // fall-thru
+ case FN_ROOT:
stbuf->st_mode = S_IFDIR | 0700;
return 0;
+ case FN_OBJECT_HASH:
+ if (!fs->store->exists(cid, oid))
+ return -ENOENT;
+ stbuf->st_size = 9;
+ return 0;
+
case FN_HASH_END:
+ if (!fs->store->collection_exists(cid))
+ return -ENOENT;
if (fs->store->collection_bits(cid) < 0)
return -ENOENT;
// fall-thru
case FN_HASH_START:
- case FN_OBJECT_HASH:
stbuf->st_size = 9;
return 0;
case FN_HASH_BITS:
{
+ if (!fs->store->collection_exists(cid))
+ return -ENOENT;
int bits = fs->store->collection_bits(cid);
if (bits < 0)
return -ENOENT;
@@ -244,6 +259,8 @@ static int os_getattr(const char *path, struct stat *stbuf)
case FN_OBJECT_DATA:
{
+ if (!fs->store->exists(cid, oid))
+ return -ENOENT;
int r = fs->store->stat(cid, oid, stbuf);
if (r < 0)
return r;
@@ -252,6 +269,8 @@ static int os_getattr(const char *path, struct stat *stbuf)
case FN_OBJECT_OMAP_HEADER:
{
+ if (!fs->store->exists(cid, oid))
+ return -ENOENT;
bufferlist bl;
fs->store->omap_get_header(cid, oid, &bl);
stbuf->st_size = bl.length();
@@ -260,6 +279,8 @@ static int os_getattr(const char *path, struct stat *stbuf)
case FN_OBJECT_OMAP_VAL:
{
+ if (!fs->store->exists(cid, oid))
+ return -ENOENT;
set<string> k;
k.insert(key);
map<string,bufferlist> v;
@@ -273,6 +294,8 @@ static int os_getattr(const char *path, struct stat *stbuf)
case FN_OBJECT_ATTR_VAL:
{
+ if (!fs->store->exists(cid, oid))
+ return -ENOENT;
bufferptr v;
int r = fs->store->getattr(cid, oid, key.c_str(), v);
if (r == -ENODATA)