Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp169685pxb; Wed, 18 Nov 2020 01:04:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZiV4Q3F6yva7tNoGc6hdDlNvkRU9TpHNVSrktbEM+r85n+T4nh3UsPsJ+M/QRtWkEjMmy X-Received: by 2002:aa7:cf90:: with SMTP id z16mr25793825edx.174.1605690269243; Wed, 18 Nov 2020 01:04:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605690269; cv=none; d=google.com; s=arc-20160816; b=zOBDQonpnS/g5FOWLleHJcuUaFRpo/X9T4Fe3Lmvw1lmTK2i9e2PJAgSpGQSfkcAp2 C4XlQkwrFVRBS8dwsHCO1JqafojLdcjEvY1qn8mR7SlDTMwBLTDoVofuTFonU7sq80G3 vvpS9uqGKzxawt42zsO8PspY8BsUkI48rmVUvHpiGSgMOZEIxvtyMv+Neb7fGwrYlB5j uVwXqo4PQtC8YmOz5h8Xqs5728Ygj/vL24E73LnbLaoQJg33QY7hxFZ3NaBK+tiXpGka jWukJ0r379Gwx67+f9kFfuq5pFWpok3lV+KF7H1VCkMxBHLz3QIZ6pylfdpI9QX2WmZs j1WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SWtCG652lhB0Gqzsr5XACFrVzEq9gu9QSfy5mfQ6IoU=; b=rKMIWhLAjOAe5q6XTT1Els2V1tr7K7v2FgmzB5URKmJMyejJOb8MSPi3NUhRzNCbD6 gblt3q8iWMHBdgw0NuurgYKU1+3b5OgHGoy1MGXE78s2r/gqenHRsDCqGGenf9xgjwyW gaZ5UdcpljgBPufVPxnMTnz4ktxlT9V5hHAmLyOduwWlmpDqGAP9Kq9QB1PLVBixRokf YdDd/W3wenewn3tVcI9vrJGAQR/JF1B9TbeU3rdVj9gJ+CqonqB+K8MZXdNdWFbH/mrk 4BAyFBok7Os2SpX8U3LwqLNyb4Fn0RWYM5FVdDgAMQ6rIpkEvRiT13Kq2riyPO20TB12 Jq6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TjCzdqFS; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hh1si747649ejb.605.2020.11.18.01.03.59; Wed, 18 Nov 2020 01:04:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TjCzdqFS; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727352AbgKRJAi (ORCPT + 99 others); Wed, 18 Nov 2020 04:00:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:39932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727160AbgKRJAh (ORCPT ); Wed, 18 Nov 2020 04:00:37 -0500 Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CDBBD24248; Wed, 18 Nov 2020 09:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605690036; bh=i9tBV0oZBsTReps0EogPqekfIEGahPYtFjMV0dB8U+U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TjCzdqFScODCSwu2HqQV/hZsXCizf8cSQGNq0E4s6V9KEfsorLbCddbZe5wx8Pvfq QUGYUe3B/02nyoOG++Le+tTxAzAu8vcdiXUBicX/furVaJA/8OMu9uobWvcycgmi68 YbRE+d1hXTXxUMEjluROqGJr09HxR0jj4VUdy1Xg= Received: by mail-oi1-f174.google.com with SMTP id k26so1444194oiw.0; Wed, 18 Nov 2020 01:00:36 -0800 (PST) X-Gm-Message-State: AOAM5313tO3mHx/3SRkk+XORL/lHPnGwNAKy3KQYTXXo6mpolRhfYxoJ afM+Acg1VYntv5yx1GcZlsCjkIg0lrKpH2xtYIA= X-Received: by 2002:aca:180a:: with SMTP id h10mr2022489oih.4.1605690035742; Wed, 18 Nov 2020 01:00:35 -0800 (PST) MIME-Version: 1.0 References: <20201012220620.124408-1-linus.walleij@linaro.org> <20201013092240.GI32292@arm.com> In-Reply-To: From: Arnd Bergmann Date: Wed, 18 Nov 2020 10:00:19 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 RESEND] fcntl: Add 32bit filesystem mode To: Linus Walleij Cc: Dave Martin , "Theodore Ts'o" , Andreas Dilger , Ext4 Developers List , linux-fsdevel , Linux API , QEMU Developers , Florian Weimer , Peter Maydell , Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Nov 18, 2020 at 12:38 AM Linus Walleij wrote: > > On Tue, Oct 13, 2020 at 11:22 AM Dave Martin wrote: > > > > case F_SETFD: > > > err = 0; > > > set_close_on_exec(fd, arg & FD_CLOEXEC); > > > + if (arg & FD_32BIT_MODE) > > > + filp->f_mode |= FMODE_32BITHASH; > > > + else > > > + filp->f_mode &= ~FMODE_32BITHASH; > > > > This seems inconsistent? F_SETFD is for setting flags on a file > > descriptor. Won't setting a flag on filp here instead cause the > > behaviour to change for all file descriptors across the system that are > > open on this struct file? Compare set_close_on_exec(). > > > > I don't see any discussion on whether this should be an F_SETFL or an > > F_SETFD, though I see F_SETFD was Ted's suggestion originally. > > I cannot honestly say I know the semantic difference. > > I would ask the QEMU people how a user program would expect > the flag to behave. I agree it should either use F_SETFD to set a bit in the fdtable structure like set_close_on_exec() or it should use F_SETFL to set a bit in filp->f_mode. It appears the reason FMODE_32BITHASH is part of filp->f_mode is that the only user today is nfsd, which does not have a file descriptor but only has a struct file. Similarly, the only code that understands the difference (ext4_readdir()) has no reference to the file descriptor. If this becomes an O_DIR32BITHASH flag for F_SETFL, I suppose it should also be supported by openat2(). Arnd