Rust for Linux List
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Georgios Androutsopoulos" <georgeandrout13@gmail.com>,
	"Gary Guo" <gary@garyguo.net>
Cc: "Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <brauner@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>, "Jan Kara" <jack@suse.cz>,
	"Boqun Feng" <boqun@kernel.org>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	linux-fsdevel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: file: handle fd table teardown in file descriptor APIs
Date: Tue, 22 Sep 2026 20:55:16 +0100	[thread overview]
Message-ID: <DLM3XWG7NZM6.1B4YP1MC0E3OV@garyguo.net> (raw)
In-Reply-To: <CAESH5oeuKoDyr6ZcGR3Fa+_nPn+ceg9PbqBXoXjRsstaSKtJtw@mail.gmail.com>

On Tue Sep 22, 2026 at 7:30 PM BST, Georgios Androutsopoulos wrote:
> On Sun, Sep 20, 2026 at 4:48 PM Gary Guo <gary@garyguo.net> wrote:
>> I think we want to add `unlikely()` on them (which is being added by
>> https://lore.kernel.org/rust-for-linux/20260406095820.465994-2-ojeda@kernel.org/).
>
> I checked current `linux-next` and `rust-next`, but this does not seem to
> have landed yet. Should I leave these as regular checks for now and add a
> `TODO:` to use `unlikely()` once it is available?

Regular checks are fine, no need for TODO either. Just bring this up to nudge
Miguel to pick the patch :)

>
>> I wonder if we should upgrade this to `WARN_ONCE`. As code being executed when
>> exiting are cleanup code, for this code path to be hit, it would mean that some
>> code is installing FD descriptor while being dropped -- which is likely a bug.
>>
>> Putting a "BTW, some Rust code is installing a FD when process is exiting" in
>> dmesg is not going to be useful to understand what's going on. We'd want a full
>> backtrace.
>
> `WARN_ONCE` does not seem to be available on the Rust side yet either.
> `warn_on!()` is available on the current base and would give us the
> backtrace. Would you prefer using that here for now?

I would prefer `warn_on!()`.

Best,
Gary

>
>> I think we can remove this warning. Skipping put_unused_fd isn't actually
>> leaking anything as the files_struct is cleaned up.
>
> Agreed. I'll treat dropping the reservation after fd table teardown as
> normal cleanup, skip `put_unused_fd()`, and document that this can happen.
>
> Best,
> George



  reply	other threads:[~2026-09-22 19:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 20:01 [PATCH] rust: file: handle fd table teardown in file descriptor APIs Georgios Androutsopoulos
2026-09-20 20:48 ` Gary Guo
2026-09-22 18:30   ` Georgios Androutsopoulos
2026-09-22 19:55     ` Gary Guo [this message]
2026-09-25 15:15   ` 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=DLM3XWG7NZM6.1B4YP1MC0E3OV@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=brauner@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=georgeandrout13@gmail.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=viro@zeniv.linux.org.uk \
    --cc=work@onurozkan.dev \
    /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