summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/block_svc_routines.c6
-rw-r--r--rpc/glfs-operations.c10
-rw-r--r--rpc/glfs-operations.h3
3 files changed, 11 insertions, 8 deletions
diff --git a/rpc/block_svc_routines.c b/rpc/block_svc_routines.c
index e84ff8d..a6a7974 100644
--- a/rpc/block_svc_routines.c
+++ b/rpc/block_svc_routines.c
@@ -1495,7 +1495,6 @@ block_modify_cli_1_svc(blockModifyCli *blk, struct svc_req *rqstp)
blockModifyCliFormatResponse (blk, &mobj, asyncret?asyncret:errCode,
errMsg, savereply, info, reply, rollback);
blockFreeMetaInfo(info);
- glfs_fini(glfs);
if (savereply) {
GB_FREE(savereply->attempt);
@@ -1808,7 +1807,6 @@ block_create_cli_1_svc(blockCreateCli *blk, struct svc_req *rqstp)
blockCreateCliFormatResponse(glfs, blk, &cobj, errCode, errMsg, savereply, reply);
GB_FREE(errMsg);
blockServerDefFree(list);
- glfs_fini(glfs);
blockCreateParsedRespFree(savereply);
GB_FREE (cobj.block_hosts);
@@ -2115,7 +2113,6 @@ block_delete_cli_1_svc(blockDeleteCli *blk, struct svc_req *rqstp)
blockDeleteCliFormatResponse(blk, errCode, errMsg, savereply, reply);
- glfs_fini(glfs);
if (savereply) {
GB_FREE(savereply->d_attempt);
@@ -2502,8 +2499,6 @@ block_list_cli_1_svc(blockListCli *blk, struct svc_req *rqstp)
GB_TXLOCKFILE, blk->volume, strerror(errno));
}
- glfs_fini(glfs);
-
return reply;
}
@@ -2662,7 +2657,6 @@ block_info_cli_1_svc(blockInfoCli *blk, struct svc_req *rqstp)
blockInfoCliFormatResponse(blk, errCode, errMsg, info, reply);
- glfs_fini(glfs);
GB_FREE(errMsg);
blockFreeMetaInfo(info);
diff --git a/rpc/glfs-operations.c b/rpc/glfs-operations.c
index 9ae8ec5..72de38f 100644
--- a/rpc/glfs-operations.c
+++ b/rpc/glfs-operations.c
@@ -20,6 +20,10 @@ glusterBlockVolumeInit(char *volume, int *errCode, char **errMsg)
struct glfs *glfs;
int ret;
+ glfs = queryCache(volume);
+ if (glfs) {
+ return glfs;
+ }
glfs = glfs_new(volume);
if (!glfs) {
@@ -67,6 +71,12 @@ glusterBlockVolumeInit(char *volume, int *errCode, char **errMsg)
goto out;
}
+ if (appendNewEntry(volume, glfs)) {
+ *errCode = ENOMEM;
+ LOG("gfapi", GB_LOG_ERROR, "allocation failed in appendNewEntry(%s)", volume);
+ goto out;
+ }
+
return glfs;
out:
diff --git a/rpc/glfs-operations.h b/rpc/glfs-operations.h
index 150554e..bd6b497 100644
--- a/rpc/glfs-operations.h
+++ b/rpc/glfs-operations.h
@@ -17,8 +17,7 @@
# include <stdbool.h>
# include <errno.h>
-# include <glusterfs/api/glfs.h>
-
+# include "lru.h"
# include "block.h"