Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934649AbdC3Spg (ORCPT ); Thu, 30 Mar 2017 14:45:36 -0400 Received: from mail-io0-f181.google.com ([209.85.223.181]:35421 "EHLO mail-io0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934128AbdC3Spe (ORCPT ); Thu, 30 Mar 2017 14:45:34 -0400 MIME-Version: 1.0 In-Reply-To: <20170330182620.GA25251@lst.de> References: <20170330163327.23920-1-hch@lst.de> <20170330172159.GA24139@lst.de> <20170330182620.GA25251@lst.de> From: Linus Torvalds Date: Thu, 30 Mar 2017 11:45:32 -0700 X-Google-Sender-Auth: n6N0T5zqOJcUvo9LezafYQBj1sE Message-ID: Subject: Re: RFC: reject unknown open flags To: Christoph Hellwig Cc: Alexander Viro , Linux API , linux-fsdevel , Linux Kernel Mailing List , libc-alpha Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1173 Lines: 30 On Thu, Mar 30, 2017 at 11:26 AM, Christoph Hellwig wrote: > > That would be nice, but still won't work as we blindly copy f_flags > into F_GETFL, not even masking our internal FMODE_ bits. Ok, *that* is just silly of us, and we could try to just fix, and even backport. There's no possible valid use I could see where that should break (famous last words - user code does some damn odd things at times). Of course, that won't fix old kernels that are out there, but then neither would your original patch... Side note: I think you *can* detect the O_ATOMIC support by using F_SETFL, because F_SETFL only allows you to change flags that we recognize. So somebody who really wants to *guarantee* that O_ATOMIC is there and honored even with old kernels could presumable do something like fd = open(..); // *no* O_ATOMIC fcnt(fd, F_SETFL, O_ATOMIC); if (fcnt(fd, F_GETFL, NULL) & O_ATOMIC) // Yay! We actually got it else // I guess we need to fall back on old behavior although I agree that that is ridiculously inconvenient and not a great thing, and it's worth trying to aim for some better model. Linus