From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: How to unmount mounts corresponding to super_block structure? Date: Wed, 27 Feb 2013 06:56:41 +0000 Message-ID: <20130227065641.GN4503@ZenIV.linux.org.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Anatol Pomozov Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:60833 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751410Ab3B0G4o (ORCPT ); Wed, 27 Feb 2013 01:56:44 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Feb 26, 2013 at 10:35:12PM -0800, Anatol Pomozov wrote: > What I am trying to do is to iterate current filesystem namespace and > find mountpoints that correspond to super_block. Namespace can have > multiple corresponding mountpoints in case of bind mounts. Here is > code that seems to work fine http://pastebin.com/xLECPGa4 . Now I am > trying to understand what synchronization is required for this code. > It looks like access to nsproxy->mnt_ns->list should be done with > namespace_sem held. Unfortunately that semaphore is internal to > fs/namespace.c. It is not clear for me how I suppose to iterate the > mount list. > > Is there any advice/code example how to umount() mountpoints for a > given super_block? Simple: don't. This is fundamentally wrong thing to do. Not to mention anything else, there may be more than one namespace out there. This operation makes no sense. Incidentally, anybody adding includes of fs/mount.h would better be ready to explain {What,Why}TF is being done. There's a damn good reason why this list is outside of public struct vfsmount...