Bug 1241666

Summary: glfs_loc_link: Update loc.inode with the existing inode incase if already exits
Product: [Community] GlusterFS Reporter: Soumya Koduri <skoduri>
Component: libgfapiAssignee: bugs <bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Sudhir D <sdharane>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.7.2CC: bugs, gluster-bugs, ndevos, sdharane, srangana
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: glusterfs-3.7.3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1240916 Environment:
Last Closed: 2015-07-30 09:49:12 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:
Bug Depends On: 1240916    
Bug Blocks: 1235121    

Description Soumya Koduri 2015-07-09 18:37:59 UTC
+++ This bug was initially created as a clone of Bug #1240916 +++

Description of problem:
int
glfs_loc_link (loc_t *loc, struct iatt *iatt)
{
        int ret = -1;
        inode_t *linked_inode = NULL;

        if (!loc->inode) {
                errno = EINVAL;
                return -1;
        }

        linked_inode = inode_link (loc->inode, loc->parent, loc->name, iatt);
        if (linked_inode) {
                inode_lookup (linked_inode);
                inode_unref (linked_inode);
                ret = 0;
        } else {
                ret = -1;
                errno = ENOMEM;
        }

        return ret;
}

Here in case if the inode already exits in the cache, inode_link returns the pointer to the exiting one instead of using loc->inode. This results in the loc->inode not being updated which may result in the issues reported in https://bugzilla.redhat.com/show_bug.cgi?id=1235121#c10

--- Additional comment from Anand Avati on 2015-07-08 02:46:58 EDT ---

REVIEW: http://review.gluster.org/11572 (gfapi: Update loc->inode accordingly in 'glfs_loc_link') posted (#1) for review on master by soumya k (skoduri)

--- Additional comment from Anand Avati on 2015-07-09 14:04:41 EDT ---

COMMIT: http://review.gluster.org/11572 committed in master by Kaleb KEITHLEY (kkeithle) 
------
commit c134bdd83a781452eff8c3e4abce3da4a997daa8
Author: Soumya Koduri <skoduri>
Date:   Wed Jul 8 12:08:25 2015 +0530

    gfapi: Update loc->inode accordingly in 'glfs_loc_link'
    
    In case if the inode already exits in the cache, inode_link
    returns the pointer to the exiting one instead of using loc->inode.
    This will result in issues if that invalid inodei(loc->inode) is referenced
    further. Fixed the same.
    
    Change-Id: I7d4a06043e4e731c8404532c47d482175dc2c277
    BUG: 1240916
    Signed-off-by: Soumya Koduri <skoduri>
    Reviewed-on: http://review.gluster.org/11572
    Tested-by: Gluster Build System <jenkins.com>
    Tested-by: NetBSD Build System <jenkins.org>
    Reviewed-by: Kaleb KEITHLEY <kkeithle>
    Reviewed-by: Shyamsundar Ranganathan <srangana>

Comment 1 Anand Avati 2015-07-09 18:38:58 UTC
REVIEW: http://review.gluster.org/11605 (gfapi: Update loc->inode accordingly in 'glfs_loc_link') posted (#1) for review on release-3.7 by soumya k (skoduri)

Comment 2 Anand Avati 2015-07-09 18:48:25 UTC
REVIEW: http://review.gluster.org/11606 (gfapi: Update loc->inode accordingly in 'glfs_loc_link') posted (#1) for review on release-3.7 by soumya k (skoduri)

Comment 3 Anand Avati 2015-07-10 10:06:54 UTC
COMMIT: http://review.gluster.org/11606 committed in release-3.7 by Kaleb KEITHLEY (kkeithle) 
------
commit decf3c9fe0d4f1f636e337aa313694251341b685
Author: Soumya Koduri <skoduri>
Date:   Wed Jul 8 12:08:25 2015 +0530

    gfapi: Update loc->inode accordingly in 'glfs_loc_link'
    
    In case if the inode already exits in the cache, inode_link
    returns the pointer to the exiting one instead of using loc->inode.
    This will result in issues if that invalid inodei(loc->inode) is referenced
    further. Fixed the same.
    
    This is backport of the below fix -
    http://review.gluster.org/#/c/11572/
    
    BUG: 1241666
    Change-Id: I1a89932397f7d2b70d619eeaf862c0a5d7f6b91c
    Signed-off-by: Soumya Koduri <skoduri>
    Reviewed-on: http://review.gluster.org/11572
    Reviewed-by: Kaleb KEITHLEY <kkeithle>
    Reviewed-by: Shyamsundar Ranganathan <srangana>
    Reviewed-on: http://review.gluster.org/11606
    Tested-by: Gluster Build System <jenkins.com>

Comment 4 Kaushal 2015-07-30 09:49:12 UTC
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.7.3, please open a new bug report.

glusterfs-3.7.3 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://thread.gmane.org/gmane.comp.file-systems.gluster.devel/12078
[2] http://thread.gmane.org/gmane.comp.file-systems.gluster.user