From: Jeff Layton <jlayton@kernel.org>
To: Trond Myklebust <trondmy@hammerspace.com>,
"chuck.lever@oracle.com" <chuck.lever@oracle.com>,
"zhitao.li@smartx.com" <zhitao.li@smartx.com>,
"kolga@netapp.com" <kolga@netapp.com>,
"anna@kernel.org" <anna@kernel.org>,
"tom@talpey.com" <tom@talpey.com>,
"neilb@suse.de" <neilb@suse.de>,
"Dai.Ngo@oracle.com" <Dai.Ngo@oracle.com>
Cc: "huangping@smartx.com" <huangping@smartx.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: PROBLEM: NFS client IO fails with ERESTARTSYS when another mount point with the same export is unmounted with force [NFS] [SUNRPC]
Date: Fri, 23 Feb 2024 05:31:33 -0500 [thread overview]
Message-ID: <3754ac34c55dd82a4957967ec0a4e490cdc0d989.camel@kernel.org> (raw)
In-Reply-To: <16d8c8e88490ee92750b26f2c438e1329dea0061.camel@hammerspace.com>
On Thu, 2024-02-22 at 15:20 +0000, Trond Myklebust wrote:
> On Thu, 2024-02-22 at 06:05 -0500, Jeff Layton wrote:
> > On Wed, 2024-02-21 at 13:48 +0000, Trond Myklebust wrote:
> > > On Wed, 2024-02-21 at 16:20 +0800, Zhitao Li wrote:
> > > > [You don't often get email from zhitao.li@smartx.com. Learn why
> > > > this
> > > > is important at https://aka.ms/LearnAboutSenderIdentification ]
> > > >
> > > > Hi, everyone,
> > > >
> > > > - Facts:
> > > > I have a remote NFS export and I mount the same export on two
> > > > different directories in my OS with the same options. There is an
> > > > inflight IO under one mounted directory. And then I unmount
> > > > another
> > > > mounted directory with force. The inflight IO ends up with
> > > > "Unknown
> > > > error 512", which is ERESTARTSYS.
> > > >
> > >
> > > All of the above is well known. That's because forced umount
> > > affects
> > > the entire filesystem. Why are you using it here in the first
> > > place? It
> > > is not intended for casual use.
> > >
> >
> > While I agree Trond's above statement, the kernel is not supposed to
> > leak error codes that high into userland. Are you seeing ERESTARTSYS
> > being returned to system calls? If so, which ones?
>
> The point of forced umount is to kill all RPC calls associated with the
> filesystem in order to unblock the umount. Basically, it triggers this
> code before the unmount starts:
>
> void nfs_umount_begin(struct super_block *sb)
> {
> struct nfs_server *server;
> struct rpc_clnt *rpc;
>
> server = NFS_SB(sb);
> /* -EIO all pending I/O */
> rpc = server->client_acl;
> if (!IS_ERR(rpc))
> rpc_killall_tasks(rpc);
> rpc = server->client;
> if (!IS_ERR(rpc))
> rpc_killall_tasks(rpc);
> }
>
> So yes, that does signal all the way up to the application level, and
> it is very much intended to do so.
Returning an error to userland in this situation is fine, but userland
programs aren't really equipped to deal with error numbers in this
range.
Emphasis on the first sentence in the comment in include/linux/errno.h:
-------------------8<-----------------------
/*
* These should never be seen by user programs. To return one of ERESTART*
* codes, signal_pending() MUST be set. Note that ptrace can observe these
* at syscall exit tracing, but they will never be left for the debugged user
* process to see.
*/
#define ERESTARTSYS 512
#define ERESTARTNOINTR 513
#define ERESTARTNOHAND 514 /* restart if no handler.. */
#define ENOIOCTLCMD 515 /* No ioctl command */
#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */
#define EPROBE_DEFER 517 /* Driver requests probe retry */
#define EOPENSTALE 518 /* open found a stale dentry */
#define ENOPARAM 519 /* Parameter not supported */
-------------------8<-----------------------
If these values are leaking into userland, then that seems like a bug.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-02-23 10:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 8:20 PROBLEM: NFS client IO fails with ERESTARTSYS when another mount point with the same export is unmounted with force [NFS] [SUNRPC] Zhitao Li
2024-02-21 13:48 ` Trond Myklebust
2024-02-22 3:05 ` Zhitao Li
2024-02-22 11:05 ` Jeff Layton
2024-02-22 15:20 ` Trond Myklebust
2024-02-23 3:44 ` Zhitao Li
2024-02-23 10:31 ` Jeff Layton [this message]
2024-02-27 2:35 ` Zhitao Li
2024-02-23 3:20 ` Zhitao Li
2024-02-27 23:55 ` NeilBrown
2024-02-28 3:37 ` Zhitao Li
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=3754ac34c55dd82a4957967ec0a4e490cdc0d989.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=huangping@smartx.com \
--cc=kolga@netapp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tom@talpey.com \
--cc=trondmy@hammerspace.com \
--cc=zhitao.li@smartx.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