cxlflash: Fix to avoid invalid port_sel value
cxlflash: Fix to avoid invalid port_sel value

If two concurrent MANAGE_LUN ioctls are issued with the same
WWID parameter, it would result in an incorrect value of port_sel.

This is because port_sel is modified without any locks being
held. If the first caller stalls after the return from
find_and_create_lun(), the value of port_sel will be set
incorrectly to indicate a single port, though in this case
it should have been set to both ports.

To fix, use the global mutex to serialize the lookup of the
WWID and the subsequent modification of port_sel.

Signed-off-by: Matthew R. Ochs <5279806d22638a7ca4d6f7841541587adc5832b0@linux.vnet.ibm.com>
Signed-off-by: Manoj N. Kumar <e5bed78df35c9a68cd0ebc89592def76df34c305@linux.vnet.ibm.com>
Reviewed-by: Brian King <bf668d4b220231d97fe248d4ae0ba63a1d887e4c@linux.vnet.ibm.com>
Reviewed-by: Tomas Henzl <ed03cdd404c1c501a81ee6cc756c3c81b1d33f83@redhat.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Odin.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs