From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61BC446AECD for ; Fri, 15 May 2026 10:55:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.121.94.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778842532; cv=none; b=CR/Xy9uu75m26O64LLNi/4vR8QkjqDGs2eKVcLANwyDq+DIUoLZFr1180MrpRmPqzMiXYfcnMnHxZbux7sJPcqAkSB8W9D/+TdWH1hHDFE5VydghDdwfWoQl91MdWtRelbG51R7Z4qInm6XbSMjRCB5lhjkZJZ6glvt2wGjgmTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778842532; c=relaxed/simple; bh=RDSYGP4AvpjXQLhaeYGRAjuyHmsib3J+SU/ffwyYekE=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type; b=I+mjD6zjmlVX9E/0noKm50CTklVZS7fq7c8b6MBM8QEHVp4GlYxhxJ5pUZM+38gONJF/a/oFxEdIqCBJ+botKFZ6U7p7bOAwDhEdivPqyh91YS0r9DzgqLVVxx1yZnqPkFV1BHWMFUIC4a8z2ey41cN0p1lIGaht5wNEJe0SwTc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xs4all.nl; spf=pass smtp.mailfrom=xs4all.nl; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b=W8jygT0V; arc=none smtp.client-ip=195.121.94.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xs4all.nl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xs4all.nl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b="W8jygT0V" X-KPN-MessageId: 92c2aca4-504c-11f1-89eb-00505699b430 Received: from mta.kpnmail.nl (unknown [10.31.161.189]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id 92c2aca4-504c-11f1-89eb-00505699b430; Fri, 15 May 2026 12:55:23 +0200 (CEST) Received: from mtaoutbound.kpnmail.nl (unknown [10.128.135.190]) by mta.kpnmail.nl (Halon) with ESMTP id 92c27477-504c-11f1-b5d3-0050569981f5; Fri, 15 May 2026 12:55:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=xs4all01; h=content-type:mime-version:subject:message-id:to:from:date; bh=/JOazQEzkSHnQFRbJg08Gb3iIdpZS7p0zK2LrD+/fNA=; b=W8jygT0VOGQJhPIywrwIqg7mg6qC5wOIGHs7CORljSPLlJL/RSVNN37JEJfwmG5kyVQEY3m9d/eLO JdqdsWwj0jwKTdJNcwNjaEdUVJ0+ajsI6a+7gNjFHlwr8ztVkZ2fpaEZbJmduoX5qjOdvLTBqzn/C3 BsL0TB8Vb2s3YFzyRm2WhHzXyMnOXNhRv/By5gEBgzANbWcpatFor9rRoK8xvKrboVzhJnX+GTpdbi uCy4/OOT3UYTuyBmlJZEXvcXbShY6EG6UNXbIbvWty0sEHvVjiEA2ILr/si6Xom+x04eLlMvYs4Jya egBPmBirmx8ew9pvFVngpeMhVTFlFFA== X-KPN-MID: 33|Qu6aNKuJOy6/p6obf5ryyPtMMwCNlZSo4nk9tfQC5ZZV1+IOrG2CxhgCwRD3crQ yNvNe0kGglxQNXuOEL7+DMu86etwnmxQ+ihyHh8puBTQ= X-CMASSUN: 33|stHwS2isPr0foVCBjTVHWPUkcENvGSlQZIklcPtZIela4wT+O2X/LzrmvBCHlhq PglwiqUYKvdeYH/ZgEhGByg== X-KPN-VerifiedSender: Yes Received: from cpxoxapps-mh02 (cpxoxapps-mh02.personalcloud.so.kpn.org [10.128.135.208]) by mtaoutbound.kpnmail.nl (Halon) with ESMTPSA id 92b54fc8-504c-11f1-b8d7-005056995d6c; Fri, 15 May 2026 12:55:23 +0200 (CEST) Date: Fri, 15 May 2026 12:55:23 +0200 (CEST) From: Jori Koolstra To: Christian Brauner Cc: Aleksa Sarai , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Alexander Viro , Arnd Bergmann , "H . Peter Anvin" , Jan Kara , Peter Zijlstra , Andrey Albershteyn , Masami Hiramatsu , Jiri Olsa , Thomas Weißschuh , Mathieu Desnoyers , cmirabil@redhat.com, Greg Kroah-Hartman , Jeff Layton , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org Message-ID: <1805140959.1362290.1778842523425@kpc.webmail.kpnmail.nl> In-Reply-To: <20260511-hochdekoriert-neoliberale-f7a2922bc57c@brauner> References: <20260412135434.3095416-1-jkoolstra@xs4all.nl> <20260412135434.3095416-2-jkoolstra@xs4all.nl> <20260427-umlegen-aufbau-ee3a97f1528a@brauner> <1600596489.77018.1777916475931@kpc.webmail.kpnmail.nl> <20260511-hochdekoriert-neoliberale-f7a2922bc57c@brauner> Subject: Re: [RFC PATCH v2 1/2] vfs: syscalls: add mkdirat2() that returns an O_DIRECTORY fd Precedence: bulk X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal Sorry for the double email, this keyboard is so finicky, I really need to fix it. > Op 11-05-2026 14:00 CEST schreef Christian Brauner : > > mkdirat2() is objectively the worse api. It forces userspace to use a > separate system call without any reason whatsoever. If you can to > O_CREAT you should also be able to to O_DIRECTORY in the same system > call. If we support O_DIRECTORY | O_CREAT we get all the lookup > restriction niceties RESOLVE_* for free. Plus, it is supportable both in > openat() and openat2() because I made that combo return an errno. I don't disagree. I know that some of the UAPI feature requests are not fully flashed out, but at least it gives a basis to get the discussion going. In fact I already have a O_DIRECTORY | O_CREAT patch that at least passes the initial tests. However, I need to sit on it a little bit to think whether I am not leaving something out. Also, I understand why vfs_create() wasn't used in the O_CREAT path, for instance because you cannot just make use of may_create_dentry() there. But now that we are going to string another path through lookup_open() it would be great if we could reuse some of the logic from vfs_create() and vfs_mkdir(). Perhaps we could move may_create_dentry() out of the vfs_* calls and let the caller take care of that. Then again, this is the pattern for all those calls. You could also just accept some redundancies with may_o_create(), or have something like static vfs_mkdir/create_common() functions. There are also some minor things. If i_op->mkdir is missing this is an EPERM, but with i_op->create it is EACCESS (and suggesting ENOSYS). Should this not be a consistent error code? I also wonder whether there is a nicer way to handle error being returned from vfs_mkdir et al. If I am reading if (!error) { dentry = vfs_mkdir(mnt_idmap(path.mnt), path.dentry->d_inode, dentry, mode, &delegated_inode); if (IS_ERR(dentry)) error = PTR_ERR(dentry); } end_creating_path(&path, dentry); it feels like there is a missing return inside the if (IS_ERR(dentry)) block, and I have to go several function deep to see that end_creating_path correctly deals with error values being passed instead of a dentry. Then again, probably not worth the churn... > > UAPI design often is a nasty mix of performance (context switches), > separation of concerns and privileges, tastefulness, and compromises you > never thought or wanted to make. > Yes, thanks for suggestion this back at FOSDEM. It is quite fun, and lots to learn :) > > And during LSFMM the VFS maintains all agreed to proceed with > O_DIRECTORY | O_CREAT. Ah good, I didn't know that. I haven't build up the street cred to attend, maybe next time :) Thanks, Jori.