Bug 1306264
Summary: | glfs_lseek returns incorrect offset for SEEK_SET and SEEK_CUR flags | ||||||
---|---|---|---|---|---|---|---|
Product: | [Community] GlusterFS | Reporter: | Anoop C S <anoopcs> | ||||
Component: | libgfapi | Assignee: | Anoop C S <anoopcs> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Sudhir D <sdharane> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | high | ||||||
Version: | mainline | CC: | bugs, ndevos | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Fixed In Version: | glusterfs-3.8rc2 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2016-06-16 13:57:29 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
REVIEW: http://review.gluster.org/13423 (api: glfs_lseek must return repositioned offset for SEEK_SET, SEEK_CUR flags) posted (#1) for review on master by Anoop C S (anoopcs) COMMIT: http://review.gluster.org/13423 committed in master by Niels de Vos (ndevos) ------ commit 095e2c48271a5248c8711a4e6a34bcb4d44c440e Author: Anoop C S <anoopcs> Date: Wed Feb 10 17:08:26 2016 +0530 api: glfs_lseek must return repositioned offset for SEEK_SET, SEEK_CUR flags On success, glfs_lseek() API is responsible for providing the repositioned offset as its return value. But for SEEK_SET and SEEK_CUR flags, glfs_lseek() returns -1 on successfully repositioning the fd offset. Current change is to set ret to 0 after glfd->offset is modified correctly so as to return the correct offset. Change-Id: I94d582779a98074cf633289f4b60b3c6a04e4f18 BUG: 1306264 Signed-off-by: Anoop C S <anoopcs> Reviewed-on: http://review.gluster.org/13423 Smoke: Gluster Build System <jenkins.com> NetBSD-regression: NetBSD Build System <jenkins.org> CentOS-regression: Gluster Build System <jenkins.com> Reviewed-by: jiffin tony Thottan <jthottan> Reviewed-by: Niels de Vos <ndevos> 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.8.0, please open a new bug report. glusterfs-3.8.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://blog.gluster.org/2016/06/glusterfs-3-8-released/ [2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user |
Created attachment 1122783 [details] Test program Description of problem: When glfs_lseek() API is used with SEEK_SET and SEEK_CUR to reposition the open file associated with a fd to the specified offset, even though the operation is success it is not returning the resulting offset location and instead -1 is returned. Version-Release number of selected component (if applicable): mainline How reproducible: always Steps to Reproduce: 1. Compile and build glusterfs under /usr/local/. 2. Create and start a simple distribute volume. 3. Download the attached test program and compile it. # gcc gfapi-test-lseek.c -lgfapi -I /usr/local/include/glusterfs/ -L /usr/local/lib/ 4. Export LD_LIBRARY_PATH # export LD_LIBRARY_PATH=/usr/local/lib 5. Run a.out # ./a.out <volume-name> <server ip/hostname> Actual results: Program produced the following error message: glfs_lseek with SEEK_SET returned -1, but expected 5 glfs_lseek with SEEK_CUR returned -1, but expected 10 Expected results: Program should run successfully with out displaying any error message.