The non-ec overload will throw fs::filesystem_error on any error
(e.g. EPERM due to unprivileged "rbd persistent-cache invalidate"
being brought up against a privileged workload).
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit
63197ff7003fa9e595527a7431f9f3f6790f7d57)
if (m_cache_state->present &&
!m_cache_state->host.compare(ceph_get_short_hostname()) &&
fs::exists(m_cache_state->path)) {
- fs::remove(m_cache_state->path);
+ std::error_code ec;
+ fs::remove(m_cache_state->path, ec);
+ if (ec) {
+ lderr(cct) << "failed to remove persistent cache file: " << ec.message()
+ << dendl;
+ // not fatal
+ }
}
remove_image_cache_state();