OpenVZ Forum


Home » Mailing lists » Devel » [PATCH v2 0/4] SUNRPC: several fixes around PipeFS objects
RE: [PATCH v2 2/4] NFS: release per-net clients lock before calling PipeFS dentries creation [message #45345 is a reply to message #45342] Mon, 27 February 2012 15:59 Go to previous messageGo to previous message
David Laight is currently offline  David Laight
Messages: 3
Registered: December 2011
Junior Member
> spin_lock(&nn->nfs_client_lock);
> - list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
> + list_for_each_entry_safe(clp, tmp, &nn->nfs_client_list,
cl_share_link) {
> if (clp->rpc_ops != &nfs_v4_clientops)
> continue;
> + atomic_inc(&clp->cl_count);
> + spin_unlock(&nn->nfs_client_lock);
> error = __rpc_pipefs_event(clp, event, sb);
> + nfs_put_client(clp);
> if (error)
> break;
> + spin_lock(&nn->nfs_client_lock);
> }
> spin_unlock(&nn->nfs_client_lock);
> return error;

The locking doesn't look right if the loop breaks on error.
(Same applied to patch v2 1/4)

Although list_fo_each_entry_safe() allows the current entry
to be freed, I don't believe it allows the 'next' to be freed.
I doubt there is protection against that happening.

Do you need to use an atomic_inc() for cl_count.
I'd guess the nfs_client_lock is usually held?

David
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH 2/4] NFS: replace per-net client lock by mutex
Next Topic: [PATCH v3 0/4] SUNRPC: several fixes around PipeFS objects
Goto Forum:
  


Current Time: Sat Aug 23 10:57:11 GMT 2025

Total time taken to generate the page: 0.07232 seconds