Messages in this thread | | | Subject | RE: [PATCH v2 1/4] SUNRPC: release per-net clients lock before calling PipeFS dentries creation | Date | Mon, 27 Feb 2012 17:11:37 -0000 | From | "David Laight" <> |
| |
> Gmmm. > Please, correct me, if I'm wrong, that you are proposing > something like this: > > spin_lock(&sn->rpc_client_lock); > again: > list_for_each_entry(clnt,&sn->all_clients, cl_clients) { > if ((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || > (event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) > continue; > atomic_inc(&clnt->cl_count); > spin_unlock(&sn->rpc_client_lock); > error = __rpc_pipefs_event(clnt, event, sb); > rpc_release_client(clnt); > spin_lock(&sn->rpc_client_lock); > if (error) > break; > goto again; > } > spin_unlock(&sn->rpc_client_lock);
You might manage to request reference to the 'next' item while holding the lock. So maybe a loop that has:
error = ... if (error) { rpc_release_client(clnt); break; } spin_lock(&sn->rpc_client_lock); next_clnt = list_next(clnt); if (next_clnt) atomic_inc(&next_clnt->cl_count); spin_unlock(&sn->rpc_client_lock); rpc_release_client(clnt); clnt = next_clnt; } while (clnt != NULL);
David
| |