Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932119AbbBTSNF (ORCPT ); Fri, 20 Feb 2015 13:13:05 -0500 Received: from mailrelay107.isp.belgacom.be ([195.238.20.134]:8602 "EHLO mailrelay107.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754496AbbBTSND (ORCPT ); Fri, 20 Feb 2015 13:13:03 -0500 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=pojTLeLEEG+IB9MeyQ9xnWKWJHiyH+4Hnj5iAYu/pCk= c=1 sm=2 a=OvlnMgQnomWz5QXtcfIA:9 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BcDAAReOdU/zwEtFtbgwaxPwsFAXaXTYEaRAEBAQEBAXyEPS8jgRo3iDMBwiiSe4YEiXkdhBUFmRGKbIhFIoFFATwcgVE9MYJDAQEB From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Greg Kroah-Hartman , Fabian Frederick Subject: [PATCH 1/7 linux-next] swim: replace current->state by set_current_state() Date: Fri, 20 Feb 2015 19:12:51 +0100 Message-Id: <1424455977-21903-1-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 2.1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1553 Lines: 49 Use helper function to access current->state. Direct assignments are prone to races and therefore buggy. Thanks to Peter Zijlstra for the exact definition of the problem. Signed-off-by: Fabian Frederick --- drivers/block/swim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/block/swim.c b/drivers/block/swim.c index b5afd49..e9bb759 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -331,7 +331,7 @@ static inline void swim_motor(struct swim __iomem *base, swim_select(base, RELAX); if (swim_readbit(base, MOTOR_ON)) break; - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); } } else if (action == OFF) { @@ -350,7 +350,7 @@ static inline void swim_eject(struct swim __iomem *base) swim_select(base, RELAX); if (!swim_readbit(base, DISK_IN)) break; - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); } swim_select(base, RELAX); @@ -374,7 +374,7 @@ static inline int swim_step(struct swim __iomem *base) for (wait = 0; wait < HZ; wait++) { - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); swim_select(base, RELAX); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/