From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764598AbXGUTDj (ORCPT ); Sat, 21 Jul 2007 15:03:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759534AbXGUTDM (ORCPT ); Sat, 21 Jul 2007 15:03:12 -0400 Received: from smtp2.linux-foundation.org ([207.189.120.14]:36477 "EHLO smtp2.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763853AbXGUTDJ (ORCPT ); Sat, 21 Jul 2007 15:03:09 -0400 Date: Sat, 21 Jul 2007 12:02:35 -0700 From: Andrew Morton To: Oleg Nesterov Cc: Arnaldo Carvalho de Melo , Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] fix theoretical ccids_{read,write}_lock() race Message-Id: <20070721120235.7505338a.akpm@linux-foundation.org> In-Reply-To: <20070721150206.GA1083@tv-sign.ru> References: <20070721115712.GA871@tv-sign.ru> <20070721123159.GB1769@elte.hu> <20070721141814.GA1013@tv-sign.ru> <20070721150206.GA1083@tv-sign.ru> X-Mailer: Sylpheed 2.4.1 (GTK+ 2.8.17; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 21 Jul 2007 19:02:06 +0400 Oleg Nesterov wrote: > Make sure that spin_unlock_wait() is properly ordered wrt atomic_inc(). > > Signed-off-by: Oleg Nesterov > > --- t/net/dccp/ccid.c~ccid 2006-12-18 18:17:31.000000000 +0300 > +++ t/net/dccp/ccid.c 2007-07-21 18:29:21.000000000 +0400 > @@ -40,6 +40,7 @@ static inline void ccids_write_unlock(vo > static inline void ccids_read_lock(void) > { > atomic_inc(&ccids_lockct); > + smp_mb__after_atomic_inc(); > spin_unlock_wait(&ccids_lock); > } > Why not just use standard rwlocks in there? (This is probably an FAQ, but it should be).