From patchwork Fri Apr 3 01:56:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 6153271 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EBC01BF4A6 for ; Fri, 3 Apr 2015 02:01:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EDAC20379 for ; Fri, 3 Apr 2015 02:01:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03A642035E for ; Fri, 3 Apr 2015 02:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753375AbbDCCBx (ORCPT ); Thu, 2 Apr 2015 22:01:53 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:56145 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753378AbbDCCBo (ORCPT ); Thu, 2 Apr 2015 22:01:44 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1YdqvY-0002Cu-6I; Thu, 02 Apr 2015 20:01:44 -0600 Received: from 70-59-163-10.omah.qwest.net ([70.59.163.10] helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1Ydquc-0003Lp-5U; Thu, 02 Apr 2015 20:00:46 -0600 From: "Eric W. Biederman" To: Linux Containers Cc: , "Serge E. Hallyn" , Andy Lutomirski , Richard Weinberger , Andrey Vagin , Al Viro , Jann Horn , Willy Tarreau , Omar Sandoval Date: Thu, 2 Apr 2015 20:56:15 -0500 Message-Id: <1428026183-14879-11-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 2.2.1 In-Reply-To: <87a8yqou41.fsf_-_@x220.int.ebiederm.org> References: <87a8yqou41.fsf_-_@x220.int.ebiederm.org> X-XM-AID: U2FsdGVkX19/1uTRKPM0kJblWOd2DlZ42ShaSeXclRM= X-SA-Exim-Connect-IP: 70.59.163.10 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Linux Containers X-Spam-Relay-Country: X-Spam-Timing: total 182 ms - load_scoreonly_sql: 0.02 (0.0%), signal_user_changed: 4.1 (2.3%), b_tie_ro: 3.0 (1.6%), parse: 1.10 (0.6%), extract_message_metadata: 15 (8.1%), get_uri_detail_list: 1.95 (1.1%), tests_pri_-1000: 5 (2.9%), tests_pri_-950: 0.97 (0.5%), tests_pri_-900: 0.81 (0.4%), tests_pri_-400: 18 (9.8%), check_bayes: 17 (9.4%), b_tokenize: 3.9 (2.1%), b_tok_get_all: 5 (2.8%), b_comp_prob: 1.11 (0.6%), b_tok_touch_all: 5 (2.8%), b_finish: 0.61 (0.3%), tests_pri_0: 130 (71.5%), tests_pri_500: 3.7 (2.1%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH review 11/19] mnt: Factor umount_mnt from umount_tree X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For future use factor out a function umount_mnt from umount_tree. This function unhashes a mount and remembers where the mount was mounted so that eventually when the code makes it to a sleeping context the mountpoint can be dput. Cc: stable@vger.kernel.org Signed-off-by: "Eric W. Biederman" --- fs/namespace.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index e669a3bf86e7..010d5bebcb7e 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -822,6 +822,16 @@ static void detach_mnt(struct mount *mnt, struct path *old_path) /* * vfsmount lock must be held for write */ +static void umount_mnt(struct mount *mnt) +{ + /* old mountpoint will be dropped when we can do that */ + mnt->mnt_ex_mountpoint = mnt->mnt_mountpoint; + unhash_mnt(mnt); +} + +/* + * vfsmount lock must be held for write + */ void mnt_set_mountpoint(struct mount *mnt, struct mountpoint *mp, struct mount *child_mnt) @@ -1371,9 +1381,7 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how) pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted); if (mnt_has_parent(p)) { mnt_add_count(p->mnt_parent, -1); - /* old mountpoint will be dropped when we can do that */ - p->mnt_ex_mountpoint = p->mnt_mountpoint; - unhash_mnt(p); + umount_mnt(p); } change_mnt_propagation(p, MS_PRIVATE); }