summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix-common.c50
-rw-r--r--xlators/storage/posix/src/posix-entry-ops.c2
-rw-r--r--xlators/storage/posix/src/posix-helpers.c3
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c15
-rw-r--r--xlators/storage/posix/src/posix-inode-handle.h6
5 files changed, 32 insertions, 44 deletions
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
index 64ab34c15c0..41c2d093090 100644
--- a/xlators/storage/posix/src/posix-common.c
+++ b/xlators/storage/posix/src/posix-common.c
@@ -105,7 +105,6 @@ extern char *marker_xattrs[];
(lutimes (path, tv))
#endif
-
int32_t
posix_priv (xlator_t *this)
{
@@ -148,6 +147,9 @@ posix_notify (xlator_t *this,
void *data,
...)
{
+ struct posix_private *priv = NULL;
+
+ priv = this->private;
switch (event)
{
case GF_EVENT_PARENT_UP:
@@ -156,6 +158,31 @@ posix_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->disk_space_check) {
+ priv->disk_space_check_active = _gf_false;
+ pthread_cancel (priv->disk_space_check);
+ priv->disk_space_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;
@@ -1111,32 +1138,11 @@ posix_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->disk_space_check) {
- priv->disk_space_check_active = _gf_false;
- pthread_cancel (priv->disk_space_check);
- priv->disk_space_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);
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c
index 1058339855b..519b6f3f040 100644
--- a/xlators/storage/posix/src/posix-entry-ops.c
+++ b/xlators/storage/posix/src/posix-entry-ops.c
@@ -169,7 +169,6 @@ 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;
@@ -1066,7 +1065,6 @@ 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);
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 022f8b21571..c87f4f59b82 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -2165,7 +2165,7 @@ abort:
trav_p = &(*trav_p)->next) {
victim = (*trav_p)->xlator;
if (victim &&
- strcmp (victim->name, priv->base_path) == 0) {
+ strcmp (victim->name, priv->base_path) == 0) {
victim_found = _gf_true;
break;
}
@@ -2175,7 +2175,6 @@ abort:
gf_log (THIS->name, GF_LOG_INFO, "detaching not-only "
" child %s", priv->base_path);
top->notify (top, GF_EVENT_CLEANUP, victim);
- xlator_mem_cleanup (victim);
}
}
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 2e5b7c5772a..bf7e87dc91b 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -1200,8 +1200,6 @@ posix_releasedir (xlator_t *this,
}
priv = this->private;
- if (!priv)
- goto out;
pthread_mutex_lock (&priv->janitor_lock);
{
@@ -2004,8 +2002,6 @@ 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);
{
@@ -2200,7 +2196,6 @@ 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);
@@ -2903,7 +2898,6 @@ 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);
@@ -3031,12 +3025,11 @@ 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)) {
+ if (LOC_HAS_ABSPATH (loc))
MAKE_REAL_PATH (rpath, this, loc->path);
- } else {
+ else
rpath = real_path;
- }
+
size = gf_asprintf (&host_buf, "<POSIX(%s):%s:%s>",
priv->base_path,
((priv->node_uuid_pathinfo &&
@@ -5356,8 +5349,6 @@ 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)
diff --git a/xlators/storage/posix/src/posix-inode-handle.h b/xlators/storage/posix/src/posix-inode-handle.h
index 33d908fa3de..1dcabf2ffb2 100644
--- a/xlators/storage/posix/src/posix-inode-handle.h
+++ b/xlators/storage/posix/src/posix-inode-handle.h
@@ -55,12 +55,6 @@
} while (0)
#define MAKE_INODE_HANDLE(rpath, this, loc, iatt_p) do { \
- if (!this->private) { \
- gf_msg ("make_inode_handle", GF_LOG_ERROR, 0, \
- P_MSG_INODE_HANDLE_CREATE, \
- "private is NULL, fini is already called"); \
- break; \
- } \
if (gf_uuid_is_null (loc->gfid)) { \
gf_msg (this->name, GF_LOG_ERROR, 0, \
P_MSG_INODE_HANDLE_CREATE, \