From patchwork Wed Aug 12 00:58:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 6995221 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 87DF9C05AC for ; Wed, 12 Aug 2015 01:05:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98157205CB for ; Wed, 12 Aug 2015 01:05:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA3AD205CD for ; Wed, 12 Aug 2015 01:05:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933215AbbHLBFH (ORCPT ); Tue, 11 Aug 2015 21:05:07 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:49589 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932883AbbHLBFE (ORCPT ); Tue, 11 Aug 2015 21:05:04 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ZPKTW-0007QB-UT; Tue, 11 Aug 2015 19:05:02 -0600 Received: from 67-3-205-173.omah.qwest.net ([67.3.205.173] helo=x220.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ZPKTW-0003pH-4b; Tue, 11 Aug 2015 19:05:02 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Andy Lutomirski Cc: Tejun Heo , Linux Containers , Linux FS Devel , Linux API , "Serge E. Hallyn" , Richard Weinberger , Kenton Varda , Michael Kerrisk-manpages , =?utf-8?Q?St=C3=A9phane?= Graber , Eric Windisch , Greg Kroah-Hartman References: <87pp63jcca.fsf@x220.int.ebiederm.org> <878ucrhxi9.fsf@x220.int.ebiederm.org> <20150811184426.GH23408@mtj.duckdns.org> <877fp1hcuj.fsf@x220.int.ebiederm.org> Date: Tue, 11 Aug 2015 19:58:14 -0500 In-Reply-To: (Andy Lutomirski's message of "Tue, 11 Aug 2015 12:21:54 -0700") Message-ID: <87mvxxcogp.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-XM-AID: U2FsdGVkX18zigIhXUAkz6mAQ1TiVA6shCZlEE1MG+4= X-SA-Exim-Connect-IP: 67.3.205.173 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ****;Andy Lutomirski X-Spam-Relay-Country: X-Spam-Timing: total 229 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 3.5 (1.5%), b_tie_ro: 2.4 (1.1%), parse: 1.41 (0.6%), extract_message_metadata: 18 (8.0%), get_uri_detail_list: 2.7 (1.2%), tests_pri_-1000: 7 (2.9%), tests_pri_-950: 0.97 (0.4%), tests_pri_-900: 0.86 (0.4%), tests_pri_-400: 22 (9.6%), check_bayes: 21 (9.2%), b_tokenize: 5 (2.4%), b_tok_get_all: 8 (3.6%), b_comp_prob: 1.96 (0.9%), b_tok_touch_all: 3.3 (1.4%), b_finish: 0.74 (0.3%), tests_pri_0: 165 (72.1%), tests_pri_500: 7 (3.0%), rewrite_mail: 0.00 (0.0%) Subject: Re: [CFT][PATCH 09/10] sysfs: Create mountpoints with sysfs_create_empty_dir X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Andy Lutomirski writes: > On Tue, Aug 11, 2015 at 11:57 AM, Eric W. Biederman > wrote: >> >> *Boggle* >> >> The only time this should prevent anything is when in a container when >> you are not global root. And then only mounting sysfs should be >> affected. > > Before: > > open("/sys/kernel/debug/asdf", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, > 0666) = -1 EACCES (Permission denied) > > > After: > > open("/sys/kernel/debug/asdf", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, > 0666) = -1 ENOENT (No such file or directory) > > Something broke. I don't know whether CentOS cares about that change, > but there could be other odd side effects. Thanks for pointing this out. I don't know if broke is quite the right word for a change in error codes on lookup failure, but I agree it is a difference that could have affected something. The behavior of empty proc dirs actually return -ENOENT in this situation and so it is a little fuzzy about which is the best behavior to use. Creativing a negative dentry and and then letting vfs_create fail may be the better way to go. Negative dentries are weird enough that I would prefer not to have code that creates negative dentries. They could easily be a lurking trap for some filesystems dentry operations. The patch below is enough to change the error code if someone who can reproduce this wants to try this. Eric --- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --gdiff --git a/fs/libfs.c b/fs/libfs.c index 102edfd39000..3a452a485cbf 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1109,7 +1109,7 @@ EXPORT_SYMBOL(simple_symlink_inode_operations); */ static struct dentry *empty_dir_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) { - return ERR_PTR(-ENOENT); + return NULL; } static int empty_dir_getattr(struct vfsmount *mnt, struct dentry *dentry,