From 6601576e141a78e22a8469e80c434ce05576379f Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 8 Sep 2009 23:40:25 +0000 Subject: booster: Enhance booster logging Signed-off-by: Anand V. Avati BUG: 210 (libglusterfsclient: Enhance logging) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=210 --- booster/src/booster_fstab.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'booster/src/booster_fstab.c') diff --git a/booster/src/booster_fstab.c b/booster/src/booster_fstab.c index 5f322acee..202249cad 100644 --- a/booster/src/booster_fstab.c +++ b/booster/src/booster_fstab.c @@ -25,6 +25,7 @@ #include "booster_fstab.h" #include #include +#include /* The default timeout for inode and stat cache. */ #define BOOSTER_DEFAULT_ATTR_TIMEO 5 /* In Secs */ @@ -36,13 +37,19 @@ glusterfs_fstab_init (const char *file, const char *mode) { glusterfs_fstab_t *handle = NULL; handle = calloc (1, sizeof (glusterfs_fstab_t)); - if (!handle) + if (!handle) { + gf_log ("booster-fstab", GF_LOG_ERROR, "Memory allocation" + " failed"); goto out; + } + gf_log ("booster-fstab", GF_LOG_DEBUG, "FSTAB file: %s", file); FILE *result = fopen (file,mode); if (result != NULL) { handle->fp = result; } else { + gf_log ("booster-fstab", GF_LOG_ERROR, "FSTAB file open failed:" + " %s", strerror (errno)); free (handle); handle = NULL; } @@ -372,8 +379,13 @@ booster_mount (struct glusterfs_mntent *ent) if (!ent) return; - if ((strcmp (ent->mnt_type, "glusterfs") != 0)) + gf_log ("booster-fstab", GF_LOG_DEBUG, "Mount entry: volfile: %s," + " VMP: %s, Type: %s, Options: %s", ent->mnt_fsname, + ent->mnt_dir, ent->mnt_type, ent->mnt_opts); + if ((strcmp (ent->mnt_type, "glusterfs") != 0)) { + gf_log ("booster-fstab", GF_LOG_ERROR, "Type is not glusterfs"); return; + } memset (&ipars, 0, sizeof (glusterfs_init_params_t)); if (ent->mnt_fsname) @@ -408,7 +420,9 @@ booster_mount (struct glusterfs_mntent *ent) ipars.lookup_timeout = timeout; ipars.stat_timeout = timeout; - glusterfs_mount (ent->mnt_dir, &ipars); + if ((glusterfs_mount (ent->mnt_dir, &ipars)) == -1) + gf_log ("booster-fstab", GF_LOG_ERROR, "VMP mounting failed"); + clean_init_params (&ipars); } -- cgit