diff options
Diffstat (limited to 'xlators/features/quota/src')
-rw-r--r-- | xlators/features/quota/src/quota-messages.h | 4 | ||||
-rw-r--r-- | xlators/features/quota/src/quota.c | 31 |
2 files changed, 32 insertions, 3 deletions
diff --git a/xlators/features/quota/src/quota-messages.h b/xlators/features/quota/src/quota-messages.h index 4292c5b4dcc..85f5abf7b29 100644 --- a/xlators/features/quota/src/quota-messages.h +++ b/xlators/features/quota/src/quota-messages.h @@ -46,7 +46,9 @@ GLFS_MSGID(QUOTA, Q_MSG_INODE_CTX_GET_FAILED, Q_MSG_INODE_CTX_SET_FAILED, Q_MSG_LOOKUP_FAILED, - Q_MSG_RPC_SUBMIT_FAILED + Q_MSG_RPC_SUBMIT_FAILED, + Q_MSG_ENFORCEMENT_SKIPPED, + Q_MSG_INTERNAL_FOP_KEY_MISSING ); #endif /* !_QUOTA_MESSAGES_H_ */ diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 068d2e8c1f1..6ef2e20cf61 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -1591,6 +1591,28 @@ out: return ret; } +/* + * return _gf_true if enforcement is needed and _gf_false otherwise + */ +gf_boolean_t +should_quota_enforce (xlator_t *this, dict_t *dict, glusterfs_fop_t fop) +{ + int ret = 0; + + ret = dict_check_flag(dict, GF_INTERNAL_CTX_KEY, GF_DHT_HEAL_DIR); + + if (fop == GF_FOP_MKDIR && ret == DICT_FLAG_SET) { + return _gf_false; + } else if (ret == -ENOENT) { + gf_msg (this->name, GF_LOG_DEBUG, EINVAL, + Q_MSG_INTERNAL_FOP_KEY_MISSING, + "No internal fop context present"); + goto out; + } +out: + return _gf_true; +} + int32_t quota_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, inode_t *inode, @@ -1965,7 +1987,6 @@ unwind: return 0; } - int32_t quota_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata) @@ -1976,9 +1997,15 @@ quota_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, call_stub_t *stub = NULL; priv = this->private; - WIND_IF_QUOTAOFF (priv->is_quota_on, off); + if (!should_quota_enforce(this, xdata, GF_FOP_MKDIR)) { + gf_msg (this->name, GF_LOG_DEBUG, 0, + Q_MSG_ENFORCEMENT_SKIPPED, + "Enforcement has been skipped(internal fop)."); + goto off; + } + local = quota_local_new (); if (local == NULL) { op_errno = ENOMEM; |