public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Christian Brauner <brauner@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jeff Layton <jlayton@kernel.org>, Jan Kara <jack@suse.com>,
	Josef Bacik <josef@toxicpanda.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] [DRAFT RFC]: file: reclaim 24 bytes from f_owner
Date: Sat, 10 Aug 2024 00:21:40 +0100	[thread overview]
Message-ID: <20240809232140.GA13701@ZenIV> (raw)
In-Reply-To: <20240809-koriander-biobauer-6237cbc106f3@brauner>

On Fri, Aug 09, 2024 at 10:10:40PM +0200, Christian Brauner wrote:

> fcntl()s and file leases can just allocate on demand easily. Cleanup
> happens during __fput() when file was really opend. For fcntl()s and
> file leases this is guaranteed because the file is already alive. For
> drivers they need to cleanup the allocated memory before they've
> succesfully finished ->open(). Afterwards we'll just clean it up.
> 
> Interactions with O_PATH should be fine as well e.g., when opening a
> /dev/tty as O_PATH then no ->open() happens thus no filp->f_owner is
> allocated. That's fine as no file operation will be set for those and
> the device has never been opened. fcntl()s called on such things will
> just allocate a ->f_owner on demand. Although I have zero idea why'd you
> care about f_owner on an O_PATH fd.

One general note: IMO you are far too optimistic about the use of __cleanup
extensions; it's _not_ something that we want blindly used all over
the place.  In some cases it's fine, but I'm very nervous about the
possibility of people starting to cargo-cult it all over the place.

Again, __cleanup support in gcc has significant holes, at least up to
gcc 12.

This is *NOT* a generally safe part of C dialect we are using.  And
the pitfalls associated with it are not documented, let alone generally
understood.

  parent reply	other threads:[~2024-08-09 23:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-09 20:10 [PATCH] [DRAFT RFC]: file: reclaim 24 bytes from f_owner Christian Brauner
2024-08-09 20:18 ` Matthew Wilcox
2024-08-09 23:21 ` Al Viro [this message]
2024-08-13 12:59   ` Christian Brauner
2024-08-10  9:36 ` Mateusz Guzik
2024-08-11 12:42   ` Christian Brauner

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=20240809232140.GA13701@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=brauner@kernel.org \
    --cc=jack@suse.com \
    --cc=jlayton@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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