On Tue, 12 Nov 2024 18:13:58 +0000 Joe Damato wrote:
+/* must be called under rcu_read_lock(), because napi_by_id requires it */ +static struct napi_struct *__do_napi_by_id(unsigned int napi_id,
struct genl_info *info, int *err)
+{
- struct napi_struct *napi;
- napi = napi_by_id(napi_id);
- if (napi) {
*err = 0;
- } else {
NL_SET_BAD_ATTR(info->extack, info->attrs[NETDEV_A_NAPI_ID]);
*err = -ENOENT;
- }
- return napi;
+}
Thanks for the quick follow up! I vote we don't factor this out. I don't see what it buys us, TBH, normally we factor out code to avoid having to unlock before return, but this code doesn't have extra returns...
Just slap an rcu_read_lock / unlock around and that's it?
Feel free to repost soon.