Skip to content

Commit 6dd5884

Browse files
committed
Merge tag 'nfs-for-5.18-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client bugfixes from Trond Myklebust: "One more pull request. There was a bug in the fix to ensure that gss- proxy continues to work correctly after we fixed the AF_LOCAL socket leak in the RPC code. This therefore reverts that broken patch, and replaces it with one that works correctly. Stable fixes: - SUNRPC: Ensure that the gssproxy client can start in a connected state Bugfixes: - Revert "SUNRPC: Ensure gss-proxy connects on setup" - nfs: fix broken handling of the softreval mount option" * tag 'nfs-for-5.18-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: nfs: fix broken handling of the softreval mount option SUNRPC: Ensure that the gssproxy client can start in a connected state Revert "SUNRPC: Ensure gss-proxy connects on setup"
2 parents 364a453 + 085d16d commit 6dd5884

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

fs/nfs/fs_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
517517
if (result.negated)
518518
ctx->flags &= ~NFS_MOUNT_SOFTREVAL;
519519
else
520-
ctx->flags &= NFS_MOUNT_SOFTREVAL;
520+
ctx->flags |= NFS_MOUNT_SOFTREVAL;
521521
break;
522522
case Opt_posix:
523523
if (result.negated)

include/linux/sunrpc/clnt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ struct rpc_add_xprt_test {
160160
#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9)
161161
#define RPC_CLNT_CREATE_SOFTERR (1UL << 10)
162162
#define RPC_CLNT_CREATE_REUSEPORT (1UL << 11)
163-
#define RPC_CLNT_CREATE_IGNORE_NULL_UNAVAIL (1UL << 12)
163+
#define RPC_CLNT_CREATE_CONNECTED (1UL << 12)
164164

165165
struct rpc_clnt *rpc_create(struct rpc_create_args *args);
166166
struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,

net/sunrpc/auth_gss/gss_rpc_upcall.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ static int gssp_rpc_create(struct net *net, struct rpc_clnt **_clnt)
9797
* timeout, which would result in reconnections being
9898
* done without the correct namespace:
9999
*/
100-
.flags = RPC_CLNT_CREATE_IGNORE_NULL_UNAVAIL |
100+
.flags = RPC_CLNT_CREATE_NOPING |
101+
RPC_CLNT_CREATE_CONNECTED |
101102
RPC_CLNT_CREATE_NO_IDLE_TIMEOUT
102103
};
103104
struct rpc_clnt *clnt;

net/sunrpc/clnt.c

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ static int rpc_encode_header(struct rpc_task *task,
7676
static int rpc_decode_header(struct rpc_task *task,
7777
struct xdr_stream *xdr);
7878
static int rpc_ping(struct rpc_clnt *clnt);
79+
static int rpc_ping_noreply(struct rpc_clnt *clnt);
7980
static void rpc_check_timeout(struct rpc_task *task);
8081

8182
static void rpc_register_client(struct rpc_clnt *clnt)
@@ -479,9 +480,12 @@ static struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
479480

480481
if (!(args->flags & RPC_CLNT_CREATE_NOPING)) {
481482
int err = rpc_ping(clnt);
482-
if ((args->flags & RPC_CLNT_CREATE_IGNORE_NULL_UNAVAIL) &&
483-
err == -EOPNOTSUPP)
484-
err = 0;
483+
if (err != 0) {
484+
rpc_shutdown_client(clnt);
485+
return ERR_PTR(err);
486+
}
487+
} else if (args->flags & RPC_CLNT_CREATE_CONNECTED) {
488+
int err = rpc_ping_noreply(clnt);
485489
if (err != 0) {
486490
rpc_shutdown_client(clnt);
487491
return ERR_PTR(err);
@@ -2712,6 +2716,10 @@ static const struct rpc_procinfo rpcproc_null = {
27122716
.p_decode = rpcproc_decode_null,
27132717
};
27142718

2719+
static const struct rpc_procinfo rpcproc_null_noreply = {
2720+
.p_encode = rpcproc_encode_null,
2721+
};
2722+
27152723
static void
27162724
rpc_null_call_prepare(struct rpc_task *task, void *data)
27172725
{
@@ -2765,6 +2773,28 @@ static int rpc_ping(struct rpc_clnt *clnt)
27652773
return status;
27662774
}
27672775

2776+
static int rpc_ping_noreply(struct rpc_clnt *clnt)
2777+
{
2778+
struct rpc_message msg = {
2779+
.rpc_proc = &rpcproc_null_noreply,
2780+
};
2781+
struct rpc_task_setup task_setup_data = {
2782+
.rpc_client = clnt,
2783+
.rpc_message = &msg,
2784+
.callback_ops = &rpc_null_ops,
2785+
.flags = RPC_TASK_SOFT | RPC_TASK_SOFTCONN | RPC_TASK_NULLCREDS,
2786+
};
2787+
struct rpc_task *task;
2788+
int status;
2789+
2790+
task = rpc_run_task(&task_setup_data);
2791+
if (IS_ERR(task))
2792+
return PTR_ERR(task);
2793+
status = task->tk_status;
2794+
rpc_put_task(task);
2795+
return status;
2796+
}
2797+
27682798
struct rpc_cb_add_xprt_calldata {
27692799
struct rpc_xprt_switch *xps;
27702800
struct rpc_xprt *xprt;

0 commit comments

Comments
 (0)