linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
	Masami Hiramatsu <mhiramat@kernel.org>,
	 Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	 Andrew Morton <akpm@linux-foundation.org>,
	Ajay Kaher <akaher@vmware.com>,
	 Al Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>
Subject: Re: [for-next][PATCH 2/3] eventfs: Stop using dcache_readdir() for getdents()
Date: Thu, 4 Jan 2024 12:18:06 -0800	[thread overview]
Message-ID: <CAHk-=wik=OOYCRSzAA7x485GyxH97ioaPziiF4Ms1kRU8VLkHA@mail.gmail.com> (raw)
In-Reply-To: <20240104150500.38b15a62@gandalf.local.home>

On Thu, 4 Jan 2024 at 12:04, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> Also, I just realized it breaks if we update the 'c--' before the callback. :-/
>
> I have to put this check *after* the callback check.

What? No.

> Reason being, the callback can say "this event doesn't get this file" and
> return 0, which tells eventfs to skip this file.

So yes, there seems to be a bug there, in that ctx->pos is only
updated for successful callbacks (and not for "ignored entry").

But that just means that you should always update 'ctx->pos' as you
'continue' the loop.

The logical place to do that would be in the for-loop itself, which
actually is very natural for the simple case, ie you should just do

        for (i = 0; i < ei->nr_entries; i++, ctx->pos++) {

but in the list_for_each_entry_srcu() case the 'update' part of the
for-loop isn't actually accessible, so it would have to be at the
'continue' point(s).

Which is admittedly a bit annoying.

Looking at that I'm actually surprised that I don't recall that we'd
have hit that issue with our 'for_each_xyz()' loops before.

The update for our "for_each_xyz()" helpers are all hardcoded to just
do the "next iterator" thing, and there's no nice way to take
advantage of the normal for-loop semantics of "do this at the end of
the loop"

            Linus

  reply	other threads:[~2024-01-04 20:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 16:47 [for-next][PATCH 0/3] tracefs/eventfs: Updates for 6.8 Steven Rostedt
2024-01-04 16:47 ` [for-next][PATCH 1/3] eventfs: Remove "lookup" parameter from create_dir/file_dentry() Steven Rostedt
2024-01-04 16:47 ` [for-next][PATCH 2/3] eventfs: Stop using dcache_readdir() for getdents() Steven Rostedt
2024-01-04 18:46   ` Linus Torvalds
2024-01-04 19:02     ` Steven Rostedt
2024-01-04 20:05       ` Steven Rostedt
2024-01-04 20:18         ` Linus Torvalds [this message]
2024-01-04 20:33           ` Steven Rostedt
2024-01-15 20:58   ` Steven Rostedt
2024-01-04 16:47 ` [for-next][PATCH 3/3] tracefs/eventfs: Use root and instance inodes as default ownership Steven Rostedt
2024-01-04 18:38   ` Linus Torvalds

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='CAHk-=wik=OOYCRSzAA7x485GyxH97ioaPziiF4Ms1kRU8VLkHA@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akaher@vmware.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).