From 778e18028315c41a8c238aa9a9e8d6a77ea0f386 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Thu, 8 Aug 2013 12:32:11 +0530 Subject: features/quota: Allow the gluster 'special' processes to supercede the limits Don't block the gluster internal processes like rebalance, gsyncd, self heal etc from the disk quotas and the xattrs setting. Solution: Allow all the clients with negative PID. Change-Id: Iaeaa8096e00d48b2a4c3f5df61d103da0b3d6598 --- xlators/features/quota/src/quota.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'xlators') diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index c7cd7667..b0e9d0c4 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -393,6 +393,18 @@ quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this, delta = local->delta; GF_VALIDATE_OR_GOTO (this->name, local->stub, err); + /* Allow all the trusted clients + * Don't block the gluster internal processes like rebalance, gsyncd, + * self heal etc from the disk quotas. + * + * Method: Allow all the clients with PID negative. This is by the + * assumption that any kernel assigned pid doesn't have the negative + * number. + */ + if (0 > frame->root->pid) { + ret = 0; + return ret; + } priv = this->private; @@ -2838,8 +2850,9 @@ quota_setxattr (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (loc, err); - GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict, - op_errno, err); + if (0 <= frame->root->pid) + GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict, + op_errno, err); ret = dict_get_bin (dict, QUOTA_UPDATE_USAGE_KEY, (void **) &size); if (0 == ret) { @@ -2901,8 +2914,9 @@ quota_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (fd, err); - GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict, - op_errno, err); + if (0 <= frame->root->pid) + GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict, + op_errno, err); wind: STACK_WIND (frame, priv->is_quota_on? -- cgit