client: double mount returns -EISCONN

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>
This commit is contained in:
Noah Watkins 2012-10-25 12:04:00 -07:00
parent 1152656c62
commit f1eef53200
2 changed files with 12 additions and 1 deletions

View File

@ -67,7 +67,7 @@ public:
int ret;
if (mounted)
return -EDOM;
return -EISCONN;
common_init_finish(cct);

View 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);