mirror of
https://github.com/ceph/ceph
synced 2025-04-01 00:26:47 +00:00
mon: remove empty monstore dirs
This is sloppy, but it works well enough since we mkdir dirs as needed too. Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
aea7563f03
commit
e545af2db5
@ -226,14 +226,18 @@ bool MonitorStore::exists_bl_ss(const char *a, const char *b)
|
||||
int MonitorStore::erase_ss(const char *a, const char *b)
|
||||
{
|
||||
char fn[1024];
|
||||
char dr[1024];
|
||||
snprintf(dr, sizeof(dr), "%s/%s", dir.c_str(), a);
|
||||
if (b) {
|
||||
dout(15) << "erase_ss " << a << "/" << b << dendl;
|
||||
snprintf(fn, sizeof(fn), "%s/%s/%s", dir.c_str(), a, b);
|
||||
} else {
|
||||
dout(15) << "erase_ss " << a << dendl;
|
||||
snprintf(fn, sizeof(fn), "%s/%s", dir.c_str(), a);
|
||||
strcpy(fn, dr);
|
||||
}
|
||||
return ::unlink(fn);
|
||||
int r = ::unlink(fn);
|
||||
::rmdir(dr); // sloppy attempt to clean up empty dirs
|
||||
return r;
|
||||
}
|
||||
|
||||
int MonitorStore::get_bl_ss(bufferlist& bl, const char *a, const char *b)
|
||||
|
Loading…
Reference in New Issue
Block a user