summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index e0e40b12da1..f4b760a53cb 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -172,6 +172,8 @@ posix_forget (xlator_t *this, inode_t *inode)
struct posix_private *priv_posix = NULL;
priv_posix = (struct posix_private *) this->private;
+ if (!priv_posix)
+ return 0;
ret = inode_ctx_del (inode, this, &ctx_uint);
if (!ctx_uint)
@@ -226,6 +228,7 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (loc, out);
+ VALIDATE_OR_GOTO (this->private, out);
priv = this->private;
@@ -1279,6 +1282,8 @@ posix_releasedir (xlator_t *this,
}
priv = this->private;
+ if (!priv)
+ goto out;
pthread_mutex_lock (&priv->janitor_lock);
{
@@ -2076,6 +2081,7 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
+ VALIDATE_OR_GOTO (this->private, out);
VALIDATE_OR_GOTO (loc, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
@@ -3819,6 +3825,8 @@ posix_release (xlator_t *this, fd_t *fd)
"pfd->dir is %p (not NULL) for file fd=%p",
pfd->dir, fd);
}
+ if (!priv)
+ goto out;
pthread_mutex_lock (&priv->janitor_lock);
{
@@ -4004,6 +4012,7 @@ posix_setxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
+ VALIDATE_OR_GOTO (this->private, out);
VALIDATE_OR_GOTO (loc, out);
VALIDATE_OR_GOTO (dict, out);
@@ -4584,6 +4593,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (loc, out);
+ VALIDATE_OR_GOTO (this->private, out);
SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_INODE_HANDLE (real_path, this, loc, NULL);
@@ -4691,6 +4701,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto done;
}
if (loc->inode && name && (XATTR_IS_PATHINFO (name))) {
+ VALIDATE_OR_GOTO (this->private, out);
if (LOC_HAS_ABSPATH (loc))
MAKE_REAL_PATH (rpath, this, loc->path);
else
@@ -6943,9 +6954,6 @@ notify (xlator_t *this,
void *data,
...)
{
- struct posix_private *priv = NULL;
-
- priv = this->private;
switch (event)
{
case GF_EVENT_PARENT_UP:
@@ -6954,26 +6962,6 @@ notify (xlator_t *this,
default_notify (this, GF_EVENT_CHILD_UP, data);
}
break;
- case GF_EVENT_CLEANUP:
- if (priv->health_check) {
- priv->health_check_active = _gf_false;
- pthread_cancel (priv->health_check);
- priv->health_check = 0;
- }
- if (priv->janitor) {
- (void) gf_thread_cleanup_xint (priv->janitor);
- priv->janitor = 0;
- }
- if (priv->fsyncer) {
- (void) gf_thread_cleanup_xint (priv->fsyncer);
- priv->fsyncer = 0;
- }
- if (priv->mount_lock) {
- (void) sys_closedir (priv->mount_lock);
- priv->mount_lock = NULL;
- }
-
- break;
default:
/* */
break;
@@ -7825,10 +7813,31 @@ fini (xlator_t *this)
if (!priv)
return;
this->private = NULL;
+ if (priv->health_check) {
+ priv->health_check_active = _gf_false;
+ pthread_cancel (priv->health_check);
+ priv->health_check = 0;
+ }
+ if (priv->janitor) {
+ (void) gf_thread_cleanup_xint (priv->janitor);
+ priv->janitor = 0;
+ }
+ if (priv->fsyncer) {
+ (void) gf_thread_cleanup_xint (priv->fsyncer);
+ priv->fsyncer = 0;
+ }
/*unlock brick dir*/
if (priv->mount_lock)
(void) sys_closedir (priv->mount_lock);
+
+ GF_FREE (priv->base_path);
+ LOCK_DESTROY (&priv->lock);
+ pthread_mutex_destroy (&priv->janitor_lock);
+ pthread_mutex_destroy (&priv->fsync_mutex);
+ GF_FREE (priv->hostname);
+ GF_FREE (priv->trash_path);
GF_FREE (priv);
+
return;
}
struct xlator_dumpops dumpops = {