From: Peter Maydell <firstname.lastname@example.org> To: Linus Walleij <email@example.com> Cc: Dave Martin <Dave.Martin@arm.com>, "Theodore Ts'o" <firstname.lastname@example.org>, Andreas Dilger <email@example.com>, Ext4 Developers List <firstname.lastname@example.org>, linux-fsdevel <email@example.com>, Linux API <firstname.lastname@example.org>, QEMU Developers <email@example.com>, Florian Weimer <firstname.lastname@example.org>, Andy Lutomirski <email@example.com> Subject: Re: [PATCH v3 RESEND] fcntl: Add 32bit filesystem mode Date: Mon, 15 Nov 2021 10:56:39 +0000 [thread overview] Message-ID: <CAFEAcA9R3xc4PFZiojDZviFxeDFE0a9Ka=3okE3mt1c0NGc7MA@mail.gmail.com> (raw) In-Reply-To: <CACRpkdZoMoUQX+CPd31qwjXSKJvaZ6=jcFvUrK_3hkxaUWJNJg@mail.gmail.com> On Tue, 17 Nov 2020 at 23:38, Linus Walleij <firstname.lastname@example.org> wrote: > > On Tue, Oct 13, 2020 at 11:22 AM Dave Martin <Dave.Martin@arm.com> 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. Apologies for the very late response -- I hadn't noticed that this thread had stalled out waiting for an answer to this, and was only reminded of it recently when another QEMU user ran into the problem that this kernel patch is trying to resolve. If I understand the distinction here correctly, I think QEMU wouldn't care about it in practice. We want the "32 bit readdir offsets" behaviour on all file descriptors that correspond to where we're emulating "the guest opened this file descriptor". We don't want (but probably won't notice if we get) that behaviour on file descriptors that QEMU has opened for its own purposes. But we'll never open a file descriptor for the guest and then dup it into one for QEMU's purposes. (I guess there might be some weird unlikely-to-happen edge cases where an emulated guest binary opens an fd for a directory and then passes it via exec to a host binary: but even there I expect the host binary wouldn't notice it was getting 32-bit hashes.) But overall I think that the more natural behaviour would be that it is per-file-descriptor. -- PMM
prev parent reply other threads:[~2021-11-15 10:57 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-12 22:06 Linus Walleij 2020-10-13 0:08 ` Eric Blake 2020-10-13 9:22 ` Dave Martin 2020-11-17 23:38 ` Linus Walleij 2020-11-18 9:00 ` Arnd Bergmann 2021-11-15 10:56 ` Peter Maydell [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAFEAcA9R3xc4PFZiojDZviFxeDFE0a9Ka=3okE3mt1c0NGc7MA@mail.gmail.com' \ --email@example.com \ --cc=Dave.Martin@arm.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH v3 RESEND] fcntl: Add 32bit filesystem mode' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).