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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 46A51C49361 for ; Sat, 19 Jun 2021 14:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BABD610C7 for ; Sat, 19 Jun 2021 14:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233169AbhFSO3i (ORCPT ); Sat, 19 Jun 2021 10:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230441AbhFSO3h (ORCPT ); Sat, 19 Jun 2021 10:29:37 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5DE3C061574 for ; Sat, 19 Jun 2021 07:27:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=pIxuiM+EalKyhY27YmC7fgBU/sfLThANATASIxILUaI=; b=GcOmeKN6O331YWUJzvFTj4xNA4 Slsibo9iMrzHb9TKSvIJLjx5iqKiBoqgB49DailSkKgIsBy7mSHKGTkAqPGRy/RLGF6eV8syi8dXE qyv01fRLF6+39MhKjidPxOA47Sl4oww/LJR7HJMK6STI/1Mhja1KjpA6II0pX/A60axnxj6/hQl8Z MuJUOP7NdkJOZgq+xPDwT92duEiSRykhJBlL09sVveQEo0CJfnxN8PCa2Uh/hzw0p2OWj+XR2FJkE JhE4h/gTtb7tRnDfZaSe9BErCDOF65C2eT/xgz5Vw1RsZwCcr2jkkPvyAgMzd+XxODmeo29b93aks 4tIGBj1Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lubwB-00BJ1k-Li; Sat, 19 Jun 2021 14:27:10 +0000 Date: Sat, 19 Jun 2021 15:27:07 +0100 From: Matthew Wilcox To: Al Viro Cc: Arthur Williams , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] fs: Allow open with O_CREAT to succeed if existing dir is specified Message-ID: References: <20210619110148.30412-1-taaparthur@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Sat, Jun 19, 2021 at 12:42:14PM +0000, Al Viro wrote: > On Sat, Jun 19, 2021 at 06:01:48AM -0500, Arthur Williams wrote: > > Make opening a file with the O_CREAT flag a no-op if the specified file > > exists even if it exists as a directory. Allows userspace commands, like > > flock, to open a file and create it if it doesn't exist instead of > > having to parse errno. > > Not going to happen. It's a user-visible behaviour, consistent between > all kinds of Unices, consistent with POSIX and it does make sense. > > NAK. Agreed. POSIX states: [EISDIR] The named file is a directory and oflag includes O_WRONLY or O_RDWR, or includes O_CREAT without O_DIRECTORY. so I would say the POSIX committee considered this situation and explicitly did not want it to succeed.