X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Ffd-tracker%2Finode.c;h=16dd49a6ff2c95230efd1aba28fe2788d11c5722;hb=640b9481e1805d314256361ed49d55dcc35d6172;hp=0e1ebc6ff5dc51b2fe93ea7208c13ac17f5136c6;hpb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;p=lttng-tools.git diff --git a/src/common/fd-tracker/inode.c b/src/common/fd-tracker/inode.c index 0e1ebc6ff..16dd49a6f 100644 --- a/src/common/fd-tracker/inode.c +++ b/src/common/fd-tracker/inode.c @@ -133,6 +133,12 @@ static int lttng_unlinked_file_pool_add_inode( } pool->unlink_directory_handle = lttng_directory_handle_create( pool->unlink_directory_path); + if (!pool->unlink_directory_handle) { + ERR("Failed to create directory handle to unlinked file pool at %s", + pool->unlink_directory_path); + ret = -1; + goto end; + } } ret = lttng_directory_handle_rename(inode->location.directory_handle, @@ -280,7 +286,19 @@ void lttng_inode_put(struct lttng_inode *inode) urcu_ref_put(&inode->ref, lttng_inode_release); } -void lttng_inode_get_location(struct lttng_inode *inode, +struct lttng_directory_handle *lttng_inode_get_location_directory_handle( + struct lttng_inode *inode) +{ + if (inode->location.directory_handle) { + const bool reference_acquired = lttng_directory_handle_get( + inode->location.directory_handle); + + assert(reference_acquired); + } + return inode->location.directory_handle; +} + +void lttng_inode_borrow_location(struct lttng_inode *inode, const struct lttng_directory_handle **out_directory_handle, const char **out_path) { @@ -504,6 +522,10 @@ struct lttng_inode *lttng_inode_registry_get_inode( inode = lttng_inode_create(&id, registry->inodes, unlinked_file_pool, handle, path); + if (!inode) { + goto end_unlock; + } + node = cds_lfht_add_unique(registry->inodes, lttng_inode_id_hash(&inode->id), lttng_inode_match, &inode->id, &inode->registry_node);