lkml.org 
[lkml]   [2012]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH v2 1/4] SUNRPC: release per-net clients lock before calling PipeFS dentries creation
Date
From

> 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




\
 
 \ /
  Last update: 2012-02-27 18:15    [W:0.041 / U:7.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site