[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220520181118.47ca2bdc@kernel.org>
Date: Fri, 20 May 2022 18:11:18 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: David Howells <dhowells@...hat.com>
Cc: netdev@...r.kernel.org, linux-afs@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 3/7] rxrpc: Fix locking issue
On Fri, 20 May 2022 17:46:13 +0100 David Howells wrote:
> +struct list_head *seq_list_start_rcu(struct list_head *head, loff_t pos)
> +{
> + struct list_head *lh;
> +
> + list_for_each_rcu(lh, head)
> + if (pos-- == 0)
> + return lh;
> +
> + return NULL;
> +}
> +EXPORT_SYMBOL(seq_list_start_rcu);
> +
> +struct list_head *seq_list_start_head_rcu(struct list_head *head, loff_t pos)
> +{
> + if (!pos)
> + return head;
> +
> + return seq_list_start_rcu(head, pos - 1);
> +}
> +EXPORT_SYMBOL(seq_list_start_head_rcu);
> +
> +struct list_head *seq_list_next_rcu(void *v, struct list_head *head,
> + loff_t *ppos)
> +{
> + struct list_head *lh;
> +
> + lh = rcu_dereference(((struct list_head *)v)->next);
Can we use list_next_rcu() here maybe ? to avoid the sparse warning?
> + ++*ppos;
> + return lh == head ? NULL : lh;
> +}
> +EXPORT_SYMBOL(seq_list_next_rcu);
Powered by blists - more mailing lists