From: Matt Benjamin Date: Tue, 24 Nov 2020 13:44:16 +0000 (-0500) Subject: rgwfio: save ref'd object handles until cleanup X-Git-Tag: v16.1.0~81^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=18bd7bb3ff1d6bd945068dd96791367cb1f797b8;p=ceph.git rgwfio: save ref'd object handles until cleanup Save active file handle objects until fio_librgw_cleanup(), so they stay in the librgw handle cache. Signed-off-by: Matt Benjamin --- diff --git a/src/test/fio/fio_librgw.cc b/src/test/fio/fio_librgw.cc index 14418f433c8..e5086fff6bf 100644 --- a/src/test/fio/fio_librgw.cc +++ b/src/test/fio/fio_librgw.cc @@ -49,7 +49,7 @@ namespace { rgw_fs* fs; rgw_file_handle* bucket_fh; - sem_t active; + std::vector fh_vec; librgw_data(thread_data* td) : rgw_h(nullptr), fs(nullptr), bucket_fh(nullptr) @@ -59,6 +59,17 @@ namespace { memset(aio_events, 0, size); } + void save_handle(rgw_file_handle* fh) { + fh_vec.push_back(fh); + } + + void release_handles() { + for (auto object_fh : fh_vec) { + rgw_fh_rele(fs, object_fh, RGW_FH_RELE_FLAG_NONE); + } + fh_vec.clear(); + } + ~librgw_data() { free(aio_events); } @@ -298,6 +309,10 @@ namespace { /* cleanup specific data */ librgw_data* data = static_cast(td->io_ops_data); if (data) { + + /* release active handles */ + data->release_handles(); + if (data->bucket_fh) { r = rgw_fh_rele(data->fs, data->bucket_fh, 0 /* flags */); } @@ -403,8 +418,8 @@ namespace { r = rgw_close(data->fs, object_fh, 0 /* flags */); - /* release 1 ref */ - rgw_fh_rele(data->fs, object_fh, RGW_FH_RELE_FLAG_NONE); + /* object_fh is closed but still reachable, save it */ + data->save_handle(object_fh); } else if (io_u->ddir == DDIR_READ) { r = rgw_lookup(data->fs, data->bucket_fh, object, &object_fh, @@ -436,7 +451,9 @@ namespace { if (object_fh) { r = rgw_close(data->fs, object_fh, 0 /* flags */); - rgw_fh_rele(data->fs, object_fh, RGW_FH_RELE_FLAG_NONE); + + /* object_fh is closed but still reachable, save it */ + data->save_handle(object_fh); } out: