nsssrv_mmap_cache.c revision 8b7040df8bcfee8cb31903136562eea73232f3d0
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce NSS Responder - Mmap Cache
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce Copyright (C) Simo Sorce <ssorce@redhat.com> 2011
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce This program is free software; you can redistribute it and/or modify
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce it under the terms of the GNU General Public License as published by
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce the Free Software Foundation; either version 3 of the License, or
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce (at your option) any later version.
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce This program is distributed in the hope that it will be useful,
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce but WITHOUT ANY WARRANTY; without even the implied warranty of
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce GNU General Public License for more details.
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce You should have received a copy of the GNU General Public License
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce along with this program. If not, see <http://www.gnu.org/licenses/>.
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce/* arbitrary (avg of my /etc/passwd) */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce/* short group name and no gids (private user group */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce#define MC_NEXT_BARRIER(val) ((((val) + 1) & 0x00ffffff) | 0xf0000000)
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce#define MC_RAISE_BARRIER(m) do { \
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce#define MC_LOWER_BARRIER(m) do { \
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce uint32_t seed; /* pseudo-random seed to avoid collision attacks */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce time_t valid_time_slot; /* maximum time the entry is valid in seconds */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce uint32_t *hash_table; /* hash table address (in mmap) */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce uint32_t next_slot; /* the next slot after last allocation */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce uint8_t *data_table; /* data table address (in mmap) */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce if (*b & c) used = true; \
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce else used = false; \
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorcestatic uint32_t sss_mc_hash(struct sss_mc_ctx *mcc,
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce return murmurhash3(key, len, mcc->seed) % MC_HT_ELEMS(mcc->ht_size);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorcestatic void sss_mc_add_rec_to_chain(struct sss_mc_ctx *mcc,
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* no previous record/collision, just add to hash table */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce mcc->hash_table[hash] = MC_PTR_TO_SLOT(mcc->data_table, rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce cur = MC_SLOT_TO_PTR(mcc->data_table, slot, struct sss_mc_rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* rec already stored in hash chain */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* end of chain, append our record here */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* changing a single uint32_t is atomic, so there is no
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce * need to use barriers in this case */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce cur->next = MC_PTR_TO_SLOT(mcc->data_table, rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorcestatic void sss_mc_rm_rec_from_chain(struct sss_mc_ctx *mcc,
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce cur = MC_SLOT_TO_PTR(mcc->data_table, slot, struct sss_mc_rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce cur = MC_SLOT_TO_PTR(mcc->data_table, slot, struct sss_mc_rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* changing a single uint32_t is atomic, so there is no
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce * need to use barriers in this case */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorcestatic void sss_mc_invalidate_rec(struct sss_mc_ctx *mcc,
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* record already invalid */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* hash chain 1 */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* hash chain 2 */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce memset(rec->data, 'X', rec->len - sizeof(struct sss_mc_rec));
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce/* FIXME: This is a very simplistic, inefficient, memory allocator,
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce * it will just free the oldest entries regardless of expiration if it
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce * cycled the whole freebits map and found no empty slot */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorcestatic int sss_mc_find_free_slots(struct sss_mc_ctx *mcc, int num_slots)
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* Try to find a free slot w/o removing a nything first */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* FIXME: is it really worth it ? May be it is easier to
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce * just recycle the next set of slots ? */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* search for enough (num_slots) consecutive zero bits, indicating
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce * consecutive empty slots */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* if all full in this byte skip directly to the next */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* at least one bit in this byte is marked as empty */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce if (!used) break;
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* check if we have enough slots before hitting the table end */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* check if we have at least num_slots empty starting from the first
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce * we found in the previous steps */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* ok found num_slots consecutive free bits */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* no free slots found, free occupied slots after next_slot */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce for (i = 0; i < num_slots; i++) {
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce if (!used) continue;
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce rec = MC_SLOT_TO_PTR(mcc->data_table, cur + i, struct sss_mc_rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce for (t = i + MC_SIZE_TO_SLOTS(rec->len); i < t; i++) {
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorcestatic struct sss_mc_rec *sss_mc_find_record(struct sss_mc_ctx *mcc,
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce rec = MC_SLOT_TO_PTR(mcc->data_table, slot, struct sss_mc_rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorcestatic struct sss_mc_rec *sss_mc_get_record(struct sss_mc_ctx *mcc,
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* slot size changed, invalidate record and fall through to get a
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce * fully new record */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce base_slot = MC_PTR_TO_SLOT(mcc->data_table, old_rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* and now free slots */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce for (i = 0; i < old_slots; i++) {
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* we are going to use more space, find enough free slots */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce base_slot = sss_mc_find_free_slots(mcc, num_slots);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce rec = MC_SLOT_TO_PTR(mcc->data_table, base_slot, struct sss_mc_rec);
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* mark as not valid yet */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce /* and now mark slots as used */
24451a6231ea0b7fd0e98a9931e8254aa17bf4cfSimo Sorce for (i = 0; i < num_slots; i++) {
b294d4c50ec4431bc07ad7ec5a73e8af0e53c54fSimo Sorcestatic inline void sss_mmap_set_rec_header(struct sss_mc_ctx *mcc,
b294d4c50ec4431bc07ad7ec5a73e8af0e53c54fSimo Sorcestatic inline void sss_mmap_chain_in_rec(struct sss_mc_ctx *mcc,
b294d4c50ec4431bc07ad7ec5a73e8af0e53c54fSimo Sorce /* name first */
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce/***************************************************************************
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce * generic invalidation
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce ***************************************************************************/
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorcestatic errno_t sss_mmap_cache_invalidate(struct sss_mc_ctx *mcc,
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce /* nothing to invalidate */
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce/***************************************************************************
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce * passwd map
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce ***************************************************************************/
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorceerrno_t sss_mmap_cache_pw_store(struct sss_mc_ctx *mcc,
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce data_len = name->len + pw->len + gecos->len + homedir->len + shell->len;
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce sizeof(struct sss_mc_pwd_data) +
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce /* header */
b294d4c50ec4431bc07ad7ec5a73e8af0e53c54fSimo Sorce sss_mmap_set_rec_header(mcc, rec, rec_len, mcc->valid_time_slot,
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce /* passwd struct */
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce memcpy(&data->strs[pos], gecos->str, gecos->len);
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce memcpy(&data->strs[pos], homedir->str, homedir->len);
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce memcpy(&data->strs[pos], shell->str, shell->len);
6cb1a6e7c7517ab4ccb8ad37ade86f95b5c16a01Simo Sorce /* finally chain the rec in the hash table */
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorceerrno_t sss_mmap_cache_pw_invalidate(struct sss_mc_ctx *mcc,
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorceerrno_t sss_mmap_cache_pw_invalidate_uid(struct sss_mc_ctx *mcc, uid_t uid)
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce uidstr = talloc_asprintf(NULL, "%ld", (long)uid);
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce hash = sss_mc_hash(mcc, uidstr, strlen(uidstr) + 1);
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce rec = MC_SLOT_TO_PTR(mcc->data_table, slot, struct sss_mc_rec);
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce/***************************************************************************
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce ***************************************************************************/
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorceint sss_mmap_cache_gr_store(struct sss_mc_ctx *mcc,
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce sizeof(struct sss_mc_grp_data) +
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce /* header */
b294d4c50ec4431bc07ad7ec5a73e8af0e53c54fSimo Sorce sss_mmap_set_rec_header(mcc, rec, rec_len, mcc->valid_time_slot,
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce /* group struct */
c3ef027218fe9a7d16a70ca9d2f53e3d995e369fSimo Sorce /* finally chain the rec in the hash table */
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorceerrno_t sss_mmap_cache_gr_invalidate(struct sss_mc_ctx *mcc,
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorceerrno_t sss_mmap_cache_gr_invalidate_gid(struct sss_mc_ctx *mcc, gid_t gid)
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce gidstr = talloc_asprintf(NULL, "%ld", (long)gid);
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce hash = sss_mc_hash(mcc, gidstr, strlen(gidstr) + 1);
8088274b2389b76f4be581736e55f26a8322fad1Simo Sorce rec = MC_SLOT_TO_PTR(mcc->data_table, slot, struct sss_mc_rec);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce/***************************************************************************
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce * initialization
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce ***************************************************************************/
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* What do we do now ? */
9d7d4458d94d0aac0a7edf999368eb18f89cb76aJakub Hrozek ret = sss_atomic_write_s(fd, (uint8_t *)&w, sizeof(h.status));
9d7d4458d94d0aac0a7edf999368eb18f89cb76aJakub Hrozek /* Write error */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce * When we (re)create a new file we must mark the current file as recycled
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce * so active clients will abandon its use asap.
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce * We unlink the current file and make a new one
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorcestatic errno_t sss_mc_create_file(struct sss_mc_ctx *mc_ctx)
33cbb789ff71be5dccbb4a0acd68814b0d53da34Michal Zidek DEBUG(SSSDBG_FATAL_FAILURE, ("Failed to mark mmap file %s as"
33cbb789ff71be5dccbb4a0acd68814b0d53da34Michal Zidek " recycled: %d(%s)\n",
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce DEBUG(SSSDBG_TRACE_FUNC, ("Failed to rm mmap file %s: %d(%s)\n",
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* temporarily relax umask as we need the file to be readable
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce * by everyone for now */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce mc_ctx->fd = open(mc_ctx->file, O_CREAT | O_EXCL | O_RDWR, 0644);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to open mmap file %s: %d(%s)\n",
33cbb789ff71be5dccbb4a0acd68814b0d53da34Michal Zidek ret = sss_br_lock_file(mc_ctx->fd, 0, 1, retries, t);
8b7040df8bcfee8cb31903136562eea73232f3d0Jakub Hrozek /* Report on unlink failures but don't overwrite the errno
8b7040df8bcfee8cb31903136562eea73232f3d0Jakub Hrozek * from sss_br_lock_file
8b7040df8bcfee8cb31903136562eea73232f3d0Jakub Hrozek DEBUG(SSSDBG_TRACE_FUNC, ("Failed to rm mmap file %s: %d(%s)\n",
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorcestatic void sss_mc_header_update(struct sss_mc_ctx *mc_ctx, int status)
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* update header using barriers */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* no reason to update anything else if the file is recycled */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce h->hash_table = MC_PTR_DIFF(mc_ctx->hash_table, mc_ctx->mmap_base);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce h->free_table = MC_PTR_DIFF(mc_ctx->free_table, mc_ctx->mmap_base);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce h->data_table = MC_PTR_DIFF(mc_ctx->data_table, mc_ctx->mmap_base);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorceerrno_t sss_mmap_cache_init(TALLOC_CTX *mem_ctx, const char *name,
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce unsigned int rseed;
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce mc_ctx = talloc_zero(mem_ctx, struct sss_mc_ctx);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* elements must always be multiple of 8 to make things easier to handle,
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce * so we increase by the necessary amount if they are not a multiple */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* We can use MC_ALIGN64 for this */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* hash table is double the size because it will store both forward and
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce * reverse keys (name/uid, name/gid, ..) */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* for now ALWAYS create a new file on restart */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to resize file %s: %d(%s)\n",
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce mc_ctx->mmap_base = mmap(NULL, mc_ctx->mmap_size,
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to mmap file %s(%ld): %d(%s)\n",
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce mc_ctx->data_table = MC_PTR_ADD(mc_ctx->mmap_base, MC_HEADER_SIZE);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce mc_ctx->free_table = MC_PTR_ADD(mc_ctx->data_table,
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce mc_ctx->hash_table = MC_PTR_ADD(mc_ctx->free_table,
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce memset(mc_ctx->data_table, 0x00, mc_ctx->dt_size);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce memset(mc_ctx->free_table, 0x00, mc_ctx->ft_size);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce memset(mc_ctx->hash_table, 0xff, mc_ctx->ht_size);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce /* generate a pseudo-random seed.
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce * Needed to fend off dictionary based collision attacks */
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce sss_mc_header_update(mc_ctx, SSS_MC_HEADER_ALIVE);
eb2e21b764d03544d8161e9956d7f70b07b75f77Simo Sorce DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to rm mmap file %s: %d(%s)\n",
99c99e557020775714f028b28a147edda290c783Michal Zidekerrno_t sss_mmap_cache_reinit(TALLOC_CTX *mem_ctx, size_t n_elem,
99c99e557020775714f028b28a147edda290c783Michal Zidek ("Unable to re-init unitialized memory cache.\n"));
99c99e557020775714f028b28a147edda290c783Michal Zidek DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory.\n"));
99c99e557020775714f028b28a147edda290c783Michal Zidek name = talloc_strdup(tmp_ctx, (*mc_ctx)->name);
99c99e557020775714f028b28a147edda290c783Michal Zidek DEBUG(SSSDBG_CRIT_FAILURE, ("Out of memory.\n"));
99c99e557020775714f028b28a147edda290c783Michal Zidek /* This can happen only if destructor is associated with this
99c99e557020775714f028b28a147edda290c783Michal Zidek * context */
99c99e557020775714f028b28a147edda290c783Michal Zidek DEBUG(SSSDBG_MINOR_FAILURE, ("Destructor asociated with memory"
99c99e557020775714f028b28a147edda290c783Michal Zidek " context failed.\n"));
99c99e557020775714f028b28a147edda290c783Michal Zidek ret = sss_mmap_cache_init(mem_ctx, name, type, n_elem, timeout, mc_ctx);
99c99e557020775714f028b28a147edda290c783Michal Zidek DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to re-initialize mmap cache.\n"));