From 80c85738d03341f0eb5e771e356faf3c14237273 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 12 Nov 2015 13:53:38 -0500 Subject: [PATCH] librgw: fix rgw_unlink Fix handling of bucket namespace, remove bogus RGWLibFS::is_root() logic. Also remove a stray debug check. Signed-off-by: Matt Benjamin --- src/rgw/rgw_file.cc | 14 +++++++------- src/rgw/rgw_file.h | 5 ----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 537f9c06a97ed..2924e533a0185 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -208,25 +208,27 @@ int rgw_rename(struct rgw_fs *rgw_fs, /* remove file or directory */ -int rgw_unlink(struct rgw_fs *rgw_fs, struct rgw_file_handle* parent, - const char* path) +int rgw_unlink(struct rgw_fs *rgw_fs, struct rgw_file_handle* parent_fh, + const char *name) { int rc = 0; RGWLibFS *fs = static_cast(rgw_fs->fs_private); CephContext* cct = static_cast(rgw_fs->rgw); - if (fs->is_root(rgw_fs)) { + RGWFileHandle* parent = get_rgwfh(parent_fh); + + if (parent->is_root()) { /* XXXX remove uri and deal with bucket and object names */ string uri = "/"; - uri += path; + uri += name; RGWDeleteBucketRequest req(cct, fs->get_user(), uri); rc = librgw.get_fe()->execute_req(&req); } else { /* * object */ - RGWDeleteObjRequest req(cct, fs->get_user(), "/", path); + RGWDeleteObjRequest req(cct, fs->get_user(), parent->bucket_name(), name); rc = librgw.get_fe()->execute_req(&req); } @@ -603,8 +605,6 @@ int rgw_readv(struct rgw_fs *rgw_fs, if (! rgw_fh->is_object()) return -EINVAL; - dout(15) << "test dout" << dendl; - buffer::list bl; RGWGetObjRequest req(cct, fs->get_user(), rgw_fh->bucket_name(), rgw_fh->object_name(), uio->uio_offset, uio->uio_resid, diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index de8a7135127ec..732e5f8bf36e9 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -414,11 +414,6 @@ namespace rgw { uint32_t get_inst() { return fs_inst; } RGWUserInfo* get_user() { return &user; } - - bool is_root(struct rgw_fs* _fs) { - return (&fs == _fs); - } - }; /* RGWLibFS */ } /* namespace rgw */ -- 2.39.5