forked from Minki/linux
SUNRPC: Lock the transport layer on shutdown
Avoid all races with the connect/disconnect handlers by taking the transport lock. Reported-by:"Suzuki K. Poulose" <suzuki.poulose@arm.com> Acked-by: Jeff Layton <jlayton@poochiereds.net> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
3ec0c97959
commit
79234c3db6
@ -614,6 +614,7 @@ static void xprt_autoclose(struct work_struct *work)
|
||||
clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
|
||||
xprt->ops->close(xprt);
|
||||
xprt_release_write(xprt, NULL);
|
||||
wake_up_bit(&xprt->state, XPRT_LOCKED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -723,6 +724,7 @@ void xprt_unlock_connect(struct rpc_xprt *xprt, void *cookie)
|
||||
xprt->ops->release_xprt(xprt, NULL);
|
||||
out:
|
||||
spin_unlock_bh(&xprt->transport_lock);
|
||||
wake_up_bit(&xprt->state, XPRT_LOCKED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1394,6 +1396,10 @@ out:
|
||||
static void xprt_destroy(struct rpc_xprt *xprt)
|
||||
{
|
||||
dprintk("RPC: destroying transport %p\n", xprt);
|
||||
|
||||
/* Exclude transport connect/disconnect handlers */
|
||||
wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE);
|
||||
|
||||
del_timer_sync(&xprt->timer);
|
||||
|
||||
rpc_xprt_debugfs_unregister(xprt);
|
||||
|
Loading…
Reference in New Issue
Block a user