s390/mm: fix races on gmap_shadow creation
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Tue, 8 Mar 2016 11:30:46 +0000 (12:30 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 20 Jun 2016 07:54:28 +0000 (09:54 +0200)
commit0f7f84891516dc1ff7500fae12143710d2d9d11f
treeae5185ba98c655404b8f5ee9e46060824fb08cba
parent998f637cc4b9ef3fa32b196294a3136ee05271a2
s390/mm: fix races on gmap_shadow creation

Before any thread is allowed to use a gmap_shadow, it has to be fully
initialized. However, for invalidation to work properly, we have to
register the new gmap_shadow before we protect the parent gmap table.

Because locking is tricky, and we have to avoid duplicate gmaps, let's
introduce an initialized field, that signalizes other threads if that
gmap_shadow can already be used or if they have to retry.

Let's properly return errors using ERR_PTR() instead of simply returning
NULL, so a caller can properly react on the error.

Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/include/asm/gmap.h
arch/s390/mm/gmap.c