Bug 802424

Summary: [glusterfs-3.3.0qa27]: null gfid is shown in the log-file if lookup of a file fails
Product: [Community] GlusterFS Reporter: Raghavendra Bhat <rabhat>
Component: nfsAssignee: Raghavendra Bhat <rabhat>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: amarts, gluster-bugs, vbellur
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: glusterfs-3.4.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-24 17:30:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: glusterfs-3.3.0qa40 Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 817967    

Description Raghavendra Bhat 2012-03-12 14:02:19 UTC
Description of problem:
Whilre resolving, if the lookup on a file fails, then in the error message null gfid is shown.


getfattr -d -m . -e hex /export/mirror/glusterfs.git/conftest
getfattr: Removing leading '/' from absolute path names
# file: export/mirror/glusterfs.git/conftest
security.selinux=0x756e636f6e66696e65645f753a6f626a6563745f723a66696c655f743a733000
trusted.gfid=0x854ca9e231764414b6979619e5ef51a8


 getfattr -d -m . -e hex /export/miror/glusterfs.git/conftest
getfattr: Removing leading '/' from absolute path names
# file: export/miror/glusterfs.git/conftest
security.selinux=0x756e636f6e66696e65645f753a6f626a6563745f723a66696c655f743a733000
trusted.gfid=0x0edf1d9e2867400d933702d840a03b78


getfattr -d -m . -e hex /export/mirror/glusterfs.git/conftest
getfattr: Removing leading '/' from absolute path names
# file: export/mirror/glusterfs.git/conftest
security.selinux=0x756e636f6e66696e65645f753a6f626a6563745f723a66696c655f743a733000
trusted.gfid=0x0edf1d9e2867400d933702d840a03b78

Its because, in nfs3_fh_resolve_inode_hard, while filling the loc structure (nfs_gfid_loc_fill), we try to find the inode from the inode table using the gfid. If we cannot find it we will create a new inode.

 inode = inode_find (itable, gfid);
	if (!inode) {
                gf_log (GF_NFS, GF_LOG_TRACE, "Inode not found in itable, will try to create one.");
                if (how == NFS_RESOLVE_CREATE) {
                        gf_log (GF_NFS, GF_LOG_TRACE, "Inode needs to be created.");
                        inode = inode_new (itable);
			if (!inode) {
                                gf_log (GF_NFS, GF_LOG_ERROR, "Failed to "
		                        "allocate memory");
				ret = -ENOMEM;
                                goto err;
                        }

                } else {
                        gf_log (GF_NFS, GF_LOG_ERROR, "Inode not found in itable and no creation was requested.");
                        ret = -ENOENT;
 	                goto err;
                }
        } else {
                gf_log (GF_NFS, GF_LOG_TRACE, "Inode was found in the itable.");
 	}

        uuid_copy (loc->gfid, gfid);


Then in nfs_inode_loc_fill we try to find the path using inode_path which returns null gfid if the inode is newly allocated (since it is not yet linked to the inode table) 

	if ((!inode) || (!loc))
		return ret;

	ret = inode_path (inode, NULL, &resolvedpath);
        if (ret < 0) {
                gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed %s",
                                resolvedpath);
                goto err;
        }


We send lookup using that inode. If lookup fails, then we actually print the null gfid in the log-file.
Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:

null gfid is printed when lookup fails
Expected results:

we should print the proper gfid of the inode in the log message when lookup fails

Additional info:

Comment 1 Anand Avati 2012-03-14 12:57:24 UTC
CHANGE: http://review.gluster.com/2930 (nfs: do not call inode_path on the newly created inode) merged in master by Vijay Bellur (vijay)

Comment 2 Raghavendra Bhat 2012-05-09 09:50:33 UTC
Checked with glusterfs-3.3.0qa40. Now since we do not call inode_path on the newly created inode and fill the path using loc null gfid is not printed as path.