]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs: get osd location on -1 should return EINVAL
authorSage Weil <sage@inktank.com>
Sat, 28 Dec 2013 18:25:00 +0000 (10:25 -0800)
committerSage Weil <sage@inktank.com>
Sat, 28 Dec 2013 18:25:00 +0000 (10:25 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
src/client/Client.cc
src/test/libcephfs/test.cc

index 68fad0d917a397dd53ecf98bb3b2754ab690f255..db050b94d8958bba06f8172f248e6ede009b1b20 100644 (file)
@@ -8031,6 +8031,8 @@ int Client::get_file_extent_osds(int fd, loff_t off, loff_t *len, vector<int>& o
 int Client::get_osd_crush_location(int id, vector<pair<string, string> >& path)
 {
   Mutex::Locker lock(client_lock);
+  if (id < 0)
+    return -EINVAL;
   return osdmap->crush->get_full_location_ordered(id, path);
 }
 
index 597d049e2a44698d3df5ca559f201bdb7f85be89..4823d60103ac5ca84db924c30358a5eccf9434bc 100644 (file)
@@ -1063,7 +1063,7 @@ TEST(LibCephFS, GetOsdCrushLocation) {
 
   char path[256];
   ASSERT_EQ(ceph_get_osd_crush_location(cmount, 9999999, path, 0), -ENOENT);
-  ASSERT_EQ(ceph_get_osd_crush_location(cmount, -1, path, 0), -ENOENT);
+  ASSERT_EQ(ceph_get_osd_crush_location(cmount, -1, path, 0), -EINVAL);
 
   char test_file[256];
   sprintf(test_file, "test_osds_loc_%d", getpid());