]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: fix rgw_unlink
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 12 Nov 2015 18:53:38 +0000 (13:53 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:05:58 +0000 (12:05 -0500)
Fix handling of bucket namespace, remove bogus RGWLibFS::is_root()
logic.  Also remove a stray debug check.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.cc
src/rgw/rgw_file.h

index 537f9c06a97ed06a6ab23a3f4fe05670c626a7cc..2924e533a01856b25eee5e34222e3177a683cf79 100644 (file)
@@ -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<RGWLibFS*>(rgw_fs->fs_private);
   CephContext* cct = static_cast<CephContext*>(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,
index de8a7135127ec16ed96983b0167064722369f960..732e5f8bf36e9c18ad381b92016e05131d0070f0 100644 (file)
@@ -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 */