diff --git a/src/rgw/driver/sfs/bucket.cc b/src/rgw/driver/sfs/bucket.cc index abd4cab67b99e8..91e9e2fc673ac5 100644 --- a/src/rgw/driver/sfs/bucket.cc +++ b/src/rgw/driver/sfs/bucket.cc @@ -404,21 +404,11 @@ int SFSBucket:: int SFSBucket::merge_and_store_attrs( const DoutPrefixProvider* /*dpp*/, Attrs& new_attrs, optional_yield /*y*/ ) { - for (auto& it : new_attrs) { - attrs[it.first] = it.second; - - if (it.first == RGW_ATTR_ACL) { - auto lval = it.second.cbegin(); - acls.decode(lval); - } - } - for (auto& it : attrs) { - auto it_find = new_attrs.find(it.first); - if (it_find == new_attrs.end()) { - // this is an old attr that is not defined in the new_attrs - // delete it - attrs.erase(it.first); - } + attrs = new_attrs; + auto it = attrs.end(); + if ((it = attrs.find(RGW_ATTR_ACL)) != attrs.end()) { + auto lval = it->second.cbegin(); + acls.decode(lval); } sfs::get_meta_buckets(get_store().db_conn)