[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B6E80@saturn3.aculab.com>
Date: Mon, 27 Feb 2012 17:11:37 -0000
From: "David Laight" <David.Laight@...LAB.COM>
To: "Stanislav Kinsbursky" <skinsbursky@...allels.com>,
"Myklebust, Trond" <Trond.Myklebust@...app.com>
Cc: <linux-nfs@...r.kernel.org>,
"Pavel Emelianov" <xemul@...allels.com>, <neilb@...e.de>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"James Bottomley" <jbottomley@...allels.com>,
<bfields@...ldses.org>, <davem@...emloft.net>, <devel@...nvz.org>
Subject: RE: [PATCH v2 1/4] SUNRPC: release per-net clients lock before calling PipeFS dentries creation
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists