Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@cjr.nz>
To: Shyam Prasad N <nspmangalore@gmail.com>,
	CIFS <linux-cifs@vger.kernel.org>,
	ronnie sahlberg <ronniesahlberg@gmail.com>,
	Pavel Shilovsky <piastryyy@gmail.com>,
	Steve French <smfrench@gmail.com>
Subject: Re: DFS tests failing in buildbot
Date: Tue, 08 Mar 2022 12:26:32 -0300	[thread overview]
Message-ID: <87tuc81n4n.fsf@cjr.nz> (raw)
In-Reply-To: <CANT5p=okysnTQhdXixXwJ8KAzukM=dkh2LRxKFKcpsVBW=Ex7w@mail.gmail.com>

Shyam Prasad N <nspmangalore@gmail.com> writes:

> There is a race condition that exists between cifsd and I/O threads
> when the tcp connection is broken. The cifsd thread marks the
> server/session/tcon structures for reconnect, and recreates the
> socket, and sets 1 credit for this server. This only changes after the
> next negotiate/session-setup completes, where it can get more credits.
> During this window, if any ongoing I/O requires more than 1 credit,
> then it will return with smb3_insufficient_credits (note that slightly
> earlier in the same code, we identify reconnect with
> smb3_reconnect_detected, but do nothing about it). The I/O will now
> leak -EHOSTDOWN or -EAGAIN into userspace.

I don't see why it would be a problem returning either -EAGAIN or
-EHOSTDOWN back to userspace on *soft* mounts.  Isn't this what we want?

If the syscall gets signaled while we are waiting for the tcp connection
being restablished, then we return -ERESTARTSYS.  See
wait_event_interruptible_timeout() in smb2_reconnect().

> I feel that we should return a special error (-ERESTARTSYS?) when
> smb3_reconnect_detected, and use this errno to ask the caller to
> restart the syscall.

Userspace doesn't handle -ERESTARTSYS.  When we return -ERESTARTSYS from
a signaled syscall, this means that the kernel will either handle the
signal and restart syscall from the beginning, or return -EINTR back to
userspace.

      reply	other threads:[~2022-03-08 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 11:38 DFS tests failing in buildbot Shyam Prasad N
2022-03-08 15:26 ` Paulo Alcantara [this message]

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=87tuc81n4n.fsf@cjr.nz \
    --to=pc@cjr.nz \
    --cc=linux-cifs@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=piastryyy@gmail.com \
    --cc=ronniesahlberg@gmail.com \
    --cc=smfrench@gmail.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