summaryrefslogtreecommitdiffstats
path: root/xlators/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/nfs')
-rw-r--r--xlators/nfs/lib/src/rpcsvc-auth.c12
-rw-r--r--xlators/nfs/lib/src/rpcsvc.c32
-rw-r--r--xlators/nfs/lib/src/xdr-nfs3.c18
-rw-r--r--xlators/nfs/server/src/mount3.c31
-rw-r--r--xlators/nfs/server/src/nfs-common.c11
-rw-r--r--xlators/nfs/server/src/nfs-mem-types.h46
-rw-r--r--xlators/nfs/server/src/nfs.c26
-rw-r--r--xlators/nfs/server/src/nfs3-helpers.c35
-rw-r--r--xlators/nfs/server/src/nfs3.c21
9 files changed, 155 insertions, 77 deletions
diff --git a/xlators/nfs/lib/src/rpcsvc-auth.c b/xlators/nfs/lib/src/rpcsvc-auth.c
index 38697965b..f61fe91d0 100644
--- a/xlators/nfs/lib/src/rpcsvc-auth.c
+++ b/xlators/nfs/lib/src/rpcsvc-auth.c
@@ -36,7 +36,7 @@ rpcsvc_auth_add_initer (struct list_head *list, char *idfier,
if ((!list) || (!init) || (!idfier))
return -1;
- new = CALLOC (1, sizeof (*new));
+ new = GF_CALLOC (1, sizeof (*new), gf_common_mt_rpcsvc_auth_list);
if (!new) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "Memory allocation failed");
return -1;
@@ -312,7 +312,7 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen)
if (count >= arrlen)
break;
- gen = asprintf (&srchstr, "rpc-auth.%s", auth->name);
+ gen = gf_asprintf (&srchstr, "rpc-auth.%s", auth->name);
if (gen == -1) {
count = -1;
goto err;
@@ -334,9 +334,9 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen)
"d to read auth val");
}
- FREE (srchstr);
- spec = asprintf (&srchstr, "rpc-auth.%s.%s", auth->name,
- volname);
+ GF_FREE (srchstr);
+ spec = gf_asprintf (&srchstr, "rpc-auth.%s.%s", auth->name,
+ volname);
if (spec == -1) {
count = -1;
goto err;
@@ -360,7 +360,7 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen)
"d to read auth val");
}
- FREE (srchstr);
+ GF_FREE (srchstr);
final = rpcsvc_combine_gen_spec_volume_checks (gen, spec);
if (final == RPCSVC_AUTH_ACCEPT) {
autharr[count] = auth->auth->authnum;
diff --git a/xlators/nfs/lib/src/rpcsvc.c b/xlators/nfs/lib/src/rpcsvc.c
index 47510ad8a..bcb8af652 100644
--- a/xlators/nfs/lib/src/rpcsvc.c
+++ b/xlators/nfs/lib/src/rpcsvc.c
@@ -78,7 +78,7 @@ rpcsvc_stage_init (rpcsvc_t *svc)
if (!svc)
return NULL;
- stg = CALLOC (1, sizeof(*stg));
+ stg = GF_CALLOC (1, sizeof(*stg), gf_common_mt_rpcsvc_stage_t);
if (!stg)
return NULL;
@@ -106,7 +106,7 @@ rpcsvc_stage_init (rpcsvc_t *svc)
ret = 0;
free_stg:
if (ret == -1) {
- FREE (stg);
+ GF_FREE (stg);
stg = NULL;
}
@@ -135,7 +135,7 @@ rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options)
if ((!ctx) || (!options))
return NULL;
- svc = CALLOC (1, sizeof (*svc));
+ svc = GF_CALLOC (1, sizeof (*svc), gf_common_mt_rpcsvc_t);
if (!svc)
return NULL;
@@ -169,7 +169,7 @@ rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options)
ret = 0;
free_svc:
if (ret == -1) {
- FREE (svc);
+ GF_FREE (svc);
svc = NULL;
}
@@ -248,7 +248,7 @@ rpcsvc_conn_peer_check_allow (dict_t *options, char *volname, char *clstr)
* subvolumes.
*/
if (volname) {
- ret = asprintf (&srchstr, "rpc-auth.addr.%s.allow", volname);
+ ret = gf_asprintf (&srchstr, "rpc-auth.addr.%s.allow", volname);
if (ret == -1) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed");
ret = RPCSVC_AUTH_DONTCARE;
@@ -259,7 +259,7 @@ rpcsvc_conn_peer_check_allow (dict_t *options, char *volname, char *clstr)
ret = rpcsvc_conn_peer_check_search (options, srchstr, clstr);
if (volname)
- FREE (srchstr);
+ GF_FREE (srchstr);
if (ret == 0)
ret = RPCSVC_AUTH_ACCEPT;
@@ -280,7 +280,7 @@ rpcsvc_conn_peer_check_reject (dict_t *options, char *volname, char *clstr)
return ret;
if (volname) {
- ret = asprintf (&srchstr, "rpc-auth.addr.%s.reject", volname);
+ ret = gf_asprintf (&srchstr, "rpc-auth.addr.%s.reject", volname);
if (ret == -1) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed");
ret = RPCSVC_AUTH_REJECT;
@@ -291,7 +291,7 @@ rpcsvc_conn_peer_check_reject (dict_t *options, char *volname, char *clstr)
ret = rpcsvc_conn_peer_check_search (options, srchstr, clstr);
if (volname)
- FREE (srchstr);
+ GF_FREE (srchstr);
if (ret == 0)
ret = RPCSVC_AUTH_REJECT;
@@ -591,14 +591,14 @@ rpcsvc_volume_allowed (dict_t *options, char *volname)
if ((!options) || (!volname))
return NULL;
- ret = asprintf (&srchstr, "rpc-auth.addr.%s.allow", volname);
+ ret = gf_asprintf (&srchstr, "rpc-auth.addr.%s.allow", volname);
if (ret == -1) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed");
goto out;
}
if (!dict_get (options, srchstr)) {
- FREE (srchstr);
+ GF_FREE (srchstr);
srchstr = globalrule;
ret = dict_get_str (options, srchstr, &addrstr);
} else
@@ -617,7 +617,7 @@ rpcsvc_conn_init (rpcsvc_t *svc, rpcsvc_program_t *prog, int sockfd)
int ret = -1;
unsigned int poolcount = 0;
- conn = CALLOC (1, sizeof(*conn));
+ conn = GF_CALLOC (1, sizeof(*conn), gf_common_mt_rpcsvc_conn_t);
if (!conn) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "memory allocation failed");
return NULL;
@@ -659,7 +659,7 @@ free_txp:
free_conn:
if (ret == -1) {
- FREE (conn);
+ GF_FREE (conn);
conn = NULL;
}
@@ -677,7 +677,7 @@ rpcsvc_conn_destroy (rpcsvc_conn_t *conn)
conn->program->conn_destroy (conn->program->private, conn);
/* Need to destory record state, txlists etc. */
- FREE (conn);
+ GF_FREE (conn);
gf_log (GF_RPCSVC, GF_LOG_DEBUG, "Connection destroyed");
}
@@ -917,7 +917,7 @@ rpcsvc_conn_privport_check (rpcsvc_t *svc, char *volname, rpcsvc_conn_t *conn)
}
/* Disabled by default */
- ret = asprintf (&srchstr, "rpc-auth.ports.%s.insecure", volname);
+ ret = gf_asprintf (&srchstr, "rpc-auth.ports.%s.insecure", volname);
if (ret == -1) {
gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed");
ret = RPCSVC_AUTH_REJECT;
@@ -2632,7 +2632,7 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program)
if (!svc)
return -1;
- newprog = CALLOC (1, sizeof(*newprog));
+ newprog = GF_CALLOC (1, sizeof(*newprog), gf_common_mt_rpcsvc_program_t);
if (!newprog)
return -1;
@@ -2666,7 +2666,7 @@ free_prog:
gf_log (GF_RPCSVC, GF_LOG_ERROR, "Program registration failed:"
" %s, Num: %d, Ver: %d, Port: %d", newprog->progname,
newprog->prognum, newprog->progver, newprog->progport);
- FREE (newprog);
+ GF_FREE (newprog);
}
return ret;
diff --git a/xlators/nfs/lib/src/xdr-nfs3.c b/xlators/nfs/lib/src/xdr-nfs3.c
index 7d8075a56..d7984be56 100644
--- a/xlators/nfs/lib/src/xdr-nfs3.c
+++ b/xlators/nfs/lib/src/xdr-nfs3.c
@@ -1841,15 +1841,15 @@ xdr_free_exports_list (struct exportnode *first)
while (first) {
elist = first->ex_next;
if (first->ex_dir)
- FREE (first->ex_dir);
+ GF_FREE (first->ex_dir);
if (first->ex_groups) {
if (first->ex_groups->gr_name)
- FREE (first->ex_groups->gr_name);
- FREE (first->ex_groups);
+ GF_FREE (first->ex_groups->gr_name);
+ GF_FREE (first->ex_groups);
}
- FREE (first);
+ GF_FREE (first);
first = elist;
}
@@ -1865,10 +1865,10 @@ xdr_free_mountlist (mountlist ml)
return;
while (ml) {
- FREE (ml->ml_hostname);
- FREE (ml->ml_directory);
+ GF_FREE (ml->ml_hostname);
+ GF_FREE (ml->ml_directory);
next = ml->ml_next;
- FREE (ml);
+ GF_FREE (ml);
ml = next;
}
@@ -1885,8 +1885,8 @@ xdr_free_write3args_nocopy (write3args *wa)
if (!wa)
return;
- FREE (wa->file.data.data_val);
- FREE (wa);
+ GF_FREE (wa->file.data.data_val);
+ GF_FREE (wa);
}
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index db4a88e3d..c3792b314 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -36,6 +36,7 @@
#include "nfs-generics.h"
#include "locking.h"
#include "iatt.h"
+#include "nfs-mem-types.h"
#include <errno.h>
@@ -182,7 +183,7 @@ mnt3svc_update_mountlist (struct mount3_state *ms, rpcsvc_request_t *req,
if ((!ms) || (!req) || (!exportxl))
return -1;
- me = (struct mountentry *)CALLOC (1, sizeof (*me));
+ me = (struct mountentry *)GF_CALLOC (1, sizeof (*me), gf_nfs_mt_mountentry);
if (!me)
return -1;
@@ -203,7 +204,7 @@ mnt3svc_update_mountlist (struct mount3_state *ms, rpcsvc_request_t *req,
free_err:
if (ret == -1)
- FREE (me);
+ GF_FREE (me);
return ret;
}
@@ -387,14 +388,15 @@ __build_mountlist (struct mount3_state *ms, int *count)
gf_log (GF_MNT, GF_LOG_DEBUG, "Building mount list:");
list_for_each_entry (me, &ms->mountlist, mlist) {
namelen = strlen (me->exname);
- mlist = CALLOC (1, sizeof (*mlist));
+ mlist = GF_CALLOC (1, sizeof (*mlist), gf_nfs_mt_mountbody);
if (!mlist) {
gf_log (GF_MNT, GF_LOG_ERROR, "Memory allocation"
" failed");
goto free_list;
}
- mlist->ml_directory = CALLOC (namelen + 2, sizeof (char));
+ mlist->ml_directory = GF_CALLOC (namelen + 2, sizeof (char),
+ gf_nfs_mt_char);
if (!mlist->ml_directory) {
gf_log (GF_MNT, GF_LOG_ERROR, "Memory allocation"
" failed");
@@ -405,7 +407,8 @@ __build_mountlist (struct mount3_state *ms, int *count)
strcat (mlist->ml_directory, me->exname);
namelen = strlen (me->hostname);
- mlist->ml_hostname = CALLOC (namelen + 2, sizeof (char));
+ mlist->ml_hostname = GF_CALLOC (namelen + 2, sizeof (char),
+ gf_nfs_mt_char);
if (!mlist->ml_hostname) {
gf_log (GF_MNT, GF_LOG_ERROR, "Memory allocation"
" failed");
@@ -526,7 +529,7 @@ __mnt3svc_umount (struct mount3_state *ms, char *dirpath, char *hostname)
gf_log (GF_MNT, GF_LOG_DEBUG, "Unmounting: dir %s, host: %s",
me->exname, me->hostname);
list_del (&me->mlist);
- FREE (me);
+ GF_FREE (me);
ret = 0;
ret:
return ret;
@@ -635,7 +638,7 @@ __mnt3svc_umountall (struct mount3_state *ms)
list_for_each_entry (me, &ms->mountlist, mlist) {
list_del (&me->mlist);
- FREE (me);
+ GF_FREE (me);
}
return 0;
@@ -701,14 +704,15 @@ mnt3_xlchildren_to_exports (rpcsvc_t *svc, xlator_list_t *cl)
while (cl) {
namelen = strlen (cl->xlator->name);
- elist = CALLOC (1, sizeof (*elist));
+ elist = GF_CALLOC (1, sizeof (*elist), gf_nfs_mt_exportnode);
if (!elist) {
gf_log (GF_MNT, GF_LOG_ERROR, "Memory allocation"
" failed");
goto free_list;
}
- elist->ex_dir = CALLOC (namelen + 2, sizeof (char));
+ elist->ex_dir = GF_CALLOC (namelen + 2, sizeof (char),
+ gf_nfs_mt_char);
if (!elist->ex_dir) {
gf_log (GF_MNT, GF_LOG_ERROR, "Memory allocation"
" failed");
@@ -720,11 +724,12 @@ mnt3_xlchildren_to_exports (rpcsvc_t *svc, xlator_list_t *cl)
addrstr = rpcsvc_volume_allowed (svc->options,cl->xlator->name);
if (addrstr)
- addrstr = strdup (addrstr);
+ addrstr = gf_strdup (addrstr);
else
- addrstr = strdup ("No Access");
+ addrstr = gf_strdup ("No Access");
- elist->ex_groups = CALLOC (1, sizeof (struct groupnode));
+ elist->ex_groups = GF_CALLOC (1, sizeof (struct groupnode),
+ gf_nfs_mt_groupnode);
if (!elist->ex_groups) {
gf_log (GF_MNT, GF_LOG_ERROR, "Memory allocation"
" failed");
@@ -801,7 +806,7 @@ mnt3_init_state (xlator_t *nfsx)
if (!nfsx)
return NULL;
- ms = CALLOC (1, sizeof (*ms));
+ ms = GF_CALLOC (1, sizeof (*ms), gf_nfs_mt_mount3_state);
if (!ms) {
gf_log (GF_MNT, GF_LOG_ERROR, "Memory allocation failed");
return NULL;
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index 3623f041c..69bf46702 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -30,6 +30,7 @@
#include "iobuf.h"
#include "nfs-common.h"
#include "nfs-fops.h"
+#include "nfs-mem-types.h"
#include "rpcsvc.h"
#include "iatt.h"
@@ -144,7 +145,7 @@ nfs_loc_wipe (loc_t *loc)
return;
if (loc->path) {
- FREE (loc->path);
+ GF_FREE ((char *)loc->path);
loc->path = NULL;
}
@@ -175,7 +176,7 @@ nfs_loc_copy (loc_t *dst, loc_t *src)
if (src->parent)
dst->parent = inode_ref (src->parent);
- dst->path = strdup (src->path);
+ dst->path = gf_strdup (src->path);
if (!dst->path)
goto out;
@@ -206,7 +207,7 @@ nfs_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path)
if (parent)
loc->parent = inode_ref (parent);
- loc->path = strdup (path);
+ loc->path = gf_strdup (path);
if (!loc->path) {
gf_log (GF_NFS, GF_LOG_ERROR, "strdup failed");
goto loc_wipe;
@@ -258,7 +259,7 @@ err:
inode_unref (parent);
if (resolvedpath)
- FREE (resolvedpath);
+ GF_FREE (resolvedpath);
return ret;
}
@@ -370,7 +371,7 @@ err:
inode_unref (entryinode);
if (resolvedpath)
- FREE (resolvedpath);
+ GF_FREE (resolvedpath);
return ret;
}
diff --git a/xlators/nfs/server/src/nfs-mem-types.h b/xlators/nfs/server/src/nfs-mem-types.h
new file mode 100644
index 000000000..118ee2d23
--- /dev/null
+++ b/xlators/nfs/server/src/nfs-mem-types.h
@@ -0,0 +1,46 @@
+/*
+ Copyright (c) 2008-2009 Gluster, Inc. <http://www.gluster.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef __NFS_MEM_TYPES_H__
+#define __NFS_MEM_TYPES_H__
+
+#include "mem-types.h"
+
+enum gf_nfs_mem_types_ {
+ gf_nfs_mt_mountentry = gf_common_mt_end + 1,
+ gf_nfs_mt_mountbody,
+ gf_nfs_mt_nfs_state,
+ gf_nfs_mt_char,
+ gf_nfs_mt_exportnode,
+ gf_nfs_mt_groupnode,
+ gf_nfs_mt_mount3_state,
+ gf_nfs_mt_write3args,
+ gf_nfs_mt_nfs3_export,
+ gf_nfs_mt_nfs3_state,
+ gf_nfs_mt_entry3,
+ gf_nfs_mt_entryp3,
+ gf_nfs_mt_nfs3_fd_entry,
+ gf_nfs_mt_nfs_initer_list,
+ gf_nfs_mt_xlator_t,
+ gf_nfs_mt_list_head,
+ gf_nfs_mt_end
+};
+#endif
+
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c
index b598b0c69..fa7edc9ff 100644
--- a/xlators/nfs/server/src/nfs.c
+++ b/xlators/nfs/server/src/nfs.c
@@ -38,6 +38,7 @@
#include "inode.h"
#include "mount3.h"
#include "nfs3.h"
+#include "nfs-mem-types.h"
/* Every NFS version must call this function with the init function
* for its particular version.
@@ -49,7 +50,7 @@ nfs_add_initer (struct list_head *list, nfs_version_initer_t init)
if ((!list) || (!init))
return -1;
- new = CALLOC (1, sizeof (*new));
+ new = GF_CALLOC (1, sizeof (*new), gf_nfs_mt_nfs_initer_list);
if (!new) {
gf_log (GF_NFS, GF_LOG_ERROR, "Memory allocation failed");
return -1;
@@ -356,7 +357,8 @@ nfs_init_subvolumes (struct nfs_state *nfs, xlator_list_t *cl)
}
LOCK_INIT (&nfs->svinitlock);
- nfs->initedxl = CALLOC (svcount, sizeof (xlator_t *));
+ nfs->initedxl = GF_CALLOC (svcount, sizeof (xlator_t *),
+ gf_nfs_mt_xlator_t );
if (!nfs->initedxl) {
gf_log (GF_NFS, GF_LOG_ERROR, "Failed to allocated inited xls");
ret = -1;
@@ -435,6 +437,24 @@ nfs_request_user_init (nfs_user_t *nfu, rpcsvc_request_t *req)
return;
}
+int32_t
+mem_acct_init (xlator_t *this)
+{
+ int ret = -1;
+
+ if (!this)
+ return ret;
+
+ ret = xlator_mem_acct_init (this, gf_nfs_mt_end + 1);
+
+ if (ret != 0) {
+ gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"
+ "failed");
+ return ret;
+ }
+
+ return ret;
+}
int
init (xlator_t *this) {
@@ -452,7 +472,7 @@ init (xlator_t *this) {
return -1;
}
- nfs = CALLOC (1, sizeof (*nfs));
+ nfs = GF_CALLOC (1, sizeof (*nfs), gf_nfs_mt_nfs_state);
if (!nfs) {
gf_log (GF_NFS, GF_LOG_ERROR, "memory allocation failed");
return -1;
diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c
index 72861dfd0..52bb7169a 100644
--- a/xlators/nfs/server/src/nfs3-helpers.c
+++ b/xlators/nfs/server/src/nfs3-helpers.c
@@ -33,6 +33,7 @@
#include "nfs-inodes.h"
#include "nfs-generics.h"
#include "nfs3-helpers.h"
+#include "nfs-mem-types.h"
#include "iatt.h"
#include <string.h>
@@ -708,16 +709,17 @@ nfs3_fill_entry3 (gf_dirent_t *entry)
if (!entry)
return NULL;
- ent = CALLOC (1, sizeof (*ent));
+ ent = GF_CALLOC (1, sizeof (*ent), gf_nfs_mt_entry3);
if (!ent)
return NULL;
gf_log (GF_NFS3, GF_LOG_TRACE, "Entry: %s", entry->d_name);
ent->fileid = entry->d_ino;
ent->cookie = entry->d_off;
- ent->name = CALLOC ((strlen (entry->d_name) + 1), sizeof (char));
+ ent->name = GF_CALLOC ((strlen (entry->d_name) + 1), sizeof (char),
+ gf_nfs_mt_char);
if (!ent->name) {
- FREE (ent);
+ GF_FREE (ent);
ent = NULL;
goto err;
}
@@ -754,7 +756,7 @@ nfs3_fh_to_post_op_fh3 (struct nfs3_fh *fh)
pfh.handle_follows = 1;
- fhp = CALLOC (1, sizeof (*fh));
+ fhp = GF_CALLOC (1, sizeof (*fh), gf_nfs_mt_char);
if (!fhp)
return pfh;
@@ -775,15 +777,16 @@ nfs3_fill_entryp3 (gf_dirent_t *entry, struct nfs3_fh *dirfh)
gf_log (GF_NFS3, GF_LOG_TRACE, "Entry: %s, ino: %"PRIu64,
entry->d_name, entry->d_ino);
- ent = CALLOC (1, sizeof (*ent));
+ ent = GF_CALLOC (1, sizeof (*ent), gf_nfs_mt_entryp3);
if (!ent)
return NULL;
ent->fileid = entry->d_ino;
ent->cookie = entry->d_off;
- ent->name = CALLOC ((strlen (entry->d_name) + 1), sizeof (char));
+ ent->name = GF_CALLOC ((strlen (entry->d_name) + 1), sizeof (char),
+ gf_nfs_mt_char);
if (!ent->name) {
- FREE (ent);
+ GF_FREE (ent);
ent = NULL;
goto err;
}
@@ -937,9 +940,9 @@ nfs3_free_readdirp3res (readdirp3res *res)
while (ent) {
next = ent->nextentry;
- FREE (ent->name);
- FREE (ent->name_handle.post_op_fh3_u.handle.data.data_val);
- FREE (ent);
+ GF_FREE (ent->name);
+ GF_FREE (ent->name_handle.post_op_fh3_u.handle.data.data_val);
+ GF_FREE (ent);
ent = next;
}
@@ -960,8 +963,8 @@ nfs3_free_readdir3res (readdir3res *res)
while (ent) {
next = ent->nextentry;
- FREE (ent->name);
- FREE (ent);
+ GF_FREE (ent->name);
+ GF_FREE (ent);
ent = next;
}
@@ -1810,7 +1813,7 @@ __nfs3_fdcache_remove_entry (struct nfs3_state *nfs3, struct nfs3_fd_entry *fde)
list_del (&fde->list);
fd_ctx_del (fde->cachedfd, nfs3->nfsx, NULL);
fd_unref (fde->cachedfd);
- FREE (fde);
+ GF_FREE (fde);
--nfs3->fdcount;
return 0;
@@ -1869,7 +1872,7 @@ nfs3_fdcache_add (struct nfs3_state *nfs3, fd_t *fd)
if ((!nfs3) || (!fd))
return -1;
- fde = CALLOC (1, sizeof (*fd));
+ fde = GF_CALLOC (1, sizeof (*fd), gf_nfs_mt_nfs3_fd_entry);
if (!fde) {
gf_log (GF_NFS3, GF_LOG_ERROR, "fd entry allocation failed");
goto out;
@@ -1939,7 +1942,7 @@ __nfs3_queue_call_state (nfs3_call_state_t *cs)
goto attach_cs;
}
- inode_q = CALLOC (1, sizeof (*inode_q));
+ inode_q = GF_CALLOC (1, sizeof (*inode_q), gf_nfs_mt_list_head);
if (!inode_q)
goto err;
@@ -2844,7 +2847,7 @@ nfs3_fh_resolve_and_resume (nfs3_call_state_t *cs, struct nfs3_fh *fh,
if (!entry)
ret = nfs3_fh_resolve_inode (cs);
else {
- cs->resolventry = strdup (entry);
+ cs->resolventry = gf_strdup (entry);
if (!cs->resolventry)
goto err;
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 57d9f576e..a4ef1c6fc 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -36,6 +36,7 @@
#include "nfs-inodes.h"
#include "nfs-generics.h"
#include "nfs3-helpers.h"
+#include "nfs-mem-types.h"
#include <sys/socket.h>
@@ -203,10 +204,10 @@ nfs3_call_state_wipe (nfs3_call_state_t *cs)
fd_unref (cs->resolve_dir_fd);
if (cs->resolventry)
- FREE (cs->resolventry);
+ GF_FREE (cs->resolventry);
if (cs->pathname)
- FREE (cs->pathname);
+ GF_FREE (cs->pathname);
if (!list_empty (&cs->entries.list))
gf_dirent_free (&cs->entries);
@@ -1810,7 +1811,7 @@ nfs3svc_write_vecsizer (rpcsvc_request_t *req, ssize_t *readsize, int *newbuf)
rpcsvc_request_set_private (req, NFS3_VECWRITE_READREST);
ret = 0;
} else if (state == NFS3_VECWRITE_READREST) {
- args = CALLOC (1, sizeof (*args));
+ args = GF_CALLOC (1, sizeof (*args), gf_nfs_mt_write3args);
if (!args)
goto rpcerr;
@@ -2490,7 +2491,7 @@ nfs3_symlink (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name,
nfs3_handle_call_state_init (nfs3, cs, req, vol, stat, nfs3err);
cs->parent = *dirfh;
- cs->pathname = strdup (target);
+ cs->pathname = gf_strdup (target);
if (!cs->pathname) {
ret = -1;
stat = NFS3ERR_SERVERFAULT;
@@ -3284,7 +3285,7 @@ nfs3_rename (rpcsvc_request_t *req, struct nfs3_fh *olddirfh, char *oldname,
* of the dest (fh,name) pair.
*/
cs->fh = *newdirfh;
- cs->pathname = strdup (newname);
+ cs->pathname = gf_strdup (newname);
if (!cs->pathname) {
stat = NFS3ERR_SERVERFAULT;
ret = -1;
@@ -3470,7 +3471,7 @@ nfs3_link (rpcsvc_request_t *req, struct nfs3_fh *targetfh,
nfs3_handle_call_state_init (nfs3, cs, req, vol, stat, nfs3err);
cs->fh = *dirfh;
- cs->pathname = strdup (newname);
+ cs->pathname = gf_strdup (newname);
if (!cs->pathname) {
stat = NFS3ERR_SERVERFAULT;
ret = -1;
@@ -4735,7 +4736,8 @@ nfs3_init_subvolumes (struct nfs3_state *nfs3, xlator_t *nfsx)
xl_list = xl_list->next;
}
- nfs3->exports = CALLOC (xl_count, sizeof (struct nfs3_export));
+ nfs3->exports = GF_CALLOC (xl_count, sizeof (struct nfs3_export),
+ gf_nfs_mt_nfs3_export);
if (!nfs3->exports) {
gf_log (GF_NFS3, GF_LOG_ERROR, "Memory allocation failed");
goto err;
@@ -4772,7 +4774,8 @@ nfs3_init_state (xlator_t *nfsx)
if (!nfsx)
return NULL;
- nfs3 = (struct nfs3_state *)CALLOC (1, sizeof (*nfs3));
+ nfs3 = (struct nfs3_state *)GF_CALLOC (1, sizeof (*nfs3),
+ gf_nfs_mt_nfs3_state);
if (!nfs3) {
gf_log (GF_NFS3, GF_LOG_ERROR, "Memory allocation failed");
return NULL;
@@ -4817,7 +4820,7 @@ free_localpool:
ret:
if (ret == -1) {
- FREE (nfs3);
+ GF_FREE (nfs3);
nfs3 = NULL;
}