Bug 1238446 - glfs_stat returns bad device ID [NEEDINFO]
Summary: glfs_stat returns bad device ID
Alias: None
Product: GlusterFS
Classification: Community
Component: libgfapi
Version: mainline
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Venkata R Edara
QA Contact: Sudhir D
Depends On:
TreeView+ depends on / blocked
Reported: 2015-07-01 21:55 UTC by Craig Cabrey
Modified: 2018-11-20 09:38 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2018-11-20 09:38:58 UTC
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
ndevos: needinfo? (craigcabrey)

Attachments (Terms of Use)

Description Craig Cabrey 2015-07-01 21:55:11 UTC
Description of problem:
Calling glfs_stat on a file or directory will return a garbage device ID (stat.st_dev).

Version-Release number of selected component (if applicable):
GlusterFS 3.6.3, GFAPI_3.4.0

How reproducible:
Reproducible while building the coreutils for gluster.

Steps to Reproduce:

Actual results:
"Device: 2b630e2eh/727911982d" from running glfs_stat on the file in the volume.

Expected results:
"Device: 803h/2051d" from running stat directly on the file in the brick dir.

Additional info:

Comment 1 Kaleb KEITHLEY 2015-07-07 12:24:39 UTC
Soumya, maybe reassign this to Shyam, or someone else if appropriate?

Comment 2 Soumya Koduri 2015-07-07 12:46:13 UTC

Could you confirm if you see this issue with all types of files or for only particular types?

Comment 3 Craig Cabrey 2015-07-14 00:18:14 UTC
Sorry for the delayed response.

It appears to be an issue for:

* regular files
* symbolic links
* character special files
* block special files

Also, FWIW, it looks like the Inode number is also butchered (both via the gfapi and the FUSE mount), but I'm not sure is this is just a normal Gluster function.

Comment 4 Niels de Vos 2016-08-30 12:40:11 UTC
GlusterFS-3.6 is nearing its End-Of-Life, only important security bugs still make a chance on getting fixed. Moving this to the mainline 'version'. If this needs to get fixed in 3.7 or 3.8 this bug should get cloned.

Comment 5 Niels de Vos 2017-01-09 13:19:24 UTC
Device ID and inode are expected to be different from the values on the bricks. Ideally the device ID is the same for all files on the Gluster volume, and does not relate to the device ID on the brick. The inode needs to be different, because in a distributed volume the inode from a brick can exist multiple times in a Gluster volume. For replication the inode does not need to be the same on all the bricks.

What is you expectation of the device ID when you take the above in account? Have you seen the device ID change for different glfs_stat() calls on the same volume?

Comment 6 Venkata R Edara 2017-08-22 12:36:54 UTC
Tried with python bindings of gfapim, issue not reproducible, device id is same for all dirs and files also

>>> from gluster import gfapi 
>>> vol = gfapi.Volume('gluster2','test2')
>>> vol.mount()
>>> vol.umount()
>>> vol.mount()
>>> vol.listdir('/')
['venkat', 'venkat2']
>>> list_en = vol.listdir_with_stat('/')
>>> for i in list_en:
...    stat = i[1]
...    print(stat.st_dev)
>>> with vol.fopen("/venkat/f1", 'wb') as f:
...    f.write("hello world")
>>> with vol.fopen("/venkat/f2", 'wb') as f:
...    f.write("hello gluster")
>>> list_files = vol.listdir_with_stat('/venkat')
>>> for entry in list_files:
...    stat = entry[1]
...    print(stat.st_dev)

Comment 7 Jiffin 2018-11-20 09:38:58 UTC
As per c#6, the issue is not seen in latest gluster versions hence closing this bug as fixed in current release

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