]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs: return -ENOTCONN when call unmounted
authorNoah Watkins <noahwatkins@gmail.com>
Mon, 7 Jan 2013 23:47:38 +0000 (15:47 -0800)
committerNoah Watkins <noahwatkins@gmail.com>
Mon, 7 Jan 2013 23:49:52 +0000 (15:49 -0800)
Adds -ENOTCONN return value for stat, fchmod, fchown, lchown.

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

index e3f54508013ca032808593dd943197eebcf0552f..8b51ab93fcc43bc90febe2d65d8f5d4645313c75 100644 (file)
@@ -477,6 +477,8 @@ extern "C" int ceph_symlink(struct ceph_mount_info *cmount, const char *existing
 extern "C" int ceph_stat(struct ceph_mount_info *cmount, const char *path,
                         struct stat *stbuf)
 {
+  if (!cmount->is_mounted())
+    return -ENOTCONN;
   return cmount->get_client()->stat(path, stbuf);
 }
 
@@ -562,6 +564,8 @@ extern "C" int ceph_chmod(struct ceph_mount_info *cmount, const char *path, mode
 }
 extern "C" int ceph_fchmod(struct ceph_mount_info *cmount, int fd, mode_t mode)
 {
+  if (!cmount->is_mounted())
+    return -ENOTCONN;
   return cmount->get_client()->fchmod(fd, mode);
 }
 extern "C" int ceph_chown(struct ceph_mount_info *cmount, const char *path,
@@ -574,11 +578,15 @@ extern "C" int ceph_chown(struct ceph_mount_info *cmount, const char *path,
 extern "C" int ceph_fchown(struct ceph_mount_info *cmount, int fd,
                           uid_t uid, gid_t gid)
 {
+  if (!cmount->is_mounted())
+    return -ENOTCONN;
   return cmount->get_client()->fchown(fd, uid, gid);
 }
 extern "C" int ceph_lchown(struct ceph_mount_info *cmount, const char *path,
                           uid_t uid, gid_t gid)
 {
+  if (!cmount->is_mounted())
+    return -ENOTCONN;
   return cmount->get_client()->lchown(path, uid, gid);
 }