diff options
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/fd.c | 42 | ||||
-rw-r--r-- | libglusterfs/src/fd.h | 1 | ||||
-rw-r--r-- | libglusterfs/src/inode.c | 33 | ||||
-rw-r--r-- | libglusterfs/src/inode.h | 1 | ||||
-rw-r--r-- | libglusterfs/src/xlator.c | 10 |
5 files changed, 16 insertions, 71 deletions
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index a5a63ebaadd..8f7616929c2 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -382,7 +382,6 @@ _fd_unref (fd_t *fd) static void fd_destroy (fd_t *fd) { - data_pair_t *pair = NULL; xlator_t *xl = NULL; int i = 0; @@ -399,26 +398,6 @@ fd_destroy (fd_t *fd) goto out; if (S_ISDIR (fd->inode->st_mode)) { - for (pair = fd->ctx->members_list; pair; pair = pair->next) { - /* notify all xlators which have a context */ - xl = xlator_search_by_name (fd->inode->table->xl, - pair->key); - - if (!xl) { - gf_log ("fd", GF_LOG_CRITICAL, - "fd(%p)->ctx has invalid key(%s)", - fd, pair->key); - continue; - } - if (xl->cbks->releasedir) { - xl->cbks->releasedir (xl, fd); - } else { - gf_log ("fd", GF_LOG_CRITICAL, - "xlator(%s) in fd(%p) no RELEASE cbk", - xl->name, fd); - } - - } for (i = 0; i < fd->inode->table->xl->ctx->xl_count; i++) { if (fd->_ctx[i].key) { xl = (xlator_t *)(long)fd->_ctx[i].key; @@ -427,25 +406,6 @@ fd_destroy (fd_t *fd) } } } else { - for (pair = fd->ctx->members_list; pair; pair = pair->next) { - /* notify all xlators which have a context */ - xl = xlator_search_by_name (fd->inode->table->xl, - pair->key); - - if (!xl) { - gf_log ("fd", GF_LOG_CRITICAL, - "fd(%p)->ctx has invalid key(%s)", - fd, pair->key); - continue; - } - if (xl->cbks->release) { - xl->cbks->release (xl, fd); - } else { - gf_log ("fd", GF_LOG_CRITICAL, - "xlator(%s) in fd(%p) no RELEASE cbk", - xl->name, fd); - } - } for (i = 0; i < fd->inode->table->xl->ctx->xl_count; i++) { if (fd->_ctx[i].key) { xl = (xlator_t *)(long)fd->_ctx[i].key; @@ -460,7 +420,6 @@ fd_destroy (fd_t *fd) FREE (fd->_ctx); inode_unref (fd->inode); fd->inode = (inode_t *)0xaaaaaaaa; - dict_destroy (fd->ctx); FREE (fd); out: @@ -525,7 +484,6 @@ fd_create (inode_t *inode, pid_t pid) fd->_ctx = CALLOC (1, (sizeof (struct _fd_ctx) * inode->table->xl->ctx->xl_count)); - fd->ctx = get_new_dict (); fd->inode = inode_ref (inode); fd->pid = pid; INIT_LIST_HEAD (&fd->inode_list); diff --git a/libglusterfs/src/fd.h b/libglusterfs/src/fd.h index 298b1b34765..1770658e820 100644 --- a/libglusterfs/src/fd.h +++ b/libglusterfs/src/fd.h @@ -48,7 +48,6 @@ struct _fd { int32_t refcount; struct list_head inode_list; struct _inode *inode; - struct _dict *ctx; gf_lock_t lock; /* used ONLY for manipulating 'struct _fd_ctx' array (_ctx).*/ struct _fd_ctx *_ctx; diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index b0c9abd980c..858f7e14d93 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -235,32 +235,8 @@ static void __inode_destroy (inode_t *inode) { int index = 0; - data_pair_t *pair = NULL; xlator_t *xl = NULL; - if (!inode->ctx) { - goto noctx; - } - for (pair = inode->ctx->members_list; pair; pair = pair->next) { - /* notify all xlators which have a context */ - xl = xlator_search_by_name (inode->table->xl, pair->key); - - if (!xl) { - gf_log (inode->table->name, GF_LOG_DEBUG, - "inode(%"PRId64")->ctx has invalid key(%s)", - inode->ino, pair->key); - continue; - } - - if (xl->cbks->forget) - xl->cbks->forget (xl, inode); - else - gf_log (inode->table->name, GF_LOG_DEBUG, - "xlator(%s) in inode(%"PRId64") no FORGET fop", - xl->name, inode->ino); - } - dict_destroy (inode->ctx); - if (!inode->_ctx) goto noctx; @@ -450,8 +426,6 @@ __inode_create (inode_table_t *table) newi->_ctx = CALLOC (1, (sizeof (struct _inode_ctx) * table->xl->ctx->xl_count)); - newi->ctx = get_new_dict (); - return newi; } @@ -859,6 +833,13 @@ inode_path (inode_t *inode, trav = __dentry_search_arbit (trav->parent)) { i ++; /* "/" */ i += strlen (trav->name); + if (i > PATH_MAX) { + gf_log ("inode", GF_LOG_CRITICAL, + "possible infinite loop detected, " + "forcing break. name=(%s)", name); + ret = -ENOENT; + goto unlock; + } } if ((inode->ino != 1) && diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h index 8800b9767b5..e71c6d899f5 100644 --- a/libglusterfs/src/inode.h +++ b/libglusterfs/src/inode.h @@ -83,7 +83,6 @@ struct _inode { uint64_t generation; uint32_t ref; /* reference count on this inode */ ino_t ino; /* inode number in the storage (persistent) */ - dict_t *ctx; /* per xlator private */ mode_t st_mode; /* what kind of file */ struct list_head fd_list; /* list of open files on this inode */ struct list_head dentry_list; /* list of directory entries for this inode */ diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 6f5da84b4c0..351e2434467 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -247,7 +247,15 @@ _volume_option_value_validate (xlator_t *xl, switch (opt->type) { case GF_OPTION_TYPE_PATH: { - /* Make sure the given path is valid */ + if (strstr (pair->value->data, "../")) { + gf_log (xl->name, GF_LOG_ERROR, + "invalid path given '%s'", + pair->value->data); + ret = -1; + goto out; + } + + /* Make sure the given path is valid */ if (pair->value->data[0] != '/') { gf_log (xl->name, GF_LOG_WARNING, "option %s %s: '%s' is not an " |