Scott Mayhew c156618e15 nfs: fix a deadlock in nfs client initialization
The following deadlock can occur between a process waiting for a client
to initialize in while walking the client list during nfsv4 server trunking
detection and another process waiting for the nfs_clid_init_mutex so it
can initialize that client:

Process 1                               Process 2
---------                               ---------
spin_lock(&nn->nfs_client_lock);
list_add_tail(&CLIENTA->cl_share_link,
        &nn->nfs_client_list);
spin_unlock(&nn->nfs_client_lock);
                                        spin_lock(&nn->nfs_client_lock);
                                        list_add_tail(&CLIENTB->cl_share_link,
                                                &nn->nfs_client_list);
                                        spin_unlock(&nn->nfs_client_lock);
                                        mutex_lock(&nfs_clid_init_mutex);
                                        nfs41_walk_client_list(clp, result, cred);
                                        nfs_wait_client_init_complete(CLIENTA);
(waiting for nfs_clid_init_mutex)

Make sure nfs_match_client() only evaluates clients that have completed
initialization in order to prevent that deadlock.

This patch also fixes v4.0 trunking behavior by not marking the client
NFS_CS_READY until the clientid has been confirmed.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2017-12-15 14:31:49 -05:00
..
2017-11-17 16:43:46 -05:00
2017-07-13 17:12:04 -04:00
2017-07-13 17:12:04 -04:00
2017-07-13 15:58:04 -04:00
2015-02-03 11:06:34 -08:00
2016-03-31 00:30:15 -04:00
2017-07-13 15:58:04 -04:00
2017-04-20 13:39:35 -04:00
2015-04-23 15:16:14 -04:00
2015-04-23 15:16:14 -04:00
2016-05-17 15:47:55 -04:00
2017-09-11 22:20:38 -04:00
2017-07-13 15:58:04 -04:00
2017-09-11 22:20:38 -04:00