Commit 9827144b authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFS: Treat ENETUNREACH errors as fatal in containers



Propagate the NFS_MOUNT_NETUNREACH_FATAL flag to work with the generic
NFS client. If the flag is set, the client will receive ENETDOWN and
ENETUNREACH errors from the RPC layer, and is expected to treat them as
being fatal.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Tested-by: default avatarJeff Layton <jlayton@kernel.org>
Acked-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 487fae09
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -546,6 +546,8 @@ int nfs_create_rpc_client(struct nfs_client *clp,
		args.flags |= RPC_CLNT_CREATE_NOPING;
	if (test_bit(NFS_CS_REUSEPORT, &clp->cl_flags))
		args.flags |= RPC_CLNT_CREATE_REUSEPORT;
	if (test_bit(NFS_CS_NETUNREACH_FATAL, &clp->cl_flags))
		args.flags |= RPC_CLNT_CREATE_NETUNREACH_FATAL;

	if (!IS_ERR(clp->cl_rpcclient))
		return 0;
@@ -709,6 +711,9 @@ static int nfs_init_server(struct nfs_server *server,
	if (ctx->flags & NFS_MOUNT_NORESVPORT)
		set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags);

	if (ctx->flags & NFS_MOUNT_NETUNREACH_FATAL)
		__set_bit(NFS_CS_NETUNREACH_FATAL, &cl_init.init_flags);

	/* Allocate or find a client reference we can use */
	clp = nfs_get_client(&cl_init);
	if (IS_ERR(clp))
+2 −0
Original line number Diff line number Diff line
@@ -233,6 +233,8 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
	__set_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags);
	if (test_bit(NFS_CS_PNFS, &cl_init->init_flags))
		__set_bit(NFS_CS_PNFS, &clp->cl_flags);
	if (test_bit(NFS_CS_NETUNREACH_FATAL, &cl_init->init_flags))
		__set_bit(NFS_CS_NETUNREACH_FATAL, &clp->cl_flags);
	/*
	 * Set up the connection to the server before we add add to the
	 * global list.
+3 −0
Original line number Diff line number Diff line
@@ -195,6 +195,9 @@ static int nfs4_map_errors(int err)
		return -EBUSY;
	case -NFS4ERR_NOT_SAME:
		return -ENOTSYNC;
	case -ENETDOWN:
	case -ENETUNREACH:
		break;
	default:
		dprintk("%s could not handle NFSv4 error %d\n",
				__func__, -err);
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ struct nfs_client {
#define NFS_CS_DS		7		/* - Server is a DS */
#define NFS_CS_REUSEPORT	8		/* - reuse src port on reconnect */
#define NFS_CS_PNFS		9		/* - Server used for pnfs */
#define NFS_CS_NETUNREACH_FATAL	10		/* - ENETUNREACH errors are fatal */
	struct sockaddr_storage	cl_addr;	/* server identifier */
	size_t			cl_addrlen;
	char *			cl_hostname;	/* hostname of server */
+4 −1
Original line number Diff line number Diff line
@@ -64,7 +64,9 @@ struct rpc_clnt {
				cl_noretranstimeo: 1,/* No retransmit timeouts */
				cl_autobind : 1,/* use getport() */
				cl_chatty   : 1,/* be verbose */
				cl_shutdown : 1;/* rpc immediate -EIO */
				cl_shutdown : 1,/* rpc immediate -EIO */
				cl_netunreach_fatal : 1;
						/* Treat ENETUNREACH errors as fatal */
	struct xprtsec_parms	cl_xprtsec;	/* transport security policy */

	struct rpc_rtt *	cl_rtt;		/* RTO estimator data */
@@ -175,6 +177,7 @@ struct rpc_add_xprt_test {
#define RPC_CLNT_CREATE_SOFTERR		(1UL << 10)
#define RPC_CLNT_CREATE_REUSEPORT	(1UL << 11)
#define RPC_CLNT_CREATE_CONNECTED	(1UL << 12)
#define RPC_CLNT_CREATE_NETUNREACH_FATAL	(1UL << 13)

struct rpc_clnt *rpc_create(struct rpc_create_args *args);
struct rpc_clnt	*rpc_bind_new_program(struct rpc_clnt *,
Loading