Bug 1315558

Summary: SEEK_HOLE and SEEK_DATA should return EINVAL when protocol support is missing
Product: [Community] GlusterFS Reporter: Niels de Vos <ndevos>
Component: libgfapiAssignee: Niels de Vos <ndevos>
Status: CLOSED NEXTRELEASE QA Contact: Sudhir D <sdharane>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.6.9CC: bugs
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1315557 Environment:
Last Closed: 2016-08-16 13:11:27 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:
Bug Depends On: 1315557    
Bug Blocks:    

Description Niels de Vos 2016-03-08 04:34:12 UTC
+++ This bug was initially created as a clone of Bug #1315557 +++

Description of problem:
GlusterFS 3.7 and earlier do not have support for the (new) SEEK FOP. There is no check in glfs_lseek() for unknown SEEK_* operations, this needs to be added

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

How reproducible:
100%

Steps to Reproduce:
1. call glfs_lseek(..., ..., SEEK_DATA)

Actual results:
No error is returned.

Expected results:
-1 should get returned, and errno should have been set to EINVAL.

Additional info:
Found through code inspection while replying to http://lists.nongnu.org/archive/html/qemu-block/2016-03/msg00119.html

Comment 1 Vijay Bellur 2016-03-08 04:54:24 UTC
REVIEW: http://review.gluster.org/13633 (gfapi: return EINVAL for unsupported  lseek() operations) posted (#1) for review on release-3.6 by Niels de Vos (ndevos)

Comment 2 Vijay Bellur 2016-03-08 05:10:48 UTC
REVIEW: http://review.gluster.org/13633 (gfapi: return EINVAL for unsupported  lseek() operations) posted (#2) for review on release-3.6 by Niels de Vos (ndevos)

Comment 3 Mike McCune 2016-03-28 23:11:51 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 4 Vijay Bellur 2016-03-30 15:28:42 UTC
COMMIT: http://review.gluster.org/13633 committed in release-3.6 by Raghavendra Bhat (raghavendra) 
------
commit caccd6c205cd324ef184ac6333fb05acd0cc5d4e
Author: Niels de Vos <ndevos>
Date:   Tue Mar 8 05:39:01 2016 +0100

    gfapi: return EINVAL for unsupported  lseek() operations
    
    GlusterFS 3.8 contains support for SEEK_DATA/SEEK_HOLE. This protocol
    extension is not available in 3.6. libgfapi needs to handle unsupported
    SEEK_* operations correctly, by returning -1 and setting errno to
    EINVAL.
    
    This change is different from the patch in the master branch, it is only
    needed to do the improved error checking in this version.
    
    BUG: 1315558
    Change-Id: I142dde11923244809b03fcca8cd4c2f7d5ff3929
    Signed-off-by: Niels de Vos <ndevos>
    Reviewed-on: http://review.gluster.org/13633
    Smoke: Gluster Build System <jenkins.com>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.com>
    Reviewed-by: Shyamsundar Ranganathan <srangana>
    Reviewed-by: Raghavendra Bhat <raghavendra>

Comment 5 Niels de Vos 2016-08-16 13:11:27 UTC
This bug is being closed as GlusterFS-3.6 is nearing its End-Of-Life and only important security bugs will be fixed. This bug has been fixed in more recent GlusterFS releases. If you still face this bug with the newer GlusterFS versions, please open a new bug.

In case glusterfs-3.6.10 gets released, the fix will be included automatically. It is highly recommended to use a newer glusterfs version.