]> git.baikalelectronics.ru Git - kernel.git/commit
NFSv4: Fix a potential sleep while atomic in nfs4_do_reclaim()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 3 Aug 2019 14:11:27 +0000 (10:11 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 5 Aug 2019 02:35:40 +0000 (22:35 -0400)
commitd65515bde678223a3d67b30ce5b01a8585c0b54f
treedfa88210f8f4660ce07e597ba5dda83e6aee73af
parent15d66d01ba99015264f8a6a6b3dd7fbad8283a7d
NFSv4: Fix a potential sleep while atomic in nfs4_do_reclaim()

John Hubbard reports seeing the following stack trace:

nfs4_do_reclaim
   rcu_read_lock /* we are now in_atomic() and must not sleep */
       nfs4_purge_state_owners
           nfs4_free_state_owner
               nfs4_destroy_seqid_counter
                   rpc_destroy_wait_queue
                       cancel_delayed_work_sync
                           __cancel_work_timer
                               __flush_work
                                   start_flush_work
                                       might_sleep:
                                        (kernel/workqueue.c:2975: BUG)

The solution is to separate out the freeing of the state owners
from nfs4_purge_state_owners(), and perform that outside the atomic
context.

Reported-by: John Hubbard <jhubbard@nvidia.com>
Fixes: 170f7d61466d3 ("NFS: Cache state owners after files are closed")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4_fs.h
fs/nfs/nfs4client.c
fs/nfs/nfs4state.c