Bug 1445609 - [perf-xlators/write-behind] write-behind-window-size could be set greater than its allowed MAX value 1073741824
Summary: [perf-xlators/write-behind] write-behind-window-size could be set greater tha...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: write-behind
Version: mainline
Hardware: x86_64
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Csaba Henk
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1297743
TreeView+ depends on / blocked
 
Reported: 2017-04-26 06:40 UTC by Csaba Henk
Modified: 2017-10-26 14:37 UTC (History)
12 users (show)

Fixed In Version: glusterfs-3.12.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1297743
Environment:
Last Closed: 2017-09-05 17:27:45 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Csaba Henk 2017-04-26 06:40:32 UTC
+++ This bug was initially created as a clone of Bug #1297743 +++

+++ This bug was initially created as a clone of Bug #993535 +++

Description of problem:
-----------------------
Write-behind has got the option, write-behind-window-size which, as per command link help, should allow values within range [524288 - 1073741824]
But in this case, it takes values greater than MAX value - 1073741824

Version-Release number of selected component (if applicable):
-------------------------------------------------------------
RHS2.1 - glusterfs-3.4.0.15rhs-1


How reproducible:
-----------------
Always

Steps to Reproduce:
-------------------

1. Set 'write-behind-window-size' to negative value
(i.e) gluster volume set <vol-name> performance.write-behind-window-size -1

This would show-up an error, with valid value range, which is [524288 - 1073741824]

2. After getting the max value from step 1, try to set 'write-behind-window-size' greater than that value 
(i.e) gluster volume set <vol-name> performance.write-behind-window-size 1073741825


Actual results:
The value greater than MAX value is allowed to be set

Expected results:
Any value greater than MAX value should be failed to set

Additional info:
1. Volume Information
----------------------
Its a distributed volume with 2 bricks

[Tue Aug  6 06:54:44 UTC 2013 root.37.205:~ ] # gluster volume info distvol
 
Volume Name: distvol
Type: Distribute
Volume ID: 562ebca3-a048-4c1d-87d4-d6ad36547092
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: 10.70.37.205:/rhs/brick4/distbrick1
Brick2: 10.70.37.52:/rhs/brick4/distbrick1
Options Reconfigured:
performance.write-behind-window-size: 107374182400
performance.read-ahead-page-count: 1
performance.cache-size: 4MB
server.allow-insecure: on
nfs.rpc-auth-allow: on
performance.md-cache-timeout: 60

[Tue Aug  6 06:56:04 UTC 2013 root.37.205:~ ] # gluster volume status distvol
Status of volume: distvol
Gluster process                                         Port    Online  Pid
------------------------------------------------------------------------------
Brick 10.70.37.205:/rhs/brick4/distbrick1               49155   Y       2854
Brick 10.70.37.52:/rhs/brick4/distbrick1                49155   Y       2841
NFS Server on localhost                                 2049    Y       15889
NFS Server on 10.70.37.52                               2049    Y       15396
NFS Server on 10.70.37.202                              2049    Y       15411
NFS Server on 10.70.37.154                              2049    Y       15417
 
There are no active volume tasks

2. Console logs
----------------
[Tue Aug  6 06:41:13 UTC 2013 root.37.205:~ ] # gluster volume set distvol performance.write-behind-window-size 0
volume set: failed: '0' in 'option cache-size 0' is out of range [524288 - 1073741824]                                                                                                                         
[Tue Aug  6 06:41:38 UTC 2013 root.37.205:~ ] # gluster volume set distvol performance.write-behind-window-size 524287
volume set: failed: '524287' in 'option cache-size 524287' is out of range [524288 - 1073741824]                                                                                                               
[Tue Aug  6 06:41:48 UTC 2013 root.37.205:~ ] # gluster volume set distvol performance.write-behind-window-size 524288
volume set: success                                                                                                                                                                                            
[Tue Aug  6 06:41:55 UTC 2013 root.37.205:~ ] # gluster volume set distvol performance.write-behind-window-size 1073741824
volume set: success                                                                                                                                                                                            
[Tue Aug  6 06:42:11 UTC 2013 root.37.205:~ ] # gluster volume set distvol performance.write-behind-window-size 1073741825
volume set: success                                                                                                                                                                                            
[Tue Aug  6 06:42:17 UTC 2013 root.37.205:~ ] # gluster volume set distvol performance.write-behind-window-size 107374182400                                                                             
volume set: success                                                                                                                                                                                            
[Tue Aug  6 06:42:32 UTC 2013 root.37.205:~ ] # glusterfs -V                                                                                                                                             
glusterfs 3.4.0.15rhs built on Aug  4 2013 22:34:15                                                                                                                                                            
Repository revision: git://git.gluster.com/glusterfs.git                                                                                                                                                       
Copyright (c) 2006-2013 Red Hat, Inc. <http://www.redhat.com/>
GlusterFS comes with ABSOLUTELY NO WARRANTY.
It is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3
or later), or the GNU General Public License, version 2 (GPLv2),
in all cases as published by the Free Software Foundation.

[Tue Aug  6 06:54:44 UTC 2013 root.37.205:~ ] # gluster volume info distvol
 
Volume Name: distvol
Type: Distribute
Volume ID: 562ebca3-a048-4c1d-87d4-d6ad36547092
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: 10.70.37.205:/rhs/brick4/distbrick1
Brick2: 10.70.37.52:/rhs/brick4/distbrick1
Options Reconfigured:
performance.write-behind-window-size: 107374182400
performance.read-ahead-page-count: 1
performance.cache-size: 4MB
server.allow-insecure: on
nfs.rpc-auth-allow: on
performance.md-cache-timeout: 60

--- Additional comment from RHEL Product and Program Management on 2013-08-06 03:14:59 EDT ---

Since this issue was entered in bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from Vivek Agarwal on 2015-12-03 12:18:39 EST ---

Thank you for submitting this issue for consideration in Red Hat Gluster Storage. The release for which you requested us to review, is now End of Life. Please See https://access.redhat.com/support/policy/updates/rhs/

If you can reproduce this bug against a currently maintained version of Red Hat Gluster Storage, please feel free to file a new report against the current release.

--- Additional comment from SATHEESARAN on 2016-01-12 06:08:10 EST ---

The issue is still reproducible with RHGS 3.1.2

[root@ ~]# gluster volume set distvol write-behind-window-size 1GB
volume set: success

[root@ ~]# gluster volume set distvol write-behind-window-size 2GB
volume set: success

[root@ ~]# gluster volume set distvol write-behind-window-size 32GB
volume set: success

[root@ ~]# gluster volume set distvol write-behind-window-size 1TB
volume set: success

[root@ ~]# gluster volume set distvol write-behind-window-size 1KB
volume set: failed: '1024' in 'option cache-size 1KB' is out of range [524288 - 1073741824]

--- Additional comment from Atin Mukherjee on 2016-01-12 06:14:38 EST ---

Although the changes are falling under GlusterD code, but the validation has to be taken care by the feature itself. Assigning it to Raghavendra G as he maintains performance translators.

Comment 1 Worker Ant 2017-04-26 14:49:35 UTC
REVIEW: https://review.gluster.org/17124 (libglusterfs: fix overriding of standard functions) posted (#1) for review on master by Csaba Henk (csaba)

Comment 2 Worker Ant 2017-04-26 14:49:41 UTC
REVIEW: https://review.gluster.org/17125 (libglusterfs: stop special casing "cache-size" in size_t validation) posted (#1) for review on master by Csaba Henk (csaba)

Comment 3 Worker Ant 2017-04-26 14:51:38 UTC
REVIEW: https://review.gluster.org/17124 (libglusterfs: fix overriding of stdlib floor()) posted (#2) for review on master by Csaba Henk (csaba)

Comment 4 Worker Ant 2017-04-26 14:51:45 UTC
REVIEW: https://review.gluster.org/17125 (libglusterfs: stop special casing "cache-size" in size_t validation) posted (#2) for review on master by Csaba Henk (csaba)

Comment 5 Worker Ant 2017-04-28 06:22:13 UTC
REVIEW: https://review.gluster.org/17125 (libglusterfs: stop special casing "cache-size" in size_t validation) posted (#3) for review on master by Csaba Henk (csaba)

Comment 6 Worker Ant 2017-05-02 06:32:29 UTC
REVIEW: https://review.gluster.org/17125 (libglusterfs: stop special casing "cache-size" in size_t validation) posted (#4) for review on master by Csaba Henk (csaba)

Comment 7 Worker Ant 2017-05-08 13:37:57 UTC
COMMIT: https://review.gluster.org/17125 committed in master by Jeff Darcy (jeff.us) 
------
commit 0d8923d6d70af702730a43a536a5d0b25b4061dc
Author: Csaba Henk <csaba>
Date:   Tue Apr 25 17:01:09 2017 +0200

    libglusterfs: stop special casing "cache-size" in size_t validation
    
    The original situation was as follows:
    
    The function that validates xlator options indicating a size,
    xlator_option_validate_sizet(), handles the case when the name
    of the option is "cache-size" in a special way.
    
    - Xlator options (things of type volume_option_t) has a
      min and max attribute of type double.
    - An xlator option is endowed with a gluster specific type (not
      C type). An instance of an xlator option goes through a validation
      process by a type specific validator function (which are collected
      in option.c).
    - Validators of numeric types - size being one of them - make use the
      min and max attributes to perform a range check, except in one case:
      if an option is defined with min = max = 0, then this option will be
      exempt of range checking. (Note: the volume_option_t definition
      features the following comments along the min, max fields:
    
       double                  min;  /* 0 means no range */
       double                  max;  /* 0 means no range */
    
      which is slightly misleading as it lets one to conclude that
      zeroing min or max buys exemption from low or high boundary check,
      which is not true -- only *both* being zero buys exemption.)
    - Besides this, the validator for options of size type,
      xlator_option_validate_sizet() special cases options
      named "cache-size" so that only min is enforced. (The only consequence
      of a value exceeding max is that glusterd logs a warning about it, but
      the cli user who makes such a setting gets no feedback on it.)
    - This was introduced because a hard coded limit is not useful for
      io-cache and quick-read. They rather use a runtime calculated
      upper limit. (See changes
      I7dd4d8c53051b89a293696abf1ee8dc237e39a20
      I9c744b5ace10604d5a814e6218ca0d83c796db80
      about the last two points.)
    - As an unintended consequence, the upper limit check of
      cache-size of write-behind, for which a conventional hard coded limit
      is specified, is defeated.
    
    What we do about it:
    
    - Remove the special casing clause for cache-size in
      xlator_option_validate_sizet. Thus the general range
      check policy (as described above) will apply to
      cache-size too.
    - To implement a lower bound only check by the validator
      for cache-size of io-cache and quick-read, change the
      max attribute of these options to INFINITY.
    
    The only behavioral difference is the omission of the warnings
    about cache-size of io-cache and quick-read exceeding the former max
    values. (They were rather heuristic anyway.)
    
    BUG: 1445609
    Change-Id: I0bd8bd391fa7d926f76e214a2178833fe4673b4a
    Signed-off-by: Csaba Henk <csaba>
    Reviewed-on: https://review.gluster.org/17125
    Smoke: Gluster Build System <jenkins.org>
    Reviewed-by: Amar Tumballi <amarts>
    Tested-by: Raghavendra G <rgowdapp>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>

Comment 8 Shyamsundar 2017-09-05 17:27:45 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.12.0, please open a new bug report.

glusterfs-3.12.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://lists.gluster.org/pipermail/announce/2017-September/000082.html
[2] https://www.gluster.org/pipermail/gluster-users/


Note You need to log in before you can comment on or make changes to this bug.