From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D47BC43387 for ; Sat, 12 Jan 2019 21:52:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E28F3206B7 for ; Sat, 12 Jan 2019 21:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726472AbfALVwZ (ORCPT ); Sat, 12 Jan 2019 16:52:25 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:42748 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbfALVwZ (ORCPT ); Sat, 12 Jan 2019 16:52:25 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.91 #2 (Red Hat Linux)) id 1giRCR-0007QO-LN; Sat, 12 Jan 2019 21:52:15 +0000 Date: Sat, 12 Jan 2019 21:52:15 +0000 From: Al Viro To: Tejun Heo Cc: Zefan Li , Linus Torvalds , linux-fsdevel@vger.kernel.org, Andrey Vagin Subject: Re: [heads-up] buggered refcounting logics in cgroup1_mount() Message-ID: <20190112215215.GV2217@ZenIV.linux.org.uk> References: <20190111072309.GT2217@ZenIV.linux.org.uk> <20190111205451.GX2509588@devbig004.ftw2.facebook.com> <20190112053825.GU2217@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190112053825.GU2217@ZenIV.linux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sat, Jan 12, 2019 at 05:38:25AM +0000, Al Viro wrote: > On Fri, Jan 11, 2019 at 12:54:51PM -0800, Tejun Heo wrote: > > Hello, Al. > > > > On Fri, Jan 11, 2019 at 07:23:09AM +0000, Al Viro wrote: > > > AFAICS, a cleaner solution would be this: > > > * to hell with kernfs_pin_sb(); just try to grab a reference to > > > cgroup_root on reuse. > > > * have cgroup_kill_sb() treat "it's already marked killed" as > > > "just drop the reference, then". > > > * after cgroup_do_mount() check if cgroup_root got marked killed and > > > do deactivate_locked_super() in such case (with the same > > > restart_syscall() failure exit). > > > > > > Objections? I would love to kill kernfs_pin_sb() as > > > a followup (it's a fundamentally broken API), but that's not > > > a stable fodder; some fix of refcounting bugs, OTOH, should be. > > > > cgroup1 hierarchies have really weird set of requirements and the > > implementation has always been somewhat broken. I thought I fixed it > > but obviously not. I have no objection whatsoever and would much > > appreciate the work. > > See vfs.git #fixes (the last two commits in there). It seems to > work here, but I don't have the CRIU regression tests, etc., so > I would really appreciate if that thing got a real beating. BTW, while kernfs_pin_sb() and struct kernfs_root ->supers definitely ought to die, there's something else that might be killable with that approach. percpu_ref_reinit() has no users left after that, and, as David Howells has observed, PERCPU_REF_INIT_DEAD is also unused. Do we want to keep these two?