[PATCH] check for valid filehandler, before using in next calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In case of nonexistent file, calling Client::replication()
triggers assert.

Signed-off-by: Andrey Stepachev <octo@xxxxxxxxxxxxxx>
---
 src/client/hadoop/CephFSInterface.cc |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/client/hadoop/CephFSInterface.cc b/src/client/hadoop/CephFSInterface.cc
index 4a050f2..5ffca64 100644
--- a/src/client/hadoop/CephFSInterface.cc
+++ b/src/client/hadoop/CephFSInterface.cc
@@ -750,9 +750,12 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephTalker_ceph_1replicati
   ceph_mount_info *cmount = get_ceph_mount_t(env, obj);
   int fh = 0;
   fh = ceph_open(cmount, c_path, O_RDONLY, 0);
+  env->ReleaseStringUTFChars(j_path, c_path);
+  if (fh < 0) {
+	  return fh;
+  }
   int replication = ceph_get_file_replication(cmount, fh);
   ceph_close(cmount, fh);
-  env->ReleaseStringUTFChars(j_path, c_path);
   return replication;
 }
 
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux