linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Morin <guillaume@morinfr.org>
To: linux-nfs@vger.kernel.org
Cc: guillaume@morinfr.org, trond.myklebust@primarydata.com
Subject: [BUG] nfs3 client stops retrying to connect
Date: Thu, 21 May 2015 03:21:55 +0200	[thread overview]
Message-ID: <20150521012155.GA19680@bender.morinfr.org> (raw)

Hi,

Last week we had an NFS outage and one of our NFS servers
went down for quite a while. All clients use it for NFSv3 hard mount
using TCP

Most clients recovered fine when the server came back up but a dozen or
so never did.  They are all running 3.14.35 or later.

All tasks trying to use the mount are in D state and have not recovered.
The last and only nfs-related message in the kernel log is
nfs: server blah not responding, still trying

I spent some time trying to debug the problem.  ftrace showed that the
rpc subsystems is trying to recover:

 <idle>-0     [003] dNs. 4619235.426567: sched_wakeup: comm=daemon pid=4247 prio=120 success=1 target_cpu=003
daemon-4247  [003] .... 4619235.426582: rpc_task_run_action: task:44610@4 flags=00a0 state=0005 status=-110 action=call_connect_status [sunrpc]
daemon-4247  [003] .... 4619235.426583: rpc_connect_status: task:44610@4, status -110
daemon-4247  [003] .... 4619235.426588: rpc_task_run_action: task:44610@4 flags=00a0 state=0005 status=0 action=call_timeout [sunrpc]
daemon-4247  [003] .... 4619235.426589: rpc_task_run_action: task:44610@4 flags=00a0 state=0005 status=0 action=call_bind [sunrpc]
daemon-4247  [003] .... 4619235.426590: rpc_task_run_action: task:44610@4 flags=00a0 state=0005 status=0 action=call_connect [sunrpc]
daemon-4247  [003] ..s. 4619235.426591: rpc_task_sleep: task:44610@4 flags=00a0 state=0005 status=0 timeout=18000 queue=xprt_pending

This goes on and on but despite all this a tcpdump shows that the client
never tries to connect.  There is absolutely no traffic between the
nfs client and the nfs server.

I looked at the daemon in crash and looked at its rpc_task, it looked
pretty legit:
struct rpc_task {
  tk_count = {
    counter = 2
  }, 
  tk_task = {
    next = 0xffff88010bf67008, 
    prev = 0xffff88032f81e018
  }, 
  tk_client = 0xffff88032f81e000, 
  tk_rqstp = 0xffff8803310a4c00, 
  tk_msg = {
    rpc_proc = 0xffffffffa08b7b18, 
    rpc_argp = 0xffff88016abe6a58, 
    rpc_resp = 0xffff880165d6db00, 
    rpc_cred = 0x0
  }, 
  tk_callback = 0xffffffffa06f19e0 <xprt_connect_status>, 
  tk_action = 0xffffffffa06ee310 <call_connect_status>, 
  tk_ops = 0xffffffffa070db20 <rpc_default_ops>, 
  tk_calldata = 0x0, 
  tk_timeout = 36000, 
  tk_runstate = 6, 
  tk_workqueue = 0x0, 
  tk_waitqueue = 0xffff880331352a58, 
  u = {
    tk_work = {
      data = {
        counter = -131927684863392
      }, 
      entry = {
        next = 0xffff880331352a60, 
        prev = 0x0
      }, 
      func = 0x0
    }, 
    tk_wait = {
      list = {
        next = 0xffff880331352a60, 
        prev = 0xffff880331352a60
      }, 
      links = {
        next = 0x0, 
        prev = 0x0
      }, 
      timer_list = {
        next = 0xffff880331352b00, 
        prev = 0xffff880331352b00
      }, 
      expires = 5680095648
    }
  }, 
  tk_start = {
    tv64 = 4088588208239840
  }, 
  tk_owner = 4247, 
  tk_status = 0, 
  tk_flags = 160, 
  tk_timeouts = 2929, 
  tk_pid = 44610, 
  tk_priority = 1 '\001', 
  tk_garb_retry = 2 '\002', 
  tk_cred_retry = 2 '\002', 
  tk_rebind_retry = 2 '\002'


When I dug into the nested rpc_xprt object, I noticed that the state was 0x15 which is
XPRT_LOCKED|XPRT_CONNECTING|XPRT_BOUND

XPRT_CONNECTING is surprising since there was definitely no traffic
going on between the server and the client (and it was the case for
a few days)

If xprt_connect() is called while XPRT_CONNECTING is set, we do not try to
connect() again until it cleared.  It seemed it was erroneously set.

To test this theory, I wrote a module that when loaded cleared that bit
in the xprt_task.  As soon as the rpc task timed out, the client tried
to connect and the mount recovered gracefully.

I am not quite sure how it got into that state though as
xs_tcp_setup_socket always clears it.  But it definitely happened on a
few machines.

If somehow xs_close() is called before the callback
happens, I think it could leave XPRT_CONNECTING on forever though
(since xs_tcp_setup_socket is never called), see
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/net/sunrpc/xprtsock.c?id=refs/tags/v3.14.43#n887

I am still have a few clients with the stuck mount so I could gather
more information if necessary.

Thanks in advance

Guillaume.

-- 
Guillaume Morin <guillaume@morinfr.org>

             reply	other threads:[~2015-05-21  1:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21  1:21 Guillaume Morin [this message]
2015-06-03 18:31 ` [BUG] nfs3 client stops retrying to connect Chuck Lever
2015-06-04 20:06   ` Guillaume Morin
2015-06-04 21:23     ` Chuck Lever
2015-06-04 22:14       ` Guillaume Morin
2015-06-05  2:57         ` Chuck Lever
2015-06-08 17:10           ` Guillaume Morin
2015-06-08 17:50             ` Chuck Lever
2015-06-08 18:12               ` Guillaume Morin
2015-08-25 15:16                 ` Guillaume Morin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150521012155.GA19680@bender.morinfr.org \
    --to=guillaume@morinfr.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).