summaryrefslogtreecommitdiffstats
path: root/src/test/librgw_file_gp.cc
diff options
context:
space:
mode:
authorMatt Benjamin <mbenjamin@redhat.com>2015-11-04 18:48:03 +0100
committerMatt Benjamin <mbenjamin@redhat.com>2016-02-12 18:05:36 +0100
commit455d9d5c73831ef9882e1720873a25125e2c5d83 (patch)
treef8bec7cb7a214541d3f6598a59b2744ef34d32fb /src/test/librgw_file_gp.cc
parentlibrgw: implement intrusive filehandle cache (diff)
downloadceph-455d9d5c73831ef9882e1720873a25125e2c5d83.tar.xz
ceph-455d9d5c73831ef9882e1720873a25125e2c5d83.zip
librgw_file_gp: check test state before closing null fh handle
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Diffstat (limited to 'src/test/librgw_file_gp.cc')
-rw-r--r--src/test/librgw_file_gp.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/test/librgw_file_gp.cc b/src/test/librgw_file_gp.cc
index 70468fb39ba..adc9629de3b 100644
--- a/src/test/librgw_file_gp.cc
+++ b/src/test/librgw_file_gp.cc
@@ -47,6 +47,8 @@ namespace {
bool do_delete = false;
bool do_hexdump = false;
+ bool object_open = false;
+
string bucket_name = "sorry_dave";
string object_name = "jocaml";
@@ -226,6 +228,7 @@ TEST(LibRGW, OBJ_OPEN) {
if (do_get || do_put || do_readv || do_writev) {
int ret = rgw_open(fs, object_fh, 0 /* flags */);
ASSERT_EQ(ret, 0);
+ object_open = true;
}
}
@@ -361,10 +364,15 @@ TEST(LibRGW, CLEANUP) {
uio->uio_rele(uio, RGW_UIO_NONE);
}
}
- int ret = rgw_close(fs, object_fh, 0 /* flags */);
- ASSERT_EQ(ret, 0);
- ret = rgw_fh_rele(fs, object_fh, 0 /* flags */);
- ASSERT_EQ(ret, 0);
+ int ret;
+ if (object_open) {
+ ret = rgw_close(fs, object_fh, 0 /* flags */);
+ ASSERT_EQ(ret, 0);
+ }
+ if (object_fh) {
+ ret = rgw_fh_rele(fs, object_fh, 0 /* flags */);
+ ASSERT_EQ(ret, 0);
+ }
ret = rgw_fh_rele(fs, bucket_fh, 0 /* flags */);
ASSERT_EQ(ret, 0);
}