In class IDiskRemote, all metadata file system operations use os file system api directly.
There is little extendiability if we want store the metadata of HDFS or S3 into distributed file system.
So I suggest change this way by using DiskPtr and will propose a pull request.

In addition, metadata of HDFS or S3 only store local FS which is not sharable.

{
    try
    {
        throwIfError(response);
    }
    catch (...)
    {
        tryLogCurrentException(__PRETTY_FUNCTION__, msg());
    }
}
DiskS3::DiskS3(
    String name_,
    String bucket_,
    String s3_root_path_,
    String metadata_path_,
    ContextPtr context_,
    SettingsPtr settings_,
    GetDiskSettings settings_getter_)
    : IDiskRemote(name_, s3_root_path_, metadata_path_, "DiskS3", settings_->thread_pool_size)
    , bucket(std::move(bucket_))
    , current_settings(std::move(settings_))
    , settings_getter(settings_getter_)
    , context(context_)
{
}
RemoteFSPathKeeperPtr DiskS3::createFSPathKeeper() const