From: Josh Boyer Date: Tue, 6 Dec 2005 17:28:19 +0000 (+0000) Subject: CHIPS: Fix potential starvation in cfi_cmdset_0001 X-Git-Tag: v2.6.18-rc1~1105^2~93 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df54b52c411befdcf1d0989f939a49163570ad29;p=linux-2.6 CHIPS: Fix potential starvation in cfi_cmdset_0001 The patch below fixes a potential starvation issue that can arise when there is contention on a chip during a period when a process is currently writing to it. The starvation is avoided by conditionally rescheduling when the chip is left in a state usable by other processes. Signed-off-by: Josh Boyer Signed-off-by: Tom Gall Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 898c321ab8..e797752f7c 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c @@ -1691,6 +1691,11 @@ static int cfi_intelext_writev (struct mtd_info *mtd, const struct kvec *vecs, if (chipnum == cfi->numchips) return 0; } + + /* Be nice and reschedule with the chip in a usable state for other + processes. */ + cond_resched(); + } while (len); return 0;