Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7744848pxb; Thu, 18 Feb 2021 20:13:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo30yo6YBAyQ5TaMt/TUUhepao/DPOhK3mCrb1rzgT+Z1MKn2UCWZHq0dodHysj2fV/Xgr X-Received: by 2002:aa7:d35a:: with SMTP id m26mr7206353edr.292.1613708000638; Thu, 18 Feb 2021 20:13:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613708000; cv=none; d=google.com; s=arc-20160816; b=caivdJdO3on6EATsciyUJw2Tt235KenjZBhMmvAUGlK41yPlYeijwMRAY3y+p4OBjM ov7GmPkTrd5R4N6DBjiHiPaZ+zPY9ACki7SXxW1AeayVHZF2/pxXq8PohyENYP1P+2yL IE3yu3NqW6EpgGKunGeU1uD91BgqoIAkJ89iIHttGnUwdp8MgYhy9cMSDcDrRNg4wk+w nomiTuruH1Ex1RICSa/+pN/8euYKXM3KVIDSveRRyqQPu36G4igeu0V8oYZc0N0eeTDH /3UMQqPNDEBXm5pHiW5zvBepaQnut5n4euTRKMDd9MdY3PSpaMAmM/bj7Re5dIlXP85U +DcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=oAn0Iqu5rO5OhWUzdDTOlPCYK98QLvQ2Ul0Rs2sIZ1M=; b=M3HG2WFQs06VMHSJBiQWjGwswuTYCrxmI+i6SWUnB1LPlEoF6zERObGVqovsiAfG5z gnTEifl+SpcsxLDNv+bVwAYw0aOAku3TIRAQWQcapd7qt3GBe1uLQmGHotZP2DekSclX ZwjJkuNsBRmzLFt7FIQLwq+gBkVH6F2gsMgzFVlYVVfDIJ1OMxbWPG5r9PQmjGLBewwH B6D/3oyQwgELp0QInplukZVNOWkfvkswzMK0wv7D5i3Khygdviq7oTuaxelU0yMaoJ/Q r3S2igRyf90/QY6J594nsX0zdJppgr6odm376VgmMQqNYFF9S/oe7HBtmuNoA6lqvkua PAoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn4si6347977ejc.205.2021.02.18.20.12.57; Thu, 18 Feb 2021 20:13:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbhBSEMF (ORCPT + 99 others); Thu, 18 Feb 2021 23:12:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229594AbhBSEL7 (ORCPT ); Thu, 18 Feb 2021 23:11:59 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1854BC061756; Thu, 18 Feb 2021 20:11:19 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lCx8D-00FgLa-9x; Fri, 19 Feb 2021 04:11:05 +0000 Date: Fri, 19 Feb 2021 04:11:05 +0000 From: Al Viro To: Denis Kirjanov Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, Jakub Kicinski , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] fs: export kern_path_locked Message-ID: References: <20210125154937.26479-1-kda@linux-powerpc.org> <20210127175742.GA1744861@infradead.org> <20210129082524.GA2282796@infradead.org> <20210129131855.GA2346744@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 16, 2021 at 06:00:34PM +0000, Al Viro wrote: > Sigh... OK, so we want something like > user_path_create() > vfs_mknod() > created = true > grab bindlock > .... > drop bindlock > if failed && created > vfs_unlink() > done_path_create() > in unix_bind()... That would push ->bindlock all way down in the hierarchy, > so that should be deadlock-free, but it looks like that'll be fucking ugly ;-/ > > Let me try and play with that a bit, maybe it can be massaged to something > relatively sane... OK... Completely untested series follows. Preliminary massage in first 6 patches, then actual "add cleanup on failure", then minor followup cleanup. af_unix: take address assignment/hash insertion into a new helper unix_bind(): allocate addr earlier unix_bind(): separate BSD and abstract cases unix_bind(): take BSD and abstract address cases into new helpers fold unix_mknod() into unix_bind_bsd() unix_bind_bsd(): move done_path_create() call after dealing with ->bindlock unix_bind_bsd(): unlink if we fail after successful mknod __unix_find_socket_byname(): don't pass hash and type separately Branch is in git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git #misc.af_unix, individual patches in followups