Bug 1534453 - Reading over than the file size on dispersed volume
Summary: Reading over than the file size on dispersed volume
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: GlusterFS
Classification: Community
Component: disperse
Version: mainline
Hardware: x86_64
OS: Linux
high
urgent
Target Milestone: ---
Assignee: Ashish Pandey
QA Contact:
URL:
Whiteboard:
: 1534452 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-15 09:55 UTC by jenny
Modified: 2020-03-12 13:00 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-12 13:00:03 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)
Script to create two volume and mount and create files (823 bytes, application/x-shellscript)
2019-07-17 08:47 UTC, Ashish Pandey
no flags Details
Program to read files from two mount points using api (1.30 KB, text/x-csrc)
2019-07-17 08:48 UTC, Ashish Pandey
no flags Details

Description jenny 2018-01-15 09:55:50 UTC
Description of problem:
Reading over than the file size on dispersed volume

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

How reproducible:

------------------------------------------------------
Volume Name: TEST_VOL
Type: Disperse
Volume ID: be52b68d-ae83-46e3-9527-0e536b867bcc
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x (6 + 3) = 9
Transport-type: tcp
Bricks:
Brick1: server1:/data/brick1
Brick2: server2:/data/brick1
Brick3: server3:/data/brick1
Brick4: server1:/data/brick2
Brick5: server2:/data/brick2
Brick6: server3:/data/brick2
Brick7: server1:/data/brick3
Brick8: server2:/data/brick3
Brick9: server3:/data/brick3
Options Reconfigured:
network.ping-timeout: 10
performance.write-behind: on
features.quota-deem-statfs: on
features.inode-quota: on
features.quota: on
transport.address-family: inet
nfs.disable: on
------------------------------------------------------

Steps to Reproduce:
1. generating the temporary files like below command.
fallocate -l 130394  test1 
fallocate -l 667417658  test2
fallocate -l 2493251482 test3 

2. reading the files to EOF like below sources
--------------------------------------------------------------
 glfs_fd_t* fd = glfs_open (gluster_fs, "/test1", O_RDWR);

    size_t retr = 0;
    off_t offset = 0;
    unsigned char buf[128*1024] = {0,};

    while ((retr = glfs_pread(fd, buf, sizeof(buf), offset, 0)) > 0) {
        printf("retr : %ld, offset : %ld(%d) \n", retr, offset, errno);
        offset += retr;
    }

    printf("offset : %d\n", offset);
-----------------------------------------------------------------------------------------------------------------

Actual results:
print debug 

retr : 130394, offset : 42(0)
retr : 1024, offset : 130436(0)
retr : 636, offset : 131460(0)
offset : 132096(0)

Expected results:
The reading size (total offset) has to be the same with original file size
offset : 130394

Additional info:

Why the glfs_pread(or glfs_read) function reads until over than the file size ?

This is fine on dispersed (4+2) and (8+1) volume but it is occurred on (6+3) or (6+4) or (7+2) disperse volume.
I want to know exact cause.
Thank you.

Comment 1 jenny 2018-01-15 10:14:50 UTC
sorry output is like this.

retr : 130394, offset : 0(0)
retr : 1024, offset : 130394(0)
retr : 678, offset : 131418(0)
retr : 0

Comment 2 Shyamsundar 2018-10-23 14:55:17 UTC
Release 3.12 has been EOLd and this bug was still found to be in the NEW state, hence moving the version to mainline, to triage the same and take appropriate actions.

Comment 3 Vijay Bellur 2018-11-20 05:09:15 UTC
*** Bug 1534452 has been marked as a duplicate of this bug. ***

Comment 5 Amar Tumballi 2019-06-17 10:58:15 UTC
Hi Jenny, thanks for the reports. We have not seen this in latest glusterfs codebase (glusterfs-6.x). Will update you with testing it on glusterfs-7.0 base. Also considering this should be easy to automate with our regression tests, we would consider automating the same. Would be great if you can help by contributing this test to code (https://github.com/gluster/glusterfs/tree/master/tests)

Comment 6 Ashish Pandey 2019-07-17 08:46:24 UTC
I could reproduce this case easily on latest master.
I am uploading two files with this BZ which will help to reproduce this case.

1 - ec-fallocate-read.t - It will create two volume of 6+3 (patchy) and 4+2 (patchy1). Will mount these volumes and create a file on each using fallocate. 
2 - ec-fallocate-read.c - This will read the files uding gfapi's and we can see the issue. 

After compiling it we need to provide host name of the volume and volume name.

gcc  ec-fallocate-read.c  -lgfapi -Wall -O2

./a.out <hostname> patchy
./a.out <hostname> patchy1


I am seeing the following result - 

[root@apandey Bugz]# ./a.out apandey patchy1 
retr : 130394, offset : 0(0) 
offset : 130394


----
[root@apandey Bugz]# stat /mnt/glusterfs/1/test1
  File: /mnt/glusterfs/1/test1
  Size: 130394    	Blocks: 256        IO Block: 131072 regular file
Device: 3ah/58d	Inode: 11138790474948514051  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-07-17 14:01:52.152482945 +0530
Modify: 2019-07-17 14:01:52.152482945 +0530
Change: 2019-07-17 13:59:33.253903983 +0530
 Birth: -



[root@apandey Bugz]# ./a.out apandey patchy
retr : 130394, offset : 0(0) 
retr : 1024, offset : 130394(0) 
retr : 678, offset : 131418(0) 
offset : 132096
[root@apandey Bugz]# 
------
[root@apandey Bugz]# stat /mnt/glusterfs/0/test1
  File: /mnt/glusterfs/0/test1
  Size: 130394    	Blocks: 258        IO Block: 131072 regular file
Device: 39h/57d	Inode: 9549418052567184184  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2019-07-17 14:01:52.114542579 +0530
Modify: 2019-07-17 14:01:52.114542579 +0530
Change: 2019-07-17 14:01:52.113054347 +0530
 Birth: -

Comment 7 Ashish Pandey 2019-07-17 08:47:22 UTC
Created attachment 1591344 [details]
Script to create two volume and mount and create files

Script to create two volume and mount and create files

Comment 8 Ashish Pandey 2019-07-17 08:48:06 UTC
Created attachment 1591345 [details]
Program to read files from two mount points using api

Program to read files from two mount points using api

Comment 9 Worker Ant 2020-03-12 13:00:03 UTC
This bug is moved to https://github.com/gluster/glusterfs/issues/981, and will be tracked there from now on. Visit GitHub issues URL for further details


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