From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Mika_Penttil=E4?= Subject: Re: [PATCH 13/28] VFS: Introduce soft reference counts Date: Mon, 25 Oct 2004 20:20:48 +0300 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <417D35F0.1070501@kolumbus.fi> References: <10987154731896@sun.com> <10987155032816@sun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, raven@themaw.net Return-path: Received: from notes.hallinto.turkuamk.fi ([195.148.215.149]:49937 "EHLO notes.hallinto.turkuamk.fi") by vger.kernel.org with ESMTP id S261174AbUJYRQn (ORCPT ); Mon, 25 Oct 2004 13:16:43 -0400 To: Mike Waychison In-Reply-To: <10987155032816@sun.com> List-Id: linux-fsdevel.vger.kernel.org Mike Waychison wrote: >This patch introduces the concept of a 'soft' reference count for a vfsmount. >This type of reference count allows for references to be held on mountpoints >that do not affect their busy states for userland unmounting. Some might >argue that this is wrong because 'when I unmount a filesystem, I want the >resources associated with it to go away too', but this way of thinking was >deprecated with the addition of namespaces and --bind back in the 2.4 series. > >A future addition may see a callback mechanism so that in kernel users can >use a given mountpoint and have it deregistered some way (quota and >accounting come to mind). > >These soft reference counts are used by a later patch that adds an interface >for holding and manipulating mountpoints using filedescriptors. > >Signed-off-by: Mike Waychison > >+static inline struct vfsmount *mntsoftget(struct vfsmount *mnt) >+{ >+ if (mnt) { >+ read_lock(&vfsmountref_lock); >+ atomic_inc(&mnt->mnt_softcount); >+ mntgroupget(mnt); >+ read_unlock(&vfsmountref_lock); >+ } >+ return mnt; >+} >+ >+static inline void mntsoftput(struct vfsmount *mnt) >+{ >+ struct vfsmount *cleanup; >+ might_sleep(); >+ if (mnt) { >+ if (atomic_dec_and_test(&mnt->mnt_count)) >+ __mntput(mnt); >+ read_lock(&vfsmountref_lock); >+ cleanup = mntgroupput(mnt); >+ atomic_dec(&mnt->mnt_softcount); >+ read_unlock(&vfsmountref_lock); >+ if (cleanup) >+ __mntgroupput(cleanup); >+ } >+} >+ > extern void free_vfsmnt(struct vfsmount *mnt); > > What is this against? What are mntgroupput and mntgroupget? Why does soft put decrement mnt_count which isn't increment by soft get? How do soft references allow userland umount? I don't see soft references used anywhere... --Mika