From f69faee74dd5215849f3061338397b840b141aaf Mon Sep 17 00:00:00 2001 From: Varun Shastry Date: Fri, 2 Aug 2013 15:00:14 +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: I2e8c540d3f95572a702a9d324ec19528a4cb76ed Signed-off-by: Varun Shastry --- xlators/features/quota/src/quota.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'xlators/features/quota/src/quota.c') diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index c15eded4..4fe4f10a 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -319,6 +319,19 @@ quota_check_limit (call_frame_t *frame, inode_t *inode, xlator_t *this, GF_VALIDATE_OR_GOTO (this->name, frame, out); GF_VALIDATE_OR_GOTO (this->name, inode, out); + /* 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; + goto out; + } + local = frame->local; GF_VALIDATE_OR_GOTO (this->name, local, out); @@ -2807,8 +2820,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); STACK_WIND (frame, quota_setxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr, loc, dict, flags, xdata); @@ -2843,8 +2857,10 @@ 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); + /* Really trust all the trusted clients:- gluster internal processes */ + if (0 <= frame->root->pid) + GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict, + op_errno, err); STACK_WIND (frame, quota_fsetxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetxattr, fd, dict, flags, xdata); -- cgit