On Tue, 2012-01-03 at 18:00 -0500, Simo Sorce wrote:
>From [PATCH 0/0] A shared memory cache to perform better:
0/4: Actual memory cache implementation
These is the bulk of the work, these patches are still a bit rough at
the edges, grep for FIXMEs and TODOs and you'll see some plumbing (for
example configure options in sssd to set expiration time and cache sizes
are missing and are still harcoded).
Patch 0008: Ack
Patch 0009: Nack
As the fixmes say, please parameterize the cache sizes and timeout
period.
You have a time-of-check/time-of-use bug with the stat of mc_ctx->file.
Please open it first and then use fstat() instead, to avoid a
race-condition exploit.
Please use errno_t for the return code of functions that return errno
values.
I think the check_header pieces are unnecessary. When the NSS provider
is started, it should always remove an existing fast cache. This will
make the behavior better match users' expectations.
Don't use ftruncate() to generate the cache file. It's not safe on all
platforms or filesystems. Probably better to use fseek() (even though
it's a bit slower. It's a rare operation).
I will review the other patches tomorrow.