summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-handleops.c
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2015-04-14 13:08:34 +0530
committerVijay Bellur <vbellur@redhat.com>2015-05-02 02:29:44 -0700
commit27eabb02adc0d5aec58b3a19ab2b2128b7633c3a (patch)
treeaf5d6a42d5a8d69f24c49d9b2e60119e2ce680f1 /api/src/glfs-handleops.c
parente1f675cfd0f5b601c332b17333149d6c760bfd89 (diff)
gfapi: Fix in glfs_h_create_from_handle
While constructing glfs_object from the handle given, incase if inode is found in the inode table, we need not do "syncop_lookup" unless we need to return the inode attributes. BUG: 1217711 Change-Id: Iaf296a80f721f9fca38d8023b83d37e6e5d970a5 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10232 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10485 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api/src/glfs-handleops.c')
-rw-r--r--api/src/glfs-handleops.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c
index acd74e56dcb..54702d89934 100644
--- a/api/src/glfs-handleops.c
+++ b/api/src/glfs-handleops.c
@@ -1145,9 +1145,12 @@ pub_glfs_h_create_from_handle (struct glfs *fs, unsigned char *handle, int len,
memcpy (loc.gfid, handle, GFAPI_HANDLE_LENGTH);
newinode = inode_find (subvol->itable, loc.gfid);
- if (newinode)
+ if (newinode) {
+ if (!stat) /* No need of lookup */
+ goto found;
+
loc.inode = newinode;
- else {
+ } else {
loc.inode = inode_new (subvol->itable);
if (!loc.inode) {
errno = ENOMEM;
@@ -1179,6 +1182,7 @@ pub_glfs_h_create_from_handle (struct glfs *fs, unsigned char *handle, int len,
if (stat)
glfs_iatt_to_stat (fs, &iatt, stat);
+found:
object = GF_CALLOC (1, sizeof(struct glfs_object),
glfs_mt_glfs_object_t);
if (object == NULL) {
@@ -1693,7 +1697,7 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg)
if (found) {
object = glfs_h_create_from_handle (fs, gfid,
GFAPI_HANDLE_LENGTH,
- &up_arg->buf);
+ NULL);
if (!object) {
errno = ENOMEM;