1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Reorder mm bounds_check code to reduce window for a dmeventd race. (dm_free_aux)

This commit is contained in:
Alasdair Kergon 2006-09-19 17:30:04 +00:00
parent bbb068562e
commit 6fb265fa3b

View File

@ -135,12 +135,6 @@ void dm_free_aux(void *p)
/* have we freed this before ? */ /* have we freed this before ? */
assert(mb->id != 0); assert(mb->id != 0);
mb->id = 0;
/* stomp a different pattern across the memory */
ptr = ((char *) mb) + sizeof(struct memblock);
for (i = 0; i < mb->length; i++)
*ptr++ = i & 1 ? (char) 0xde : (char) 0xad;
/* unlink */ /* unlink */
if (mb->prev) if (mb->prev)
@ -153,6 +147,13 @@ void dm_free_aux(void *p)
else else
_tail = mb->prev; _tail = mb->prev;
mb->id = 0;
/* stomp a different pattern across the memory */
ptr = ((char *) mb) + sizeof(struct memblock);
for (i = 0; i < mb->length; i++)
*ptr++ = i & 1 ? (char) 0xde : (char) 0xad;
assert(_mem_stats.blocks_allocated); assert(_mem_stats.blocks_allocated);
_mem_stats.blocks_allocated--; _mem_stats.blocks_allocated--;
_mem_stats.bytes -= mb->length; _mem_stats.bytes -= mb->length;