From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: Re: [PATCH] fix race in mark_mounts_for_expiry() Date: Wed, 18 May 2005 11:32:34 +0100 Message-ID: <6865.1116412354@redhat.com> References: <1116005355.6248.372.camel@localhost> <1116012287.6248.410.camel@localhost> <1116013840.6248.429.camel@localhost> <1116256279.4154.41.camel@localhost> <20050516111408.GA21145@mail.shareable.org> <1116301843.4154.88.camel@localhost> <20050517012854.GC32226@mail.shareable.org> <1116360352.24560.85.camel@localhost> <1116399887.24560.116.camel@localhost> <1116400118.24560.119.camel@localhost> Cc: linuxram@us.ibm.com, jamie@shareable.org, viro@parcelfarce.linux.theplanet.co.uk, Andrew Morton , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Return-path: Received: from mx1.redhat.com ([66.187.233.31]:12950 "EHLO mx1.redhat.com") by vger.kernel.org with ESMTP id S262156AbVERKdV (ORCPT ); Wed, 18 May 2005 06:33:21 -0400 In-Reply-To: To: Miklos Szeredi Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Miklos Szeredi wrote: > > How about this patch? It tries to solve this race without additional > locking. If refcount is already zero, it will increment and decrement > it. So be careful to only call grab_namespace() with vfsmount_lock > held, otherwise it could race with itself. (vfsmount_lock is also > needed in this case so that mnt->mnt_namespace, doesn't change, while > grabbing the namespace) How about using cmpxchg? David