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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 746F7C433DB for ; Sun, 28 Feb 2021 02:14:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 301B164E24 for ; Sun, 28 Feb 2021 02:14:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230008AbhB1COf (ORCPT ); Sat, 27 Feb 2021 21:14:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbhB1COf (ORCPT ); Sat, 27 Feb 2021 21:14:35 -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 CC310C06174A; Sat, 27 Feb 2021 18:13:54 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lGBaU-001Y6J-QU; Sun, 28 Feb 2021 02:13:38 +0000 Date: Sun, 28 Feb 2021 02:13:38 +0000 From: Al Viro To: Drew DeVault Cc: linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, Aleksa Sarai Subject: Re: [RFC PATCH] fs: introduce mkdirat2 syscall for atomic mkdir Message-ID: References: <20210228002500.11483-1-sir@cmpwn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210228002500.11483-1-sir@cmpwn.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Sat, Feb 27, 2021 at 07:25:00PM -0500, Drew DeVault wrote: > This introduces mkdirat2, along with the requisite flag argument, which > presently accepts the same flags as open - allowing the caller to > specify, say, O_CLOEXEC - and leaving us room to expand the next time an > unforeseeable addition to mkdir is called for. Otherwise, it behaves > identically to mkdirat, but returns an open file descriptor for the new > directory. No to the ABI part; "on error it returns -E..., on success - 0 or a non-negative number representing a file descriptor (zero also possible, but unlikely)" is bloody awful as calling conventions go, especially since the case when 0 happens to be a descriptor is not going to get a lot of testing on the userland side. Don't mix "return an error or descriptor" with "return an error or 0". It's going to end up a regular source of userland bugs.