Bug 1793990 - lseek SEEK_DATA - File descriptor in bad state
Summary: lseek SEEK_DATA - File descriptor in bad state
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: GlusterFS
Classification: Community
Component: open-behind
Version: 6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pranith Kumar K
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-22 13:08 UTC by Tomáš Mózes
Modified: 2020-03-12 12:29 UTC (History)
4 users (show)

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


Attachments (Terms of Use)

Description Tomáš Mózes 2020-01-22 13:08:48 UTC
Description of problem:


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


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Tomáš Mózes 2020-01-22 13:09:39 UTC
In Gentoo Linux we use portage to install software. That software is usually built from source so it's a good candidate for a shared storage if used by hundreds of systems to avoid re-downloading on multiple systems. While installing some packages in Gentoo (having the source repository on Glusterfs) we discovered that lseek SEEK_DATA isn't working properly on Glusterfs.

A working example on ext4:
# dd if=/dev/zero of=/tmp/sparse bs=1M count=0 seek=1
# echo hi >> /tmp/sparse
# python3 ./lseek-seek-data.py /tmp/sparse
1048576

A failure on glusterfs volume (/usr/portage/distfiles):
# dd if=/dev/zero of=/usr/portage/distfiles/sparse bs=1M count=0 seek=1
# echo hi >> /usr/portage/distfiles/sparse
# python3 ./lseek-seek-data.py /usr/portage/distfiles/sparse
Traceback (most recent call last):
  File "./lseek-seek-data.py", line 19, in <module>
    main()
  File "./lseek-seek-data.py", line 15, in main
    print(os.lseek(input_file.fileno(), offset, os.SEEK_DATA))
OSError: [Errno 77] File descriptor in bad state

lseek-seek-data.py:
#!/usr/bin/env python3

import argparse
import os


def main():
	parser = argparse.ArgumentParser()
	parser.add_argument('input_file')
	args = parser.parse_args()

	offset = 0

	with open(args.input_file, 'rb', 0) as input_file:
		print(os.lseek(input_file.fileno(), offset, os.SEEK_DATA))


if __name__ == '__main__':
	main()

Discussion in Gentoo:
https://bugs.gentoo.org/705536
https://github.com/gentoo/portage/pull/498

The glusterfs volume is simple running default settings on version 6.7.

Comment 2 Ravishankar N 2020-01-27 05:27:46 UTC
Looks like https://review.gluster.org/#/c/23530/ needs to be backported to the release-{6/7} branches. Assigning the bug to Pranith.

@Tomas, for now, a workaround is to disable the open-behind translator: `gluster v set volname open-behind off`. Things will then work as expected.

Comment 3 Tomáš Mózes 2020-01-27 06:59:02 UTC
Thanks @Ravishankar, the patch https://github.com/gluster/glusterfs/commit/9dd57ff963d4d0dde7f3ad0ff230837ff2f4b1df works fine with 6.7/7.2.

Comment 4 Worker Ant 2020-03-12 12:29:23 UTC
This bug is moved to https://github.com/gluster/glusterfs/issues/894, 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.