an ENOTEMPTY error mybe happen when removing a pg in previous versions,but the 
error is hidden in new versions。

_destroy_collection maybe return 0 when get_index or prep_delete return < 0;

is this intended?

int FileStore::_destroy_collection(coll_t c) 
{
  int r = 0;                             //global r
  char fn[PATH_MAX];
  get_cdir(c, fn, sizeof(fn));
  dout(15) << "_destroy_collection " << fn << dendl;
  {
    Index from;
    int r = get_index(c, &from);            //local r
    if (r < 0)
      goto out;
    assert(NULL != from.index);
    RWLock::WLocker l((from.index)->access_lock);

    r = from->prep_delete();
    if (r < 0)
      goto out;
  }
  r = ::rmdir(fn);
  if (r < 0) {
    r = -errno;
    goto out;
  }

 out:
  // destroy parallel temp collection, too
  ...

 out_final:
  dout(10) << "_destroy_collection " << fn << " = " << r << dendl;
  return r;
}

Reply via email to