From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anton Altaparmakov Subject: Re: fishy ->put_inode usage in ntfs Date: Thu, 14 Oct 2004 15:59:31 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <1097765971.21275.120.camel@imp.csi.cam.ac.uk> References: <20041014112607.GA24508@lst.de> <1097757569.21275.40.camel@imp.csi.cam.ac.uk> <20041014124400.GL16153@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Christoph Hellwig , ntfs-dev , linux-fsdevel@vger.kernel.org Return-path: Received: from ppsw-3.csi.cam.ac.uk ([131.111.8.133]:13262 "EHLO ppsw-3.csi.cam.ac.uk") by vger.kernel.org with ESMTP id S263778AbUJNO7t (ORCPT ); Thu, 14 Oct 2004 10:59:49 -0400 To: Matthew Wilcox In-Reply-To: <20041014124400.GL16153@parcelfarce.linux.theplanet.co.uk> List-Id: linux-fsdevel.vger.kernel.org On Thu, 2004-10-14 at 13:44, Matthew Wilcox wrote: > On Thu, Oct 14, 2004 at 01:39:30PM +0100, Anton Altaparmakov wrote: > > Hm, I can now see that there is a small race window here and this is > > simply fixed by doing the setting to NULL of bmp_ino before doing the > > iput() of bmp_ino. Thanks for pointing this problem area out to! (-: > > If you're going to rely on ordering like this, you must at least use > wmb() to ensure that neither the compiler nor the processor reorders > your stores. Am I right that if I surround the code with down/up(i_sem) this implies a memory barrier so I do not need wmb()? The relevant code now is: bvi = NULL; down(&vi->i_sem); if (atomic_read(&vi->i_count) == 2) { bvi = ni->itype.index.bmp_ino; if (bvi) ni->itype.index.bmp_ino = NULL; } up(&vi->i_sem); if (bvi) iput(bvi); Best regards, Anton -- Anton Altaparmakov (replace at with @) Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/