Merge pull request #17808 from xiexingguo/wip-eqduot-vs-enospc

osd/PrimaryLogPG: prepare_transaction - fix EDQUOT vs ENOSPC

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-09-22 16:09:09 -05:00 committed by GitHub
commit f0ea6b2d4a
5 changed files with 16 additions and 16 deletions

View File

@ -346,7 +346,7 @@ test_rmobj() {
$CEPH_TOOL osd pool set-quota $p max_objects 1
V1=`mktemp fooattrXXXXXXX`
$RADOS_TOOL put $OBJ $V1 -p $p
while ! $CEPH_TOOL osd dump | grep 'full_no_quota max_objects'
while ! $CEPH_TOOL osd dump | grep 'full_quota max_objects'
do
sleep 2
done

View File

@ -975,7 +975,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
}
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL) &&
full_pool_ids.empty()) {
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_NO_QUOTA)) {
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_QUOTA)) {
// set by EQUOTA, skipping
continue;
}
@ -1010,7 +1010,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
continue;
}
if (!tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL) ||
tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_NO_QUOTA)) {
tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_QUOTA)) {
// don't touch if currently is not full
// or is running out of quota (and hence considered as full)
continue;
@ -1029,7 +1029,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
// skip pools we have already considered as full above
continue;
}
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_NO_QUOTA)) {
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_QUOTA)) {
// make sure FLAG_FULL is truly set, so we are safe not
// to set a extra (redundant) FLAG_BACKFILLFULL flag
assert(tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL));
@ -1072,7 +1072,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
if (full_pool_ids.count(p) || backfillfull_pool_ids.count(p)) {
continue;
}
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_NO_QUOTA)) {
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL_QUOTA)) {
// make sure FLAG_FULL is truly set, so we are safe not
// to set a extra (redundant) FLAG_NEARFULL flag
assert(tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL));
@ -4893,7 +4893,7 @@ bool OSDMonitor::update_pools_status()
(pool.quota_max_bytes > 0 && (uint64_t)sum.num_bytes >= pool.quota_max_bytes) ||
(pool.quota_max_objects > 0 && (uint64_t)sum.num_objects >= pool.quota_max_objects);
if (pool.has_flag(pg_pool_t::FLAG_FULL_NO_QUOTA)) {
if (pool.has_flag(pg_pool_t::FLAG_FULL_QUOTA)) {
if (pool_is_full)
continue;
@ -4902,7 +4902,7 @@ bool OSDMonitor::update_pools_status()
// below we cancel FLAG_FULL too, we'll set it again in
// OSDMonitor::encode_pending if it still fails the osd-full checking.
clear_pool_flags(it->first,
pg_pool_t::FLAG_FULL_NO_QUOTA | pg_pool_t::FLAG_FULL);
pg_pool_t::FLAG_FULL_QUOTA | pg_pool_t::FLAG_FULL);
ret = true;
} else {
if (!pool_is_full)
@ -4920,11 +4920,11 @@ bool OSDMonitor::update_pools_status()
<< " (reached quota's max_objects: "
<< pool.quota_max_objects << ")";
}
// set both FLAG_FULL_NO_QUOTA and FLAG_FULL
// set both FLAG_FULL_QUOTA and FLAG_FULL
// note that below we try to cancel FLAG_BACKFILLFULL/NEARFULL too
// since FLAG_FULL should always take precedence
set_pool_flags(it->first,
pg_pool_t::FLAG_FULL_NO_QUOTA | pg_pool_t::FLAG_FULL);
pg_pool_t::FLAG_FULL_QUOTA | pg_pool_t::FLAG_FULL);
clear_pool_flags(it->first,
pg_pool_t::FLAG_NEARFULL |
pg_pool_t::FLAG_BACKFILLFULL);

View File

@ -4684,10 +4684,10 @@ void OSDMap::check_health(health_check_map_t *checks) const
const string& pool_name = get_pool_name(it.first);
if (pool.has_flag(pg_pool_t::FLAG_FULL)) {
stringstream ss;
if (pool.has_flag(pg_pool_t::FLAG_FULL_NO_QUOTA)) {
if (pool.has_flag(pg_pool_t::FLAG_FULL_QUOTA)) {
// may run out of space too,
// but we want EQUOTA taking precedence
ss << "pool '" << pool_name << "' is full (no quota)";
ss << "pool '" << pool_name << "' is full (running out of quota)";
} else {
ss << "pool '" << pool_name << "' is full (no space)";
}

View File

@ -7281,7 +7281,7 @@ int PrimaryLogPG::prepare_transaction(OpContext *ctx)
} else if (m->has_flag(CEPH_OSD_FLAG_FULL_TRY)) {
// they tried, they failed.
dout(20) << __func__ << " full, replying to FULL_TRY op" << dendl;
return pool.info.has_flag(pg_pool_t::FLAG_FULL) ? -EDQUOT : -ENOSPC;
return pool.info.has_flag(pg_pool_t::FLAG_FULL_QUOTA) ? -EDQUOT : -ENOSPC;
} else {
// drop request
dout(20) << __func__ << " full, dropping request (bad client)" << dendl;

View File

@ -1154,7 +1154,7 @@ struct pg_pool_t {
FLAG_WRITE_FADVISE_DONTNEED = 1<<7, // write mode with LIBRADOS_OP_FLAG_FADVISE_DONTNEED
FLAG_NOSCRUB = 1<<8, // block periodic scrub
FLAG_NODEEP_SCRUB = 1<<9, // block periodic deep-scrub
FLAG_FULL_NO_QUOTA = 1<<10, // pool is currently running out of quota, will set FLAG_FULL too
FLAG_FULL_QUOTA = 1<<10, // pool is currently running out of quota, will set FLAG_FULL too
FLAG_NEARFULL = 1<<11, // pool is nearfull
FLAG_BACKFILLFULL = 1<<12, // pool is backfillfull
};
@ -1171,7 +1171,7 @@ struct pg_pool_t {
case FLAG_WRITE_FADVISE_DONTNEED: return "write_fadvise_dontneed";
case FLAG_NOSCRUB: return "noscrub";
case FLAG_NODEEP_SCRUB: return "nodeep-scrub";
case FLAG_FULL_NO_QUOTA: return "full_no_quota";
case FLAG_FULL_QUOTA: return "full_quota";
case FLAG_NEARFULL: return "nearfull";
case FLAG_BACKFILLFULL: return "backfillfull";
default: return "???";
@ -1212,8 +1212,8 @@ struct pg_pool_t {
return FLAG_NOSCRUB;
if (name == "nodeep-scrub")
return FLAG_NODEEP_SCRUB;
if (name == "full_no_quota")
return FLAG_FULL_NO_QUOTA;
if (name == "full_quota")
return FLAG_FULL_QUOTA;
if (name == "nearfull")
return FLAG_NEARFULL;
if (name == "backfillfull")