NFSv4/4.1: Fix bugs in nfs4[01]_walk_client_list
commit7b1f1fd1842e6ede25183c267ae733a7f67f00bc
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 5 Apr 2013 20:11:11 +0000 (5 16:11 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 5 Apr 2013 20:59:19 +0000 (5 16:59 -0400)
tree5849a9b1b608a8a88adb5551d19a7efecfafe3b2
parentb193d59a4863ea670872d76dc99231ddeb598625
NFSv4/4.1: Fix bugs in nfs4[01]_walk_client_list

It is unsafe to use list_for_each_entry_safe() here, because
when we drop the nn->nfs_client_lock, we pin the _current_ list
entry and ensure that it stays in the list, but we don't do the
same for the _next_ list entry. Use of list_for_each_entry() is
therefore the correct thing to do.

Also fix the refcounting in nfs41_walk_client_list().

Finally, ensure that the nfs_client has finished being initialised
and, in the case of NFSv4.1, that the session is set up.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Bryan Schumaker <bjschuma@netapp.com>
Cc: stable@vger.kernel.org [>= 3.7]
fs/nfs/nfs4client.c