• NeilBrown's avatar
    NFS: fix disabling of swap · 5bab56ff
    NeilBrown authored
    When swap is activated to a file on an NFSv4 mount we arrange that the
    state manager thread is always present as starting a new thread requires
    memory allocations that might block waiting for swap.
    
    Unfortunately the code for allowing the state manager thread to exit when
    swap is disabled was not tested properly and does not work.
    This can be seen by examining /proc/fs/nfsfs/servers after disabling swap
    and unmounting the filesystem.  The servers file will still list one
    entry.  Also a "ps" listing will show the state manager thread is still
    present.
    
    There are two problems.
     1/ rpc_clnt_swap_deactivate() doesn't walk up the ->cl_parent list to
        find the primary client on which the state manager runs.
    
     2/ The thread is not woken up properly and it immediately goes back to
        sleep without checking whether it is really needed.  Using
        nfs4_schedule_state_manager() ensures a proper wake-up.
    Reported-by: default avatarOlga Kornievskaia <aglo@umich.edu>
    Fixes: 4dc73c67 ("NFSv4: keep state manager thread active if swap is enabled")
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    5bab56ff
clnt.c 78.9 KB