[Bugs] [Bug 1640392] New: io-stats: garbage characters in the filenames generated

bugzilla at redhat.com bugzilla at redhat.com
Thu Oct 18 00:31:38 UTC 2018


https://bugzilla.redhat.com/show_bug.cgi?id=1640392

            Bug ID: 1640392
           Summary: io-stats: garbage characters in the filenames
                    generated
           Product: GlusterFS
           Version: 5
         Component: io-stats
          Assignee: bugs at gluster.org
          Reporter: srangana at redhat.com
                CC: bugs at gluster.org, nbalacha at redhat.com
        Depends On: 1640165



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

Description of problem:


For a 2x2 volume with all bricks on a single node and the client mounted on the
same node , 

setfattr -n trusted.io-stats-dump -v /tmp/io-stats-pre.txt /mnt/gluster

generates:


-rw-rw-rw-. 1 root root   12839 Oct 17 15:40
-tmp-io-stats-pre.txt????et-req.vol
-rw-rw-rw-. 1 root root   12979 Oct 17 15:40
-tmp-io-stats-pre.txt????fid.vol2-i
-rw-rw-rw-. 1 root root   12979 Oct 17 15:40
-tmp-io-stats-pre.txt????o.vol2-io-




Version-Release number of selected component (if applicable):


How reproducible:
Consistently

Steps to Reproduce:
1. Create a 2x2 volume with all bricks on a single node
2. Fuse mount the volume on the same server node
3. setfattr -n trusted.io-stats-dump -v /tmp/io-stats-pre.txt /mnt/gluster

Actual results:


Expected results:

Additional info:

--- Additional comment from Worker Ant on 2018-10-17 09:26:34 EDT ---

REVIEW: https://review.gluster.org/21442 (debug/io-stats: io stats filenames
contain garbage) posted (#1) for review on master by N Balachandran

--- Additional comment from Nithya Balachandran on 2018-10-17 09:46:22 EDT ---

RCA:

dict_unserialize does not null terminate values. conditional_dump () uses
snprintf to create the filename causing a lot of garbage characters to be
included in the buffer.

Fix: Use memcpy.

--- Additional comment from Worker Ant on 2018-10-17 19:43:33 EDT ---

COMMIT: https://review.gluster.org/21442 committed in master by "Shyamsundar
Ranganathan" <srangana at redhat.com> with a commit message- debug/io-stats: io
stats filenames contain garbage

As dict_unserialize does not null terminate the value,
using snprintf adds garbage characters to the buffer
used to create the filename.
The code also used this->name in the filename which
will be the same for all bricks for a volume. The
files were thus overwritten if a node contained
multiple bricks for a volume. The code now uses
the conf->unique instead if available.

Change-Id: I2c72534b32634b87961d3b3f7d53c5f2ca2c068c
fixes: bz#1640165
Signed-off-by: N Balachandran <nbalacha at redhat.com>


Referenced Bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1640165
[Bug 1640165] io-stats: garbage characters in the filenames generated
-- 
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