From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: dhowells@redhat.com, Jeff Layton <jlayton@kernel.org>,
Kees Cook <keescook@chromium.org>,
Jonathan Corbet <corbet@lwn.net>,
Eric Van Hensbergen <ericvh@gmail.com>,
Latchesar Ionkov <lucho@ionkov.net>,
Dominique Martinet <asmadeus@codewreck.org>,
Christian Schoenebeck <linux_oss@crudebyte.com>,
Marc Dionne <marc.dionne@auristor.com>,
Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
Steve French <smfrench@gmail.com>,
William Kucharski <william.kucharski@oracle.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Dave Chinner <david@fromorbit.com>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
v9fs-developer@lists.sourceforge.net,
linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org,
CIFS <linux-cifs@vger.kernel.org>,
samba-technical@lists.samba.org,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-hardening@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context
Date: Fri, 10 Jun 2022 19:06:34 +0100 [thread overview]
Message-ID: <652128.1654884394@warthog.procyon.org.uk> (raw)
In-Reply-To: <CAHk-=wgkwKyNmNdKpQkqZ6DnmUL-x9hp0YBnUGjaPFEAdxDTbw@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> Side note: I think this could have been done with an unnamed union as
>
> struct my_inode {
> union {
> struct inode vfs_inode;
> struct netfs_inode netfs_inode;
> };
> [...]
>
> instead, with the rule that 'netfs_inode' always starts with a 'struct inode'.
I'm slightly wary of that, lest struct netfs_inode gets randomised. I'm not
sure how likely that would be without netfs_inode getting explicitly marked.
> But in a lot of cases you really could do so much better: you *have* a
> "struct netfs_inode" to begin with, but you converted it to just
> "struct inode *", and now you're converting it back.
>
> Look at that AFS code, for example, where we have afs_vnode_cache() doing
>
> return netfs_i_cookie(&vnode->netfs.inode);
>
> and look how it *had* a netfs structure, and it was passing it to a
> netfs function, but it explicitly passed the WRONG TYPE, so now we've
> lost the type information and it is using that cast to fake it all
> back.
Yeah, I didn't look at those as they didn't cause warnings, but you're right -
those should take struct netfs_inode pointers in some cases, rather than
struct inode.
Note that some functions, such as netfs_readpage() and netfs_readpages() do
need to take struct inode pointers as I'm trying to get the VFS ops to jump
into netfslib and get all the VM interface stuff out of the network
filesystems - the idea being that the network filesystem will provide netfslib
primarily with two functions: do a read op and do a write op.
I'll have a look at your patch in a bit.
Thanks,
David
next prev parent reply other threads:[~2022-06-10 18:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-09 20:46 [PATCH] netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context David Howells
2022-06-09 22:04 ` Linus Torvalds
2022-06-09 22:05 ` Linus Torvalds
2022-06-10 18:06 ` David Howells [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-05-19 13:44 David Howells
2022-05-19 14:05 ` Kees Cook
2022-05-19 15:33 ` Jeff Layton
2022-05-23 1:01 ` Xiubo Li
2022-05-24 0:29 ` Xiubo Li
2022-05-27 12:27 ` David Howells
2022-05-27 20:45 ` Kees Cook
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=652128.1654884394@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=asmadeus@codewreck.org \
--cc=ceph-devel@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=david@fromorbit.com \
--cc=ericvh@gmail.com \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=lucho@ionkov.net \
--cc=marc.dionne@auristor.com \
--cc=samba-technical@lists.samba.org \
--cc=smfrench@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=v9fs-developer@lists.sourceforge.net \
--cc=william.kucharski@oracle.com \
--cc=willy@infradead.org \
--cc=xiubli@redhat.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).