]> git.baikalelectronics.ru Git - kernel.git/commit
NFSv4: Fix races in the legacy idmapper upcall
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 13 Jul 2022 21:46:52 +0000 (17:46 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 13 Jul 2022 21:46:52 +0000 (17:46 -0400)
commit86563ec2484b730dfa21bb147e2b6c8d2e49f309
tree2eb68c18db5c5b4ed9ef9fbbb6abe0c1637f89df
parent8d6b622700d2fe129925b0987918548f8f3bde14
NFSv4: Fix races in the legacy idmapper upcall

nfs_idmap_instantiate() will cause the process that is waiting in
request_key_with_auxdata() to wake up and exit. If there is a second
process waiting for the idmap->idmap_mutex, then it may wake up and
start a new call to request_key_with_auxdata(). If the call to
idmap_pipe_downcall() from the first process has not yet finished
calling nfs_idmap_complete_pipe_upcall_locked(), then we may end up
triggering the WARN_ON_ONCE() in nfs_idmap_prepare_pipe_upcall().

The fix is to ensure that we clear idmap->idmap_upcall_data before
calling nfs_idmap_instantiate().

Fixes: 38f0cc4936eb ("NFSv4: Clean up the legacy idmapper upcall")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4idmap.c