diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 525062cdb12a9..538b05f7842e7 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -298,6 +298,18 @@ namespace rgw { goto out; } + /* forbid renaming of directories (unreasonable at scale) */ + if (rgw_fh->is_dir()) { + ldout(get_context(), 12) << __func__ + << " rejecting attempt to rename directory path=" + << rgw_fh->full_object_name() + << dendl; + rgw_fh->mtx.unlock(); /* !LOCKED */ + unref(rgw_fh); /* -ref */ + rc = -EPERM; + goto out; + } + for (int ix : {0, 1}) { switch (ix) { case 0: