]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: double mount returns -EISCONN
authorNoah Watkins <noahwatkins@gmail.com>
Thu, 25 Oct 2012 19:04:00 +0000 (12:04 -0700)
committerNoah Watkins <noahwatkins@gmail.com>
Fri, 26 Oct 2012 15:38:26 +0000 (08:38 -0700)
Change error code from -EDOM to -EISCONN when mounting an already
mounted ceph_mount_info instance.  The current convention is to return
-ENOTCONN when using the libcephfs interface in an unmounted state.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
src/libcephfs.cc
src/test/libcephfs/test.cc

index 69fca3f6a3929ebc4121ec772bcbb337d599116e..d589633f5aa651e9e8305d030ec57cd389ca0c43 100644 (file)
@@ -67,7 +67,7 @@ public:
     int ret;
     
     if (mounted)
-      return -EDOM;
+      return -EISCONN;
 
     common_init_finish(cct);
 
index bab4ebf905aa8d735b8a850021f072403272bb08..6d707495632024d84e111573b2fba8b376a40741 100644 (file)
@@ -68,6 +68,17 @@ TEST(LibCephFS, Mount_non_exist) {
   ASSERT_NE(0, ceph_mount(cmount, "/non-exist"));
 }
 
+TEST(LibCephFS, Mount_double) {
+
+  struct ceph_mount_info *cmount;
+
+  ASSERT_EQ(0, ceph_create(&cmount, NULL));
+  ASSERT_EQ(0, ceph_conf_read_file(cmount, NULL));
+  ASSERT_EQ(0, ceph_mount(cmount, "/"));
+  ASSERT_EQ(-EISCONN, ceph_mount(cmount, "/"));
+  ceph_shutdown(cmount);
+}
+
 TEST(LibCephFS, Mount) {
   struct ceph_mount_info *cmount;
   ASSERT_EQ(ceph_create(&cmount, NULL), 0);