Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757329Ab2KIA0E (ORCPT ); Thu, 8 Nov 2012 19:26:04 -0500 Received: from dupo.coraid.com ([208.71.232.133]:47581 "EHLO coraid.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752864Ab2KIA0C (ORCPT ); Thu, 8 Nov 2012 19:26:02 -0500 Message-Id: In-Reply-To: References: From: Ed Cashin Subject: [PATCH 5/8] aoe: manipulate aoedev network stats under lock To: Andrew Morton Cc: linux-kernel@vger.kernel.org, ecashin@coraid.com From: Ed Cashin X-Mailer: nedmail Date: Thu, 8 Nov 2012 19:25:17 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1381 Lines: 43 With this bugfix in place the calculation of the criterion for "lateness" is performed under lock. Without the lock, there is a chance that one of the non-atomic operations performed on the round trip time statistics could be incomplete, such that an incorrect lateness criterion would be calculated. Without this change, the effect of the bug would be rare unecessary but benign retransmissions. Signed-off-by: Ed Cashin --- drivers/block/aoe/aoecmd.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 6ea27fd..9aefbe3 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c @@ -603,14 +603,14 @@ rexmit_timer(ulong vp) d = (struct aoedev *) vp; + spin_lock_irqsave(&d->lock, flags); + /* timeout based on observed timings and variations */ timeout = 2 * d->rttavg >> RTTSCALE; timeout += 8 * d->rttdev >> RTTDSCALE; if (timeout == 0) timeout = 1; - spin_lock_irqsave(&d->lock, flags); - if (d->flags & DEVFL_TKILL) { spin_unlock_irqrestore(&d->lock, flags); return; -- 1.7.1 -- 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/