From: Noah Watkins Date: Mon, 7 Jan 2013 23:47:38 +0000 (-0800) Subject: libcephfs: return -ENOTCONN when call unmounted X-Git-Tag: v0.57~239^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5c58aa96e4cd72f8be2fdbfc4cbb404aa49ec25c;p=ceph.git libcephfs: return -ENOTCONN when call unmounted Adds -ENOTCONN return value for stat, fchmod, fchown, lchown. Signed-off-by: Noah Watkins --- diff --git a/src/libcephfs.cc b/src/libcephfs.cc index e3f54508013c..8b51ab93fcc4 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -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); }