From 3d3176958b7da48dbacb1a5a0fedf26322a38297 Mon Sep 17 00:00:00 2001 From: vmallika Date: Thu, 15 Oct 2015 12:41:13 +0530 Subject: quota: add version to quota xattrs This is a backport of http://review.gluster.org/#/c/12386/ When a quota is disable and the clean-up process terminated without completely cleaning-up the quota xattrs. Now when quota is enabled again, this can mess-up the accounting A version number is suffixed for all quota xattrs and this version number is specific to marker xaltor, i.e when quota xattrs are requested by quotad/client marker will remove the version suffix in the key before sending the response > Change-Id: I1ca2c11460645edba0f6b68db70d476d8d26e1eb > BUG: 1272411 > Signed-off-by: vmallika > Reviewed-on: http://review.gluster.org/12386 > Tested-by: NetBSD Build System > Reviewed-by: Krishnan Parthasarathi > Tested-by: Gluster Build System > Reviewed-by: Manikandan Selvaganesh > Reviewed-by: Raghavendra G Change-Id: I67b1b930b28411d76b2d476a4e5250c52aa495a0 BUG: 1277080 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/12487 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- cli/src/cli-rpc-ops.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index d2372ef1483..0452f8ccb6b 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -3079,9 +3079,9 @@ print_quota_list_from_mountdir (cli_local_t *local, char *mountdir, GF_ASSERT (path); if (type == GF_QUOTA_OPTION_TYPE_LIST) - key = "trusted.glusterfs.quota.limit-set"; + key = QUOTA_LIMIT_KEY; else - key = "trusted.glusterfs.quota.limit-objects"; + key = QUOTA_LIMIT_OBJECTS_KEY; ret = sys_lgetxattr (mountdir, key, (void *)&limits, sizeof (limits)); @@ -3109,8 +3109,7 @@ print_quota_list_from_mountdir (cli_local_t *local, char *mountdir, limits.hl = ntoh64 (limits.hl); limits.sl = ntoh64 (limits.sl); - xattr_size = sys_lgetxattr (mountdir, "trusted.glusterfs.quota.size", - NULL, 0); + xattr_size = sys_lgetxattr (mountdir, QUOTA_SIZE_KEY, NULL, 0); if (xattr_size < (sizeof (int64_t) * 2) && type == GF_QUOTA_OPTION_TYPE_LIST_OBJECTS) { ret = -1; @@ -3119,13 +3118,13 @@ print_quota_list_from_mountdir (cli_local_t *local, char *mountdir, * and the xattr healing is not completed. */ } else if (xattr_size > (sizeof (int64_t) * 2)) { - ret = sys_lgetxattr (mountdir, "trusted.glusterfs.quota.size", + ret = sys_lgetxattr (mountdir, QUOTA_SIZE_KEY, &used_space, sizeof (used_space)); } else if (xattr_size > 0) { /* This is for compatibility. * Older version had only file usage */ - ret = sys_lgetxattr (mountdir, "trusted.glusterfs.quota.size", + ret = sys_lgetxattr (mountdir, QUOTA_SIZE_KEY, &(used_space.size), sizeof (used_space.size)); used_space.file_count = 0; used_space.dir_count = 0; -- cgit