From: Tom Peng Date: Wed, 1 Jul 2009 12:37:26 +0000 (+0800) Subject: SCSI: libsas: reuse the original port when hotplugging phys in wide ports X-Git-Tag: v2.6.27.30~24 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25029e626276e1dc5dd58436d230b84b49a38e71;p=pandora-kernel.git SCSI: libsas: reuse the original port when hotplugging phys in wide ports commit 5381837f125cc62ad703fbcdfcd7566fc81fd404 upstream. There's a hotplug problem in the way libsas allocates ports: it loops over the available ports first trying to add to an existing for a wide port and otherwise allocating the next free port. This scheme only works if the port array is packed from zero, which fails if a port gets hot unplugged and the array becomes sparse. In that case, a new port is formed even if there's a wide port it should be part of. Fix this by creating two loops over all the ports: the first to see if the phy should be part of a wide port and the second to form a new port in an empty port slot. Signed-off-by: Tom Peng Signed-off-by: Jack Wang Signed-off-by: Lindar Liu Signed-off-by: James Bottomley Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed