diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2012-03-12 21:06:45 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-14 05:57:18 -0700 |
commit | aa0f68aa8ec38808a83553abde8d8211047e7b4e (patch) | |
tree | d35a5efa3f65d2f16b3512535dec5377169a2c74 /xlators | |
parent | 7bd561996d5a32071942b598739b130e020f89ee (diff) |
nfs: do not call inode_path on the newly created inode
While resolving, for building the path into the loc, inode_find
is called with gfid as argument to get the inode from the inode
table. If the inode is not found, then a new inode is created.
Then the path is build using inode_path. But if the inode is
not linked to inode table (newly created inode), then gfid will
be null and inode_path returns null gfid as the path. Suppose the
lookup operation on that gfid fails, then we print the null gfid
in the log message.
To avoid it, build the path using the gfid only if inode_path
fails.
Change-Id: I2506fa8675761ddb0bc02980cd3583d9d068fc85
BUG: 802424
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/2930
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/nfs/server/src/nfs-common.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c index b5c56d03d..ec76c294f 100644 --- a/xlators/nfs/server/src/nfs-common.c +++ b/xlators/nfs/server/src/nfs-common.c @@ -203,11 +203,24 @@ nfs_inode_loc_fill (inode_t *inode, loc_t *loc, int how) 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; + /* If gfid is not null, then the inode is already linked to + * the inode table, and not a newly created one. For newly + * created inode, inode_path returns null gfid as the path. + */ + if (!uuid_is_null (inode->gfid)) { + ret = inode_path (inode, NULL, &resolvedpath); + if (ret < 0) { + gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed " + "%s", resolvedpath); + goto err; + } + } + + if (resolvedpath == NULL) { + char tmp_path[GFID_STR_PFX_LEN + 1] = {0,}; + snprintf (tmp_path, sizeof (tmp_path), "<gfid:%s>", + uuid_utoa (loc->gfid)); + resolvedpath = gf_strdup (tmp_path); } ret = nfs_loc_fill (loc, inode, parent, resolvedpath); |