Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755116AbcJGMkg (ORCPT ); Fri, 7 Oct 2016 08:40:36 -0400 Received: from mail-db5eur01on0113.outbound.protection.outlook.com ([104.47.2.113]:63776 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752225AbcJGMk1 (ORCPT ); Fri, 7 Oct 2016 08:40:27 -0400 X-Greylist: delayed 46825 seconds by postgrey-1.27 at vger.kernel.org; Fri, 07 Oct 2016 08:40:26 EDT Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=avagin@virtuozzo.com; Date: Thu, 6 Oct 2016 16:06:28 -0700 From: Andrei Vagin To: "Eric W. Biederman" CC: Andrei Vagin , Alexander Viro , , , Subject: Re: [PATCH v2] mount: dont execute propagate_umount() many times for same mounts Message-ID: <20161006230616.GA2296@outlook.office365.com> References: <1475772564-25627-1-git-send-email-avagin@openvz.org> <87eg3tclbd.fsf@x220.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Disposition: inline In-Reply-To: <87eg3tclbd.fsf@x220.int.ebiederm.org> User-Agent: Mutt/1.7.0 (2016-08-17) X-Originating-IP: [162.246.95.100] X-ClientProxiedBy: BY1PR10CA0025.namprd10.prod.outlook.com (10.160.197.35) To HE1PR0801MB1980.eurprd08.prod.outlook.com (10.168.94.150) X-MS-Office365-Filtering-Correlation-Id: 9ba6c476-9bba-4ed8-85e5-08d3ee3d719a X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1980;2:SdGYZ113Hyll0WBi94+FsnlLbZ9arND4tB3pEDNfo5yH/pOa4CMYX/v4SkCd2k+PiiyeE2HlovNzpJJqEKqeovYW5fH/HXQrACtP9lIEpIrGhdySczSaLpkwdIfUqD7OhFlJAjsE1oWNe299WId6vfNiTeg+naPvDjTsuGE2HhBMFVvimmBpyIsoiXHYCzMG;3:KeaPbdDHiQYPEPrv22WwQr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xlLMpy4dkdKIezTRiIQpLqrm2sslgfAwnx3GcqX9I6cYNzCdUJVVRc4FpEAqmVTospYTPnby4aWYRiaCmsHgwCyyLO0c4nViOF68i69fZt0E/yk+FFHhdghCZSO5PDo6zR7/qN4c27tMwfC/l5YSPGodcZWSPOrf2qzbGvimMVEXb0NA3ZRSilZanzUAB5PwRP3YVhAHO1BulLEgu42VSOEXYAmGsPGpWdEObkqf7Nc9nqvExY1E= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6043046)(6042046);SRVR:HE1PR0801MB1980;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1980; X-Forefront-PRVS: 00872B689F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(51744003)(24454002)(199003)(189002)(47776003)(8676002)(53416004)(42186005)(4326007)(189998001)(105586002)(345774005)(92566002)(6666003)(86362001)(1076002)(106356001)(5660300001)(50466002)(83506001)(77096005)(2906002)(110136003)(6116002)(586003)(2950100002)(7846002)(9686002)(69596002)(4001350100001)(6916009)(19580405001)(3846002)(19580395003)(50986999)(23686003)(81166006)(7736002)(81156014)(33656002)(101416001)(305945005)(54356999)(76176999)(66066001)(68736007)(97736004)(7099028)(18370500001)(26326002)(192303002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1980;H:outlook.office365.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?koi8-r?Q?1;HE1PR0801MB1980;23:ITeayDXEwKFNND2UMoULd4GIS35eS5GT26S82GtQb?= =?koi8-r?Q?Z7CXb9TiYHGGsk4EPuoJZt4JOgZFf80aO94jzdD3JD7TDU90UQZgKrn4gse+KJ?= =?koi8-r?Q?N0xUcWphhMybNBOqLbNkXj4g2c3gr6vl/fpG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l0vyVgDAulxdQmIoZQuP47UztzaxfQBKDjNlsm5TZjlxBHret5FDUruAB3K/OHfUd6RM4oCl/tKqxq2rn2blbQZNR4IXQDihmGgXx77d4QcEmgYXOB7MrBS96fOsiZBoOMKncW4FSIAVna+ag0ahh6ZDz+pNmtwPZIp1hL76DUB5/d5wlnph9ei4t+WkcmroaW7ndr9A16DvMXhroVQgJZ1ZWnp5Drm8oDrXODZ/mXLz6qxu1ygjl8kpyTWxI6FXwJMUosuvREYrVKI3g0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1980;20:MGQpcOB0ja6uUwN2tLqdZCqrgQ1XaXWByKnBF65TqCZfvEdQgoXyyhxQbUk5eI/PpnbWIGCiLrGBKP5WmzLdU5y3ycnkrGJPbgwDsYxAB8wopXnIk5yMFJdQSLE3032/UcwjOER6cnanI94NjTIHhtRo3fSf+PUzLWkuS34j2GQ=;23:Rc+Mi4RsLyhYorJNQLTBtcPJ18lg9TWr0H0z0v7iviGvqHVgZrGGWFQcqzansqGZ04NP+SNMLwnuP9ReBXo16XbOjMwh5PNyWWdxQRsPmW0dM4YuZmljlGXG0ZRrI5U7mvg+AgjQitdIkluhFgMCvh/471f74NGhDOAs9X/Zyiv8FiOfPKhRnBifOQTcNZAh X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2016 23:06:44.0346 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1980 X-OriginatorOrg: virtuozzo.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1669 Lines: 44 On Thu, Oct 06, 2016 at 02:46:30PM -0500, Eric W. Biederman wrote: > Andrei Vagin writes: > > > The reason of this optimization is that umount() can hold namespace_sem > > for a long time, this semaphore is global, so it affects all users. > > Recently Eric W. Biederman added a per mount namespace limit on the > > number of mounts. The default number of mounts allowed per mount > > namespace at 100,000. Currently this value is allowed to construct a tree > > which requires hours to be umounted. > > I am going to take a hard look at this as this problem sounds very > unfortunate. My memory of going through this code before strongly > suggests that changing the last list_for_each_entry to > list_for_each_entry_reverse is going to impact the correctness of this > change. I have read this code again and you are right, list_for_each_entry can't be changed on list_for_each_entry_reverse here. I tested these changes more carefully and find one more issue, so I am going to send a new patch and would like to get your comments to it. Thank you for your time. > > The order of traversal is important if there are several things mounted > one on the other that are all being unmounted. > > Now perhaps your other changes have addressed that but I haven't looked > closely enough to see that yet. > > > > @@ -454,7 +473,7 @@ int propagate_umount(struct list_head *list) > > list_for_each_entry_reverse(mnt, list, mnt_list) > > mark_umount_candidates(mnt); > > > > - list_for_each_entry(mnt, list, mnt_list) > > + list_for_each_entry_reverse(mnt, list, mnt_list) > > __propagate_umount(mnt); > > return 0; > > } > > Eric