]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/posix: reading a detele marker returns -ENOENT
authorAli Masarwa <amasarwa@redhat.com>
Mon, 29 Jun 2026 11:09:04 +0000 (14:09 +0300)
committerAli Masarwa <amasarwa@redhat.com>
Tue, 30 Jun 2026 10:48:31 +0000 (13:48 +0300)
Signed-off-by: Ali Masarwa <amasarwa@redhat.com>
src/rgw/driver/posix/rgw_sal_posix.cc
src/rgw/driver/posix/rgw_sal_posix.h

index a7c097f82fe3d98c6fe6c194c20d34dfebb4e2ba..01ce60f72109df5c29ed0a155380bec85c22d691 100644 (file)
@@ -1540,7 +1540,14 @@ int VersionedDirectory::stat(const DoutPrefixProvider* dpp, bool force)
     }
     bufferlist bl;
     if (rgw::sal::get_attr(attrs, RGW_POSIX_ATTR_VERSION, bl)) {
-    //  cur_version.reset();
+      uint16_t flags = 0;
+      ceph::decode(flags, bl);
+      if (flags & rgw_bucket_dir_entry::FLAG_DELETE_MARKER) {
+        ldpp_dout(dpp, 0) << "ERROR: a delete marker, returning ENOENT "
+                          << get_name() << dendl;
+        cur_version.reset();
+        return -ENOENT;
+      }
     }
   }
 
@@ -1683,7 +1690,7 @@ int VersionedDirectory::copy(const DoutPrefixProvider *dpp, optional_yield y,
 int VersionedDirectory::add_delete_marker(const DoutPrefixProvider* dpp,
                                           optional_yield y,
                                           std::unique_ptr<File>& marker,
-                                          std::string& name)
+                                          const std::string &name)
 {
   // Create as temporary file first
   int ret = marker->create(dpp, /*existed=*/nullptr, /*temp_file=*/true);
index b3caeade70edce2fe4025f29b051a639b34a3e6d..b0656eaf2b9abeeb6b9b77d606fc982bceb1a4d6 100644 (file)
@@ -337,7 +337,7 @@ public:
   std::string get_new_instance();
   int remove_symlink(const DoutPrefixProvider *dpp, optional_yield y, std::string match = "");
   int add_file(const DoutPrefixProvider *dpp, std::unique_ptr<FSEnt>&& file, bool* existed = nullptr, bool temp_file = false);
-  int add_delete_marker(const DoutPrefixProvider* dpp, optional_yield y, std::unique_ptr<File>& marker, std::string& name);
+  int add_delete_marker(const DoutPrefixProvider* dpp, optional_yield y, std::unique_ptr<File>& marker, const std::string &name);
   FSEnt* get_cur_version_ent() { return cur_version.get(); };
   int set_cur_version_ent(const DoutPrefixProvider *dpp, FSEnt* file);
   virtual std::unique_ptr<FSEnt> clone_base() override {