[Bugs] [Bug 1201622] New: Convert quota size from n-to-h order before using it
bugzilla at redhat.com
bugzilla at redhat.com
Fri Mar 13 06:14:27 UTC 2015
https://bugzilla.redhat.com/show_bug.cgi?id=1201622
Bug ID: 1201622
Summary: Convert quota size from n-to-h order before using it
Product: GlusterFS
Version: 3.6.2
Component: replicate
Keywords: Triaged
Assignee: bugs at gluster.org
Reporter: kdhananj at redhat.com
CC: bugs at gluster.org, gluster-bugs at redhat.com
Depends On: 1200670
+++ This bug was initially created as a clone of Bug #1200670 +++
Description of problem:
Figured while reading code that AFR is NOT converting quota_size value from
network to host byte order before using it in comparisons towards getting the
max size. This can cause problems with max_size calculation when the client is
running on a little endian machine.
0 afr_handle_quota_size (call_frame_t *frame, xlator_t *this)
1 {
2 unsigned char *readable = NULL;
3 afr_local_t *local = NULL;
4 afr_private_t *priv = NULL;
5 struct afr_reply *replies = NULL;
6 int i = 0;
7 uint64_t size = 0;
8 uint64_t max_size = 0;
9 int readable_cnt = 0;
10 int read_subvol = -1;
11
12 local = frame->local;
13 priv = this->private;
14 replies = local->replies;
15
16 readable = alloca0 (priv->child_count);
17
18 afr_inode_read_subvol_get (local->inode, this, readable, 0, 0);
19
20 readable_cnt = AFR_COUNT (readable, priv->child_count);
21
22 for (i = 0; i < priv->child_count; i++) {
23 if (!replies[i].valid || replies[i].op_ret == -1)
24 continue;
25 if (readable_cnt && !readable[i])
26 continue;
27 if (!replies[i].xdata)
28 continue;
29 if (dict_get_uint64 (replies[i].xdata, QUOTA_SIZE_KEY,
&size)) <---------- here
30 continue;
32 if (read_subvol == -1)
33 read_subvol = i;
34 if (size > max_size) {
35 read_subvol = i;
36 max_size = size;
37 }
38 }
39
40 if (!max_size)
41 return read_subvol;
44
45 for (i = 0; i < priv->child_count; i++) {
46 if (!replies[i].valid || replies[i].op_ret == -1)
47 continue;
48 if (readable_cnt && !readable[i])
49 continue;
50 if (!replies[i].xdata)
51 continue;
52 if (dict_set_uint64 (replies[i].xdata, QUOTA_SIZE_KEY,
max_size)) <------ and here
53 continue;
54 }
55
56 return read_subvol;
57 }
Version-Release number of selected component (if applicable):
How reproducible:
Steps to Reproduce:
1.
2.
3.
Actual results:
Expected results:
Additional info:
--- Additional comment from Anand Avati on 2015-03-11 02:58:22 EDT ---
REVIEW: http://review.gluster.org/9853 (cluster/afr: Convert quota size from
n/w to host order before use) posted (#1) for review on master by Krutika
Dhananjay (kdhananj at redhat.com)
--- Additional comment from Anand Avati on 2015-03-12 07:44:55 EDT ---
REVIEW: http://review.gluster.org/9853 (cluster/afr: Convert quota size from
n/w to host order before use) posted (#2) for review on master by Krutika
Dhananjay (kdhananj at redhat.com)
--- Additional comment from Anand Avati on 2015-03-13 02:02:04 EDT ---
COMMIT: http://review.gluster.org/9853 committed in master by Pranith Kumar
Karampuri (pkarampu at redhat.com)
------
commit 65c68fb75640be2c5744782081250dda886a7b56
Author: Krutika Dhananjay <kdhananj at redhat.com>
Date: Tue Mar 10 22:11:57 2015 +0530
cluster/afr: Convert quota size from n/w to host order before use
Change-Id: I3e4fe15716556441546fcd62b8ac2833869b21cf
BUG: 1200670
Signed-off-by: Krutika Dhananjay <kdhananj at redhat.com>
Reviewed-on: http://review.gluster.org/9853
Reviewed-by: Ravishankar N <ravishankar at redhat.com>
Reviewed-by: Anuradha Talur <atalur at redhat.com>
Tested-by: Gluster Build System <jenkins at build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu at redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu at redhat.com>
Referenced Bugs:
https://bugzilla.redhat.com/show_bug.cgi?id=1200670
[Bug 1200670] Convert quota size from n-to-h order before using it
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
More information about the Bugs
mailing list