Skip to contentSkip to conversation

NFS: Make NFS v4.0 KConfig-urable

PATCH Superseded Anna Schumaker 2 participants 16 messages Jan 16 – Jan 18

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Anna Schumaker

author maintainer
#0 lore raw

cover NFS: Make NFS v4.0 KConfig-urable

From: Anna Schumaker <[email protected]>

A desire to deprecate NFS v4.0 came up as a discussion topic during the October Bake-a-thon last year. This patchset takes the first step by moving NFS v4.0 only code into new files prefixed with "nfs40" and introducing a KConfig option to compile without NFS v4.0 support.

At the same time, I promote NFS v4.1 to be the default NFSv4 minorversion included in the kernel to prevent the situation where we have NFS v4 enabled without any minor versions.

I'm sure I missed a bunch of stuff in nfs4proc.c that can be moved over to nfs40proc.c, but I figure I should get some eyes on this before going any farther incase I need to take a different approach somewhere.

Thoughts?
Anna

Anna Schumaker (14):
NFS: Move nfs40_call_sync_ops into nfs40proc.c
NFS: Split out the nfs40_reboot_recovery_ops into nfs40client.c
NFS: Split out the nfs40_nograce_recovery_ops into nfs40proc.c
NFS: Split out the nfs40_state_renewal_ops into nfs40proc.c
NFS: Split out the nfs40_mig_recovery_ops to nfs40proc.c
NFS: Move the NFS v4.0 minor version ops into nfs40proc.c
NFS: Make the various NFS v4.0 operations static again
NFS: Move nfs40_shutdown_client into nfs40client.c
NFS: Move nfs40_init_client into nfs40client.c
NFS: Move NFS v4.0 pathdown recovery into nfs40client.c
NFS: Pass a struct nfs_client to nfs4_init_sequence()
NFS: Move sequence slot operations into minorversion operations
NFS: Add a way to disable NFS v4.0 via KConfig
NFS: Merge CONFIG_NFS_V4_1 with CONFIG_NFS_V4

 fs/nfs/Kconfig            |  26 +-
 fs/nfs/Makefile           |   4 +-
 fs/nfs/callback.c         |  13 +-
 fs/nfs/callback.h         |   3 -
 fs/nfs/callback_proc.c    |   3 -
 fs/nfs/callback_xdr.c     |  21 --
 fs/nfs/client.c           |   8 +-
 fs/nfs/fs_context.c       |   3 +-
 fs/nfs/internal.h         |  15 +-
 fs/nfs/netns.h            |   4 +-
 fs/nfs/nfs40.h            |  19 ++
 fs/nfs/nfs40client.c      | 247 ++++++++++++++
 fs/nfs/nfs40proc.c        | 395 ++++++++++++++++++++++
 fs/nfs/nfs42proc.c        |  13 +-
 fs/nfs/nfs4_fs.h          |  83 ++---
 fs/nfs/nfs4client.c       | 193 +----------
 fs/nfs/nfs4proc.c         | 682 +++++++-------------------------------
 fs/nfs/nfs4session.c      |   4 -
 fs/nfs/nfs4session.h      |  23 --
 fs/nfs/nfs4state.c        |  91 +----
 fs/nfs/nfs4trace.c        |   2 -
 fs/nfs/nfs4trace.h        |  16 -
 fs/nfs/nfs4xdr.c          |  87 -----
 fs/nfs/pnfs.h             |   6 +-
 fs/nfs/read.c             |   4 +-
 fs/nfs/super.c            |  16 +-
 fs/nfs/sysfs.c            |  10 +-
 fs/nfs/write.c            |   2 +-
 include/linux/nfs_fs_sb.h |   2 -
 include/linux/nfs_xdr.h   |   7 +-
 30 files changed, 881 insertions(+), 1121 deletions(-)
 create mode 100644 fs/nfs/nfs40.h
 create mode 100644 fs/nfs/nfs40client.c
 create mode 100644 fs/nfs/nfs40proc.c
Signature · 1 line
2.52.0
author maintainer
#1 lore raw

PATCH 1/14 NFS: Move nfs40_call_sync_ops into nfs40proc.c

From: Anna Schumaker <[email protected]>

This is the first step in extracting NFS v4.0 into its own set of files that can be disabled through Kconfig.

---
 fs/nfs/Makefile    |  2 +-
 fs/nfs/nfs40.h     |  8 ++++++++
 fs/nfs/nfs40proc.c | 24 ++++++++++++++++++++++++
 fs/nfs/nfs4_fs.h   |  6 ++++++
 fs/nfs/nfs4proc.c  | 25 +------------------------
 5 files changed, 40 insertions(+), 25 deletions(-)
 create mode 100644 fs/nfs/nfs40.h
 create mode 100644 fs/nfs/nfs40proc.c
fs/nfs/Makefile +1 -1
index 9fb2f2cac87e..937c775a04a3 100644
@@ -27,7 +27,7 @@ CFLAGS_nfs4trace.o += -I$(src)
 nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
 	  delegation.o nfs4idmap.o callback.o callback_xdr.o callback_proc.o \
 	  nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \
-	  dns_resolve.o nfs4trace.o
+	  dns_resolve.o nfs4trace.o nfs40proc.o
 nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o
 nfsv4-$(CONFIG_SYSCTL)	+= nfs4sysctl.o
 nfsv4-$(CONFIG_NFS_V4_1)	+= pnfs.o pnfs_dev.o pnfs_nfs.o
fs/nfs/nfs40.h new file +8 -0
new file mode 100644
index 000000000000..58a59109987a
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LINUX_FS_NFS_NFS4_0_H
+#define __LINUX_FS_NFS_NFS4_0_H
+
+
+extern const struct rpc_call_ops nfs40_call_sync_ops;
+
+#endif /* __LINUX_FS_NFS_NFS4_0_H */
fs/nfs/nfs40proc.c new file +24 -0
new file mode 100644
index 000000000000..6d27dedad055
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/nfs4.h>
+#include <linux/nfs.h>
+#include <linux/sunrpc/sched.h>
+#include <linux/nfs_fs.h>
+#include "nfs4_fs.h"
+
+static void nfs40_call_sync_prepare(struct rpc_task *task, void *calldata)
+{
+	struct nfs4_call_sync_data *data = calldata;
+	nfs4_setup_sequence(data->seq_server->nfs_client,
+				data->seq_args, data->seq_res, task);
+}
+
+static void nfs40_call_sync_done(struct rpc_task *task, void *calldata)
+{
+	struct nfs4_call_sync_data *data = calldata;
+	nfs4_sequence_done(task, data->seq_res);
+}
+
+const struct rpc_call_ops nfs40_call_sync_ops = {
+	.rpc_call_prepare = nfs40_call_sync_prepare,
+	.rpc_call_done = nfs40_call_sync_done,
+};
fs/nfs/nfs4_fs.h +6 -0
index c34c89af9c7d..575343261c9a 100644
@@ -286,6 +286,12 @@ int nfs4_replace_transport(struct nfs_server *server,
 size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr_storage *ss,
 			     size_t salen, struct net *net, int port);
 /* nfs4proc.c */
+struct nfs4_call_sync_data {
+	const struct nfs_server *seq_server;
+	struct nfs4_sequence_args *seq_args;
+	struct nfs4_sequence_res *seq_res;
+};
+
 extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception *);
 extern int nfs4_async_handle_error(struct rpc_task *task,
 				   struct nfs_server *server,
fs/nfs/nfs4proc.c +1 -24
index ec1ce593dea2..18f24b9c1dfe 100644
@@ -67,6 +67,7 @@
 #include "nfs4idmap.h"
 #include "nfs4session.h"
 #include "fscache.h"
+#include "nfs40.h"
 #include "nfs42.h"
 
 #include "nfs4trace.h"
@@ -769,12 +770,6 @@ static void renew_lease(const struct nfs_server *server, unsigned long timestamp
 		do_renew_lease(clp, timestamp);
 }
 
-struct nfs4_call_sync_data {
-	const struct nfs_server *seq_server;
-	struct nfs4_sequence_args *seq_args;
-	struct nfs4_sequence_res *seq_res;
-};
-
 void nfs4_init_sequence(struct nfs4_sequence_args *args,
 			struct nfs4_sequence_res *res, int cache_reply,
 			int privileged)
@@ -1174,24 +1169,6 @@ int nfs4_setup_sequence(struct nfs_client *client,
 }
 EXPORT_SYMBOL_GPL(nfs4_setup_sequence);
 
-static void nfs40_call_sync_prepare(struct rpc_task *task, void *calldata)
-{
-	struct nfs4_call_sync_data *data = calldata;
-	nfs4_setup_sequence(data->seq_server->nfs_client,
-				data->seq_args, data->seq_res, task);
-}
-
-static void nfs40_call_sync_done(struct rpc_task *task, void *calldata)
-{
-	struct nfs4_call_sync_data *data = calldata;
-	nfs4_sequence_done(task, data->seq_res);
-}
-
-static const struct rpc_call_ops nfs40_call_sync_ops = {
-	.rpc_call_prepare = nfs40_call_sync_prepare,
-	.rpc_call_done = nfs40_call_sync_done,
-};
-
 static int nfs4_call_sync_custom(struct rpc_task_setup *task_setup)
 {
 	int ret;
Signature · 1 line
2.52.0
author maintainer
#2 lore raw

PATCH 2/14 NFS: Split out the nfs40_reboot_recovery_ops into nfs40client.c

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

---
 fs/nfs/Makefile      |   2 +-
 fs/nfs/internal.h    |   3 -
 fs/nfs/nfs40.h       |   7 ++
 fs/nfs/nfs40client.c | 188 +++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/nfs40proc.c   |   9 +++
 fs/nfs/nfs4_fs.h     |   7 ++
 fs/nfs/nfs4client.c  | 132 +-----------------------------
 fs/nfs/nfs4proc.c    |  13 +--
 fs/nfs/nfs4state.c   |  49 -----------
 9 files changed, 216 insertions(+), 194 deletions(-)
 create mode 100644 fs/nfs/nfs40client.c
fs/nfs/Makefile +1 -1
index 937c775a04a3..d05e69c00fe1 100644
@@ -27,7 +27,7 @@ CFLAGS_nfs4trace.o += -I$(src)
 nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
 	  delegation.o nfs4idmap.o callback.o callback_xdr.o callback_proc.o \
 	  nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \
-	  dns_resolve.o nfs4trace.o nfs40proc.o
+	  dns_resolve.o nfs4trace.o nfs40proc.o nfs40client.o
 nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o
 nfsv4-$(CONFIG_SYSCTL)	+= nfs4sysctl.o
 nfsv4-$(CONFIG_NFS_V4_1)	+= pnfs.o pnfs_dev.o pnfs_nfs.o
fs/nfs/internal.h +0 -3
index 2e596244799f..e99998e515c0 100644
@@ -739,9 +739,6 @@ extern ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq, loff_t offset);
 /* nfs4proc.c */
 extern struct nfs_client *nfs4_init_client(struct nfs_client *clp,
 			    const struct nfs_client_initdata *);
-extern int nfs40_walk_client_list(struct nfs_client *clp,
-				struct nfs_client **result,
-				const struct cred *cred);
 extern int nfs41_walk_client_list(struct nfs_client *clp,
 				struct nfs_client **result,
 				const struct cred *cred);
fs/nfs/nfs40.h +7 -0
index 58a59109987a..ad57172b49a3 100644
@@ -3,6 +3,13 @@
 #define __LINUX_FS_NFS_NFS4_0_H
 
 
+/* nfs40proc.c */
 extern const struct rpc_call_ops nfs40_call_sync_ops;
+extern const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops;
+
+/* nfs40state.c */
+int nfs40_discover_server_trunking(struct nfs_client *clp,
+				   struct nfs_client **result,
+				   const struct cred *cred);
 
 #endif /* __LINUX_FS_NFS_NFS4_0_H */
fs/nfs/nfs40client.c new file +188 -0

188 lines not on this page · raw message

fs/nfs/nfs40proc.c +9 -0
index 6d27dedad055..b2cc7519b226 100644
@@ -22,3 +22,12 @@ const struct rpc_call_ops nfs40_call_sync_ops = {
 	.rpc_call_prepare = nfs40_call_sync_prepare,
 	.rpc_call_done = nfs40_call_sync_done,
 };
+
+const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
+	.owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT,
+	.state_flag_bit	= NFS_STATE_RECLAIM_REBOOT,
+	.recover_open	= nfs4_open_reclaim,
+	.recover_lock	= nfs4_lock_reclaim,
+	.establish_clid = nfs4_init_clientid,
+	.detect_trunking = nfs40_discover_server_trunking,
+};
fs/nfs/nfs4_fs.h +7 -0
index 575343261c9a..246a43d172f9 100644
@@ -277,6 +277,11 @@ int nfs_atomic_open(struct inode *, struct dentry *, struct file *,
 /* fs_context.c */
 extern struct file_system_type nfs4_fs_type;
 
+/* nfs4client.c */
+struct nfs_net;
+int nfs4_match_client(struct nfs_client *pos, struct nfs_client *new,
+		      struct nfs_client **prev, struct nfs_net *nn);
+
 /* nfs4namespace.c */
 struct rpc_clnt *nfs4_negotiate_security(struct rpc_clnt *, struct inode *,
 					 const struct qstr *);
@@ -345,6 +350,8 @@ extern void nfs4_update_changeattr(struct inode *dir,
 				   unsigned long cache_validity);
 extern int nfs4_buf_to_pages_noslab(const void *buf, size_t buflen,
 				    struct page **pages);
+extern int nfs4_open_reclaim(struct nfs4_state_owner *, struct nfs4_state *);
+extern int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request);
 
 #if defined(CONFIG_NFS_V4_1)
 extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
fs/nfs/nfs4client.c +2 -130

150 lines not on this page · raw message

fs/nfs/nfs4proc.c +2 -11
index 18f24b9c1dfe..a1a8ee28f26d 100644
@@ -2327,7 +2327,7 @@ static int nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state
 	return err;
 }
 
-static int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state)
+int nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state)
 {
 	struct nfs_open_context *ctx;
 	int ret;
@@ -7618,7 +7618,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
 	return ret;
 }
 
-static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
+int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
 {
 	struct nfs_server *server = NFS_SERVER(state->inode);
 	struct nfs4_exception exception = {
@@ -10773,15 +10773,6 @@ static bool nfs4_match_stateid(const nfs4_stateid *s1,
 }
 
 
-static const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
-	.owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT,
-	.state_flag_bit	= NFS_STATE_RECLAIM_REBOOT,
-	.recover_open	= nfs4_open_reclaim,
-	.recover_lock	= nfs4_lock_reclaim,
-	.establish_clid = nfs4_init_clientid,
-	.detect_trunking = nfs40_discover_server_trunking,
-};
-
 #if defined(CONFIG_NFS_V4_1)
 static const struct nfs4_state_recovery_ops nfs41_reboot_recovery_ops = {
 	.owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT,
fs/nfs/nfs4state.c +0 -49

55 lines not on this page · raw message

Signature · 1 line
2.52.0
author maintainer
#3 lore raw

PATCH 3/14 NFS: Split out the nfs40_nograce_recovery_ops into nfs40proc.c

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

---
 fs/nfs/nfs40.h     |  1 +
 fs/nfs/nfs40proc.c | 22 ++++++++++++++++++++++
 fs/nfs/nfs4_fs.h   |  6 ++++++
 fs/nfs/nfs4proc.c  | 34 +++++-----------------------------
 4 files changed, 34 insertions(+), 29 deletions(-)
fs/nfs/nfs40.h +1 -0
index ad57172b49a3..c64e5ff6c9ff 100644
@@ -6,6 +6,7 @@
 /* nfs40proc.c */
 extern const struct rpc_call_ops nfs40_call_sync_ops;
 extern const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops;
+extern const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops;
 
 /* nfs40state.c */
 int nfs40_discover_server_trunking(struct nfs_client *clp,
fs/nfs/nfs40proc.c +22 -0
index b2cc7519b226..867afdf4ecf4 100644
@@ -18,6 +18,20 @@ static void nfs40_call_sync_done(struct rpc_task *task, void *calldata)
 	nfs4_sequence_done(task, data->seq_res);
 }
 
+static void nfs40_clear_delegation_stateid(struct nfs4_state *state)
+{
+	if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL)
+		nfs_finish_clear_delegation_stateid(state, NULL);
+}
+
+static int nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
+{
+	/* NFSv4.0 doesn't allow for delegation recovery on open expire */
+	nfs40_clear_delegation_stateid(state);
+	nfs_state_clear_open_state_flags(state);
+	return nfs4_open_expired(sp, state);
+}
+
 const struct rpc_call_ops nfs40_call_sync_ops = {
 	.rpc_call_prepare = nfs40_call_sync_prepare,
 	.rpc_call_done = nfs40_call_sync_done,
@@ -31,3 +45,11 @@ const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
 	.establish_clid = nfs4_init_clientid,
 	.detect_trunking = nfs40_discover_server_trunking,
 };
+
+const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = {
+	.owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE,
+	.state_flag_bit	= NFS_STATE_RECLAIM_NOGRACE,
+	.recover_open	= nfs40_open_expired,
+	.recover_lock	= nfs4_lock_expired,
+	.establish_clid = nfs4_init_clientid,
+};
fs/nfs/nfs4_fs.h +6 -0
index 246a43d172f9..885a78a3c22c 100644
@@ -351,7 +351,13 @@ extern void nfs4_update_changeattr(struct inode *dir,
 extern int nfs4_buf_to_pages_noslab(const void *buf, size_t buflen,
 				    struct page **pages);
 extern int nfs4_open_reclaim(struct nfs4_state_owner *, struct nfs4_state *);
+extern int nfs4_open_expired(struct nfs4_state_owner *, struct nfs4_state *);
 extern int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request);
+extern int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request);
+extern void nfs_state_clear_delegation(struct nfs4_state *state);
+extern void nfs_finish_clear_delegation_stateid(struct nfs4_state *state,
+						const nfs4_stateid *stateid);
+extern void nfs_state_clear_open_state_flags(struct nfs4_state *state);
 
 #if defined(CONFIG_NFS_V4_1)
 extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
fs/nfs/nfs4proc.c +5 -29
index a1a8ee28f26d..29105262d22a 100644
@@ -1836,7 +1836,7 @@ static void nfs_state_set_open_stateid(struct nfs4_state *state,
 	write_sequnlock(&state->seqlock);
 }
 
-static void nfs_state_clear_open_state_flags(struct nfs4_state *state)
+extern void nfs_state_clear_open_state_flags(struct nfs4_state *state)
 {
 	clear_bit(NFS_O_RDWR_STATE, &state->flags);
 	clear_bit(NFS_O_WRONLY_STATE, &state->flags);
@@ -1858,7 +1858,7 @@ static void nfs_state_set_delegation(struct nfs4_state *state,
 	write_sequnlock(&state->seqlock);
 }
 
-static void nfs_state_clear_delegation(struct nfs4_state *state)
+void nfs_state_clear_delegation(struct nfs4_state *state)
 {
 	write_seqlock(&state->seqlock);
 	nfs4_stateid_copy(&state->stateid, &state->open_stateid);
@@ -2862,7 +2862,7 @@ static int nfs4_do_open_expired(struct nfs_open_context *ctx, struct nfs4_state
 	return err;
 }
 
-static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
+int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
 {
 	struct nfs_open_context *ctx;
 	int ret;
@@ -2875,27 +2875,13 @@ static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *sta
 	return ret;
 }
 
-static void nfs_finish_clear_delegation_stateid(struct nfs4_state *state,
+void nfs_finish_clear_delegation_stateid(struct nfs4_state *state,
 		const nfs4_stateid *stateid)
 {
 	nfs_remove_bad_delegation(state->inode, stateid);
 	nfs_state_clear_delegation(state);
 }
 
-static void nfs40_clear_delegation_stateid(struct nfs4_state *state)
-{
-	if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL)
-		nfs_finish_clear_delegation_stateid(state, NULL);
-}
-
-static int nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
-{
-	/* NFSv4.0 doesn't allow for delegation recovery on open expire */
-	nfs40_clear_delegation_stateid(state);
-	nfs_state_clear_open_state_flags(state);
-	return nfs4_open_expired(sp, state);
-}
-
 static int nfs40_test_and_free_expired_stateid(struct nfs_server *server,
 					       nfs4_stateid *stateid, const struct cred *cred)
 {
@@ -7638,7 +7624,7 @@ int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
 	return err;
 }
 
-static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
+int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
 {
 	struct nfs_server *server = NFS_SERVER(state->inode);
 	struct nfs4_exception exception = {
@@ -10783,17 +10769,7 @@ static const struct nfs4_state_recovery_ops nfs41_reboot_recovery_ops = {
 	.reclaim_complete = nfs41_proc_reclaim_complete,
 	.detect_trunking = nfs41_discover_server_trunking,
 };
-#endif /* CONFIG_NFS_V4_1 */
 
-static const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = {
-	.owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE,
-	.state_flag_bit	= NFS_STATE_RECLAIM_NOGRACE,
-	.recover_open	= nfs40_open_expired,
-	.recover_lock	= nfs4_lock_expired,
-	.establish_clid = nfs4_init_clientid,
-};
-
-#if defined(CONFIG_NFS_V4_1)
 static const struct nfs4_state_recovery_ops nfs41_nograce_recovery_ops = {
 	.owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE,
 	.state_flag_bit	= NFS_STATE_RECLAIM_NOGRACE,
Signature · 1 line
2.52.0
#4 lore raw

Re: [PATCH v1 03/14] NFS: Split out the nfs40_nograce_recovery_ops into nfs40proc.c

kernel test robot noticed the following build warnings:

Hi Anna,

kernel test robot noticed the following build warnings:

[auto build test WARNING on v6.19-rc5]
[also build test WARNING on linus/master next-20260116] [cannot apply to trondmy-nfs/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Anna-Schumaker/NFS-Move-nfs40_call_sync_ops-into-nfs40proc-c/20260117-055642
base:   v6.19-rc5
patch link:    https://lore.kernel.org/r/20260116215135.846062-4-anna%40kernel.org
patch subject: [PATCH v1 03/14] NFS: Split out the nfs40_nograce_recovery_ops into nfs40proc.c
config: i386-randconfig-r134-20260118 (https://download.01.org/0day-ci/archive/20260118/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260118/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> fs/nfs/nfs4proc.c:1839:13: sparse: sparse: function 'nfs_state_clear_open_state_flags' with external linkage has definition

vim +/nfs_state_clear_open_state_flags +1839 fs/nfs/nfs4proc.c

1838

> 1839	extern void nfs_state_clear_open_state_flags(struct nfs4_state *state)

1840 {
1841 clear_bit(NFS_O_RDWR_STATE, &state->flags);
1842 clear_bit(NFS_O_WRONLY_STATE, &state->flags);
1843 clear_bit(NFS_O_RDONLY_STATE, &state->flags);
1844 clear_bit(NFS_OPEN_STATE, &state->flags);
1845 }
1846

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer
#5 lore raw

PATCH 4/14 NFS: Split out the nfs40_state_renewal_ops into nfs40proc.c

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

---
 fs/nfs/nfs40.h     |   1 +
 fs/nfs/nfs40proc.c | 100 ++++++++++++++++++++++++++++++++++++++++++++
 fs/nfs/nfs4_fs.h   |   1 +
 fs/nfs/nfs4proc.c  | 102 +--------------------------------------------
 4 files changed, 103 insertions(+), 101 deletions(-)
fs/nfs/nfs40.h +1 -0
index c64e5ff6c9ff..fd606b4a044a 100644
@@ -7,6 +7,7 @@
 extern const struct rpc_call_ops nfs40_call_sync_ops;
 extern const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops;
 extern const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops;
+extern const struct nfs4_state_maintenance_ops nfs40_state_renewal_ops;
 
 /* nfs40state.c */
 int nfs40_discover_server_trunking(struct nfs_client *clp,
fs/nfs/nfs40proc.c +100 -0

116 lines not on this page · raw message

fs/nfs/nfs4_fs.h +1 -0
index 885a78a3c22c..b43fb84145e0 100644
@@ -358,6 +358,7 @@ extern void nfs_state_clear_delegation(struct nfs4_state *state);
 extern void nfs_finish_clear_delegation_stateid(struct nfs4_state *state,
 						const nfs4_stateid *stateid);
 extern void nfs_state_clear_open_state_flags(struct nfs4_state *state);
+extern void do_renew_lease(struct nfs_client *clp, unsigned long timestamp);
 
 #if defined(CONFIG_NFS_V4_1)
 extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
fs/nfs/nfs4proc.c +1 -101

121 lines not on this page · raw message

Signature · 1 line
2.52.0
author maintainer
#6 lore raw

PATCH 5/14 NFS: Split out the nfs40_mig_recovery_ops to nfs40proc.c

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

---
 fs/nfs/nfs40.h     |   1 +
 fs/nfs/nfs40proc.c | 101 +++++++++++++++++++++++++++++++++++++++
 fs/nfs/nfs4_fs.h   |   6 +++
 fs/nfs/nfs4proc.c  | 115 +++------------------------------------------
 4 files changed, 114 insertions(+), 109 deletions(-)
fs/nfs/nfs40.h +1 -0
index fd606b4a044a..a04fb2390fa7 100644
@@ -8,6 +8,7 @@ extern const struct rpc_call_ops nfs40_call_sync_ops;
 extern const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops;
 extern const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops;
 extern const struct nfs4_state_maintenance_ops nfs40_state_renewal_ops;
+extern const struct nfs4_mig_recovery_ops nfs40_mig_recovery_ops;
 
 /* nfs40state.c */
 int nfs40_discover_server_trunking(struct nfs_client *clp,
fs/nfs/nfs40proc.c +101 -0

110 lines not on this page · raw message

fs/nfs/nfs4_fs.h +6 -0
index b43fb84145e0..7fcab74f01fb 100644
@@ -304,9 +304,15 @@ extern int nfs4_async_handle_error(struct rpc_task *task,
 extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
 			  struct rpc_message *, struct nfs4_sequence_args *,
 			  struct nfs4_sequence_res *, int);
+extern int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
+				   struct nfs_server *server,
+				   struct rpc_message *msg,
+				   struct nfs4_sequence_args *args,
+				   struct nfs4_sequence_res *res);
 extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int, int);
 extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, const struct cred *, struct nfs4_setclientid_res *);
 extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, const struct cred *);
+extern void renew_lease(const struct nfs_server *server, unsigned long timestamp);
 extern int nfs4_proc_get_rootfh(struct nfs_server *, struct nfs_fh *,
 				struct nfs_fattr *, bool);
 extern int nfs4_proc_bind_conn_to_session(struct nfs_client *, const struct cred *cred);
fs/nfs/nfs4proc.c +6 -109

146 lines not on this page · raw message

Signature · 1 line
2.52.0
author maintainer
#7 lore raw

PATCH 6/14 NFS: Move the NFS v4.0 minor version ops into nfs40proc.c

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

---
 fs/nfs/nfs40.h     |   1 +
 fs/nfs/nfs40proc.c | 106 +++++++++++++++++++++++++++++++++++++++++
 fs/nfs/nfs4_fs.h   |   4 ++
 fs/nfs/nfs4proc.c  | 115 ++-------------------------------------------
 4 files changed, 115 insertions(+), 111 deletions(-)
fs/nfs/nfs40.h +1 -0
index a04fb2390fa7..05ba9f1afe7c 100644
@@ -9,6 +9,7 @@ extern const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops;
 extern const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops;
 extern const struct nfs4_state_maintenance_ops nfs40_state_renewal_ops;
 extern const struct nfs4_mig_recovery_ops nfs40_mig_recovery_ops;
+extern const struct nfs4_minor_version_ops nfs_v4_0_minor_ops;
 
 /* nfs40state.c */
 int nfs40_discover_server_trunking(struct nfs_client *clp,
fs/nfs/nfs40proc.c +106 -0

121 lines not on this page · raw message

fs/nfs/nfs4_fs.h +4 -0
index 7fcab74f01fb..18f04906c5fa 100644
@@ -310,6 +310,7 @@ extern int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
 				   struct nfs4_sequence_args *args,
 				   struct nfs4_sequence_res *res);
 extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int, int);
+extern int nfs40_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res);
 extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, const struct cred *, struct nfs4_setclientid_res *);
 extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, const struct cred *);
 extern void renew_lease(const struct nfs_server *server, unsigned long timestamp);
@@ -365,6 +366,9 @@ extern void nfs_finish_clear_delegation_stateid(struct nfs4_state *state,
 						const nfs4_stateid *stateid);
 extern void nfs_state_clear_open_state_flags(struct nfs4_state *state);
 extern void do_renew_lease(struct nfs_client *clp, unsigned long timestamp);
+extern bool nfs4_match_stateid(const nfs4_stateid *s1, const nfs4_stateid *s2);
+extern int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
+			      struct nfs_fattr *fattr);
 
 #if defined(CONFIG_NFS_V4_1)
 extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
fs/nfs/nfs4proc.c +4 -111

152 lines not on this page · raw message

Signature · 1 line
2.52.0
author maintainer
#8 lore raw

PATCH 7/14 NFS: Make the various NFS v4.0 operations static again

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

They don't need to be visible outside of nfs40proc.c anymore now that the minor version ops have been moved over.

---
 fs/nfs/nfs40.h     |  5 -----
 fs/nfs/nfs40proc.c | 10 +++++-----
 2 files changed, 5 insertions(+), 10 deletions(-)
fs/nfs/nfs40.h +0 -5
index 05ba9f1afe7c..272e1ffdb161 100644
@@ -4,11 +4,6 @@
 
 
 /* nfs40proc.c */
-extern const struct rpc_call_ops nfs40_call_sync_ops;
-extern const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops;
-extern const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops;
-extern const struct nfs4_state_maintenance_ops nfs40_state_renewal_ops;
-extern const struct nfs4_mig_recovery_ops nfs40_mig_recovery_ops;
 extern const struct nfs4_minor_version_ops nfs_v4_0_minor_ops;
 
 /* nfs40state.c */
fs/nfs/nfs40proc.c +5 -5
index 36802f9b94b5..5968a3318d14 100644
@@ -309,12 +309,12 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
 	rpc_call_async(server->client, &msg, 0, &nfs4_release_lockowner_ops, data);
 }
 
-const struct rpc_call_ops nfs40_call_sync_ops = {
+static const struct rpc_call_ops nfs40_call_sync_ops = {
 	.rpc_call_prepare = nfs40_call_sync_prepare,
 	.rpc_call_done = nfs40_call_sync_done,
 };
 
-const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
+static const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
 	.owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT,
 	.state_flag_bit	= NFS_STATE_RECLAIM_REBOOT,
 	.recover_open	= nfs4_open_reclaim,
@@ -323,7 +323,7 @@ const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
 	.detect_trunking = nfs40_discover_server_trunking,
 };
 
-const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = {
+static const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = {
 	.owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE,
 	.state_flag_bit	= NFS_STATE_RECLAIM_NOGRACE,
 	.recover_open	= nfs40_open_expired,
@@ -331,13 +331,13 @@ const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = {
 	.establish_clid = nfs4_init_clientid,
 };
 
-const struct nfs4_state_maintenance_ops nfs40_state_renewal_ops = {
+static const struct nfs4_state_maintenance_ops nfs40_state_renewal_ops = {
 	.sched_state_renewal = nfs4_proc_async_renew,
 	.get_state_renewal_cred = nfs4_get_renew_cred,
 	.renew_lease = nfs4_proc_renew,
 };
 
-const struct nfs4_mig_recovery_ops nfs40_mig_recovery_ops = {
+static const struct nfs4_mig_recovery_ops nfs40_mig_recovery_ops = {
 	.get_locations = _nfs40_proc_get_locations,
 	.fsid_present = _nfs40_proc_fsid_present,
 };
Signature · 1 line
2.52.0
author maintainer
#9 lore raw

PATCH 8/14 NFS: Move nfs40_shutdown_client into nfs40client.c

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

---
 fs/nfs/nfs40.h       | 3 +++
 fs/nfs/nfs40client.c | 9 +++++++++
 fs/nfs/nfs40proc.c   | 1 +
 fs/nfs/nfs4_fs.h     | 1 -
 fs/nfs/nfs4client.c  | 8 --------
 5 files changed, 13 insertions(+), 9 deletions(-)
fs/nfs/nfs40.h +3 -0
index 272e1ffdb161..9369bb08825a 100644
@@ -3,6 +3,9 @@
 #define __LINUX_FS_NFS_NFS4_0_H
 
 
+/* nfs40client.c */
+void nfs40_shutdown_client(struct nfs_client *);
+
 /* nfs40proc.c */
 extern const struct nfs4_minor_version_ops nfs_v4_0_minor_ops;
 
fs/nfs/nfs40client.c +9 -0
index bab073b6506b..8397d75a2f46 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #include <linux/nfs_fs.h>
 #include "nfs4_fs.h"
+#include "nfs4session.h"
 #include "callback.h"
 #include "internal.h"
 #include "netns.h"
@@ -44,6 +45,14 @@ static bool nfs4_same_verifier(nfs4_verifier *v1, nfs4_verifier *v2)
 	return memcmp(v1->data, v2->data, sizeof(v1->data)) == 0;
 }
 
+void nfs40_shutdown_client(struct nfs_client *clp)
+{
+	if (clp->cl_slot_tbl) {
+		nfs4_shutdown_slot_table(clp->cl_slot_tbl);
+		kfree(clp->cl_slot_tbl);
+	}
+}
+
 /**
  * nfs40_walk_client_list - Find server that recognizes a client ID
  *
fs/nfs/nfs40proc.c +1 -0
index 5968a3318d14..0399e2e68c6b 100644
@@ -5,6 +5,7 @@
 #include <linux/nfs_fs.h>
 #include "internal.h"
 #include "nfs4_fs.h"
+#include "nfs40.h"
 #include "nfs4trace.h"
 
 static void nfs40_call_sync_prepare(struct rpc_task *task, void *calldata)
fs/nfs/nfs4_fs.h +0 -1
index 18f04906c5fa..3a81a658e5d2 100644
@@ -482,7 +482,6 @@ extern const u32 nfs4_pathconf_bitmap[3];
 extern const u32 nfs4_fsinfo_bitmap[3];
 extern const u32 nfs4_fs_locations_bitmap[3];
 
-void nfs40_shutdown_client(struct nfs_client *);
 void nfs41_shutdown_client(struct nfs_client *);
 int nfs40_init_client(struct nfs_client *);
 int nfs41_init_client(struct nfs_client *);
fs/nfs/nfs4client.c +0 -8
index 517cf8af2943..d83a8a2a3c70 100644
@@ -189,14 +189,6 @@ void nfs41_shutdown_client(struct nfs_client *clp)
 }
 #endif	/* CONFIG_NFS_V4_1 */
 
-void nfs40_shutdown_client(struct nfs_client *clp)
-{
-	if (clp->cl_slot_tbl) {
-		nfs4_shutdown_slot_table(clp->cl_slot_tbl);
-		kfree(clp->cl_slot_tbl);
-	}
-}
-
 struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
 {
 	char buf[INET6_ADDRSTRLEN + 1];
Signature · 1 line
2.52.0
author maintainer
#10 lore raw

PATCH 9/14 NFS: Move nfs40_init_client into nfs40client.c

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

---
 fs/nfs/nfs40.h       |  1 +
 fs/nfs/nfs40client.c | 27 +++++++++++++++++++++++++++
 fs/nfs/nfs4_fs.h     |  1 -
 fs/nfs/nfs4client.c  | 27 ---------------------------
 4 files changed, 28 insertions(+), 28 deletions(-)
fs/nfs/nfs40.h +1 -0
index 9369bb08825a..5a9c5d367b12 100644
@@ -5,6 +5,7 @@
 
 /* nfs40client.c */
 void nfs40_shutdown_client(struct nfs_client *);
+int nfs40_init_client(struct nfs_client *);
 
 /* nfs40proc.c */
 extern const struct nfs4_minor_version_ops nfs_v4_0_minor_ops;
fs/nfs/nfs40client.c +27 -0
index 8397d75a2f46..b0719403495d 100644
@@ -53,6 +53,33 @@ void nfs40_shutdown_client(struct nfs_client *clp)
 	}
 }
 
+/**
+ * nfs40_init_client - nfs_client initialization tasks for NFSv4.0
+ * @clp: nfs_client to initialize
+ *
+ * Returns zero on success, or a negative errno if some error occurred.
+ */
+int nfs40_init_client(struct nfs_client *clp)
+{
+	struct nfs4_slot_table *tbl;
+	int ret;
+
+	tbl = kzalloc(sizeof(*tbl), GFP_NOFS);
+	if (tbl == NULL)
+		return -ENOMEM;
+
+	ret = nfs4_setup_slot_table(tbl, NFS4_MAX_SLOT_TABLE,
+					"NFSv4.0 transport Slot table");
+	if (ret) {
+		nfs4_shutdown_slot_table(tbl);
+		kfree(tbl);
+		return ret;
+	}
+
+	clp->cl_slot_tbl = tbl;
+	return 0;
+}
+
 /**
  * nfs40_walk_client_list - Find server that recognizes a client ID
  *
fs/nfs/nfs4_fs.h +0 -1
index 3a81a658e5d2..9d0bec3a23f3 100644
@@ -483,7 +483,6 @@ extern const u32 nfs4_fsinfo_bitmap[3];
 extern const u32 nfs4_fs_locations_bitmap[3];
 
 void nfs41_shutdown_client(struct nfs_client *);
-int nfs40_init_client(struct nfs_client *);
 int nfs41_init_client(struct nfs_client *);
 void nfs4_free_client(struct nfs_client *);
 
fs/nfs/nfs4client.c +0 -27
index d83a8a2a3c70..c376b2420b6c 100644
@@ -331,33 +331,6 @@ static int nfs4_init_callback(struct nfs_client *clp)
 	return 0;
 }
 
-/**
- * nfs40_init_client - nfs_client initialization tasks for NFSv4.0
- * @clp: nfs_client to initialize
- *
- * Returns zero on success, or a negative errno if some error occurred.
- */
-int nfs40_init_client(struct nfs_client *clp)
-{
-	struct nfs4_slot_table *tbl;
-	int ret;
-
-	tbl = kzalloc(sizeof(*tbl), GFP_NOFS);
-	if (tbl == NULL)
-		return -ENOMEM;
-
-	ret = nfs4_setup_slot_table(tbl, NFS4_MAX_SLOT_TABLE,
-					"NFSv4.0 transport Slot table");
-	if (ret) {
-		nfs4_shutdown_slot_table(tbl);
-		kfree(tbl);
-		return ret;
-	}
-
-	clp->cl_slot_tbl = tbl;
-	return 0;
-}
-
 #if defined(CONFIG_NFS_V4_1)
 
 /**
Signature · 1 line
2.52.0
author maintainer
#11 lore raw

PATCH 10/14 NFS: Move NFS v4.0 pathdown recovery into nfs40client.c

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

---
 fs/nfs/nfs40.h       |  1 +
 fs/nfs/nfs40client.c | 23 +++++++++++++++++++++++
 fs/nfs/nfs4state.c   | 23 +----------------------
 3 files changed, 25 insertions(+), 22 deletions(-)
fs/nfs/nfs40.h +1 -0
index 5a9c5d367b12..ee09aac738c8 100644
@@ -6,6 +6,7 @@
 /* nfs40client.c */
 void nfs40_shutdown_client(struct nfs_client *);
 int nfs40_init_client(struct nfs_client *);
+void nfs40_handle_cb_pathdown(struct nfs_client *clp);
 
 /* nfs40proc.c */
 extern const struct nfs4_minor_version_ops nfs_v4_0_minor_ops;
fs/nfs/nfs40client.c +23 -0
index b0719403495d..0f88e7cbdc5e 100644
@@ -3,6 +3,7 @@
 #include "nfs4_fs.h"
 #include "nfs4session.h"
 #include "callback.h"
+#include "delegation.h"
 #include "internal.h"
 #include "netns.h"
 #include "nfs40.h"
@@ -80,6 +81,28 @@ int nfs40_init_client(struct nfs_client *clp)
 	return 0;
 }
 
+/*
+ * nfs40_handle_cb_pathdown - return all delegations after NFS4ERR_CB_PATH_DOWN
+ * @clp: client to process
+ *
+ * Set the NFS4CLNT_LEASE_EXPIRED state in order to force a
+ * resend of the SETCLIENTID and hence re-establish the
+ * callback channel. Then return all existing delegations.
+ */
+void nfs40_handle_cb_pathdown(struct nfs_client *clp)
+{
+	set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
+	nfs_expire_all_delegations(clp);
+	dprintk("%s: handling CB_PATHDOWN recovery for server %s\n", __func__,
+			clp->cl_hostname);
+}
+
+void nfs4_schedule_path_down_recovery(struct nfs_client *clp)
+{
+	nfs40_handle_cb_pathdown(clp);
+	nfs4_schedule_state_manager(clp);
+}
+
 /**
  * nfs40_walk_client_list - Find server that recognizes a client ID
  *
fs/nfs/nfs4state.c +1 -22
index 5eaa45fd69ea..c7ee5318b660 100644
@@ -54,6 +54,7 @@
 #include <linux/sunrpc/clnt.h>
 
 #include "nfs4_fs.h"
+#include "nfs40.h"
 #include "callback.h"
 #include "delegation.h"
 #include "internal.h"
@@ -1294,28 +1295,6 @@ int nfs4_client_recover_expired_lease(struct nfs_client *clp)
 	return ret;
 }
 
-/*
- * nfs40_handle_cb_pathdown - return all delegations after NFS4ERR_CB_PATH_DOWN
- * @clp: client to process
- *
- * Set the NFS4CLNT_LEASE_EXPIRED state in order to force a
- * resend of the SETCLIENTID and hence re-establish the
- * callback channel. Then return all existing delegations.
- */
-static void nfs40_handle_cb_pathdown(struct nfs_client *clp)
-{
-	set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
-	nfs_expire_all_delegations(clp);
-	dprintk("%s: handling CB_PATHDOWN recovery for server %s\n", __func__,
-			clp->cl_hostname);
-}
-
-void nfs4_schedule_path_down_recovery(struct nfs_client *clp)
-{
-	nfs40_handle_cb_pathdown(clp);
-	nfs4_schedule_state_manager(clp);
-}
-
 static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state)
 {
 
Signature · 1 line
2.52.0
author maintainer
#12 lore raw

PATCH 11/14 NFS: Pass a struct nfs_client to nfs4_init_sequence()

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

No functional change in this patch. This just makes the next patch where I introduce "sequence slot operations" simpler.

---
 fs/nfs/nfs40proc.c |  14 ++---
 fs/nfs/nfs42proc.c |  13 +++--
 fs/nfs/nfs4_fs.h   |   3 +-
 fs/nfs/nfs4proc.c  | 126 +++++++++++++++++++++++++--------------------
 4 files changed, 87 insertions(+), 69 deletions(-)
fs/nfs/nfs40proc.c +8 -6
index 0399e2e68c6b..9b5b57170471 100644
@@ -147,11 +147,12 @@ static int _nfs40_proc_get_locations(struct nfs_server *server,
 				     struct page *page, const struct cred *cred)
 {
 	struct rpc_clnt *clnt = server->client;
+	struct nfs_client *clp = server->nfs_client;
 	u32 bitmask[2] = {
 		[0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
 	};
 	struct nfs4_fs_locations_arg args = {
-		.clientid	= server->nfs_client->cl_clientid,
+		.clientid	= clp->cl_clientid,
 		.fh		= fhandle,
 		.page		= page,
 		.bitmask	= bitmask,
@@ -176,7 +177,7 @@ static int _nfs40_proc_get_locations(struct nfs_server *server,
 	locations->server = server;
 	locations->nlocations = 0;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
+	nfs4_init_sequence(clp, &args.seq_args, &res.seq_res, 0, 1);
 	status = nfs4_call_sync_sequence(clnt, server, &msg,
 					&args.seq_args, &res.seq_res);
 	if (status)
@@ -219,7 +220,7 @@ static int _nfs40_proc_fsid_present(struct inode *inode, const struct cred *cred
 	if (res.fh == NULL)
 		return -ENOMEM;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
+	nfs4_init_sequence(clp, &args.seq_args, &res.seq_res, 0, 1);
 	status = nfs4_call_sync_sequence(clnt, server, &msg,
 						&args.seq_args, &res.seq_res);
 	nfs_free_fhandle(res.fh);
@@ -288,11 +289,12 @@ static void
 nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
 {
 	struct nfs_release_lockowner_data *data;
+	struct nfs_client *clp = server->nfs_client;
 	struct rpc_message msg = {
 		.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RELEASE_LOCKOWNER],
 	};
 
-	if (server->nfs_client->cl_mvops->minor_version != 0)
+	if (clp->cl_mvops->minor_version != 0)
 		return;
 
 	data = kmalloc(sizeof(*data), GFP_KERNEL);
@@ -300,13 +302,13 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
 		return;
 	data->lsp = lsp;
 	data->server = server;
-	data->args.lock_owner.clientid = server->nfs_client->cl_clientid;
+	data->args.lock_owner.clientid = clp->cl_clientid;
 	data->args.lock_owner.id = lsp->ls_seqid.owner_id;
 	data->args.lock_owner.s_dev = server->s_dev;
 
 	msg.rpc_argp = &data->args;
 	msg.rpc_resp = &data->res;
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0, 0);
+	nfs4_init_sequence(clp, &data->args.seq_args, &data->res.seq_res, 0, 0);
 	rpc_call_async(server->client, &msg, 0, &nfs4_release_lockowner_ops, data);
 }
 
fs/nfs/nfs42proc.c +8 -5
index d537fb0c230e..d5b20dfe1cbf 100644
@@ -661,8 +661,8 @@ static int nfs42_do_offload_cancel_async(struct file *dst,
 	msg.rpc_argp = &data->args;
 	msg.rpc_resp = &data->res;
 	task_setup_data.callback_data = data;
-	nfs4_init_sequence(&data->args.osa_seq_args, &data->res.osr_seq_res,
-			   1, 0);
+	nfs4_init_sequence(dst_server->nfs_client, &data->args.osa_seq_args,
+			   &data->res.osr_seq_res, 1, 0);
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
@@ -1063,7 +1063,8 @@ int nfs42_proc_layoutstats_generic(struct nfs_server *server,
 		nfs42_layoutstat_release(data);
 		return -EAGAIN;
 	}
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0, 0);
+	nfs4_init_sequence(server->nfs_client, &data->args.seq_args,
+			   &data->res.seq_res, 0, 0);
 	task = rpc_run_task(&task_setup);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
@@ -1201,6 +1202,7 @@ int nfs42_proc_layouterror(struct pnfs_layout_segment *lseg,
 		const struct nfs42_layout_error *errors, size_t n)
 {
 	struct inode *inode = lseg->pls_layout->plh_inode;
+	struct nfs_server *server = NFS_SERVER(inode);
 	struct nfs42_layouterror_data *data;
 	struct rpc_task *task;
 	struct rpc_message msg = {
@@ -1228,8 +1230,9 @@ int nfs42_proc_layouterror(struct pnfs_layout_segment *lseg,
 	msg.rpc_argp = &data->args;
 	msg.rpc_resp = &data->res;
 	task_setup.callback_data = data;
-	task_setup.rpc_client = NFS_SERVER(inode)->client;
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0, 0);
+	task_setup.rpc_client = server->client;
+	nfs4_init_sequence(server->nfs_client, &data->args.seq_args,
+			   &data->res.seq_res, 0, 0);
 	task = rpc_run_task(&task_setup);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
fs/nfs/nfs4_fs.h +2 -1
index 9d0bec3a23f3..34cdbf42b865 100644
@@ -309,7 +309,8 @@ extern int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
 				   struct rpc_message *msg,
 				   struct nfs4_sequence_args *args,
 				   struct nfs4_sequence_res *res);
-extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int, int);
+extern void nfs4_init_sequence(struct nfs_client *clp, struct nfs4_sequence_args *,
+			       struct nfs4_sequence_res *, int, int);
 extern int nfs40_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res);
 extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, const struct cred *, struct nfs4_setclientid_res *);
 extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, const struct cred *);
fs/nfs/nfs4proc.c +69 -57

405 lines not on this page · raw message

Signature · 1 line
2.52.0
author maintainer
#13 lore raw

PATCH 12/14 NFS: Move sequence slot operations into minorversion operations

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

At the same time, I move the NFS v4.0 functions into nfs40proc.c to keep v4.0 features together in their own files.

---
 fs/nfs/nfs40proc.c      |  30 ++++++++++++
 fs/nfs/nfs4_fs.h        |   8 +++-
 fs/nfs/nfs4proc.c       | 103 +++++++++++++---------------------------
 include/linux/nfs_xdr.h |   1 +
 4 files changed, 70 insertions(+), 72 deletions(-)
fs/nfs/nfs40proc.c +30 -0
index 9b5b57170471..32a2a1a2b216 100644
@@ -6,6 +6,7 @@
 #include "internal.h"
 #include "nfs4_fs.h"
 #include "nfs40.h"
+#include "nfs4session.h"
 #include "nfs4trace.h"
 
 static void nfs40_call_sync_prepare(struct rpc_task *task, void *calldata)
@@ -21,6 +22,28 @@ static void nfs40_call_sync_done(struct rpc_task *task, void *calldata)
 	nfs4_sequence_done(task, data->seq_res);
 }
 
+static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res)
+{
+	struct nfs4_slot *slot = res->sr_slot;
+	struct nfs4_slot_table *tbl;
+
+	tbl = slot->table;
+	spin_lock(&tbl->slot_tbl_lock);
+	if (!nfs41_wake_and_assign_slot(tbl, slot))
+		nfs4_free_slot(tbl, slot);
+	spin_unlock(&tbl->slot_tbl_lock);
+
+	res->sr_slot = NULL;
+}
+
+static int nfs40_sequence_done(struct rpc_task *task,
+			       struct nfs4_sequence_res *res)
+{
+	if (res->sr_slot != NULL)
+		nfs40_sequence_free_slot(res);
+	return 1;
+}
+
 static void nfs40_clear_delegation_stateid(struct nfs4_state *state)
 {
 	if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL)
@@ -317,6 +340,12 @@ static const struct rpc_call_ops nfs40_call_sync_ops = {
 	.rpc_call_done = nfs40_call_sync_done,
 };
 
+static const struct nfs4_sequence_slot_ops nfs40_sequence_slot_ops = {
+	.process = nfs40_sequence_done,
+	.done = nfs40_sequence_done,
+	.free_slot = nfs40_sequence_free_slot,
+};
+
 static const struct nfs4_state_recovery_ops nfs40_reboot_recovery_ops = {
 	.owner_flag_bit = NFS_OWNER_RECLAIM_REBOOT,
 	.state_flag_bit	= NFS_STATE_RECLAIM_REBOOT,
@@ -358,6 +387,7 @@ const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = {
 	.test_and_free_expired = nfs40_test_and_free_expired_stateid,
 	.alloc_seqid = nfs_alloc_seqid,
 	.call_sync_ops = &nfs40_call_sync_ops,
+	.sequence_slot_ops = &nfs40_sequence_slot_ops,
 	.reboot_recovery_ops = &nfs40_reboot_recovery_ops,
 	.nograce_recovery_ops = &nfs40_nograce_recovery_ops,
 	.state_renewal_ops = &nfs40_state_renewal_ops,
fs/nfs/nfs4_fs.h +7 -1
index 34cdbf42b865..a5dd4a837769 100644
@@ -73,6 +73,7 @@ struct nfs4_minor_version_ops {
 	void	(*session_trunk)(struct rpc_clnt *clnt,
 			struct rpc_xprt *xprt, void *data);
 	const struct rpc_call_ops *call_sync_ops;
+	const struct nfs4_sequence_slot_ops *sequence_slot_ops;
 	const struct nfs4_state_recovery_ops *reboot_recovery_ops;
 	const struct nfs4_state_recovery_ops *nograce_recovery_ops;
 	const struct nfs4_state_maintenance_ops *state_renewal_ops;
@@ -256,6 +257,12 @@ struct nfs4_add_xprt_data {
 	const struct cred	*cred;
 };
 
+struct nfs4_sequence_slot_ops {
+	int (*process)(struct rpc_task *, struct nfs4_sequence_res *);
+	int (*done)(struct rpc_task *, struct nfs4_sequence_res *);
+	void (*free_slot)(struct nfs4_sequence_res *);
+};
+
 struct nfs4_state_maintenance_ops {
 	int (*sched_state_renewal)(struct nfs_client *, const struct cred *, unsigned);
 	const struct cred * (*get_state_renewal_cred)(struct nfs_client *);
@@ -311,7 +318,6 @@ extern int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
 				   struct nfs4_sequence_res *res);
 extern void nfs4_init_sequence(struct nfs_client *clp, struct nfs4_sequence_args *,
 			       struct nfs4_sequence_res *, int, int);
-extern int nfs40_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res);
 extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, const struct cred *, struct nfs4_setclientid_res *);
 extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, const struct cred *);
 extern void renew_lease(const struct nfs_server *server, unsigned long timestamp);
fs/nfs/nfs4proc.c +32 -71

151 lines not on this page · raw message

include/linux/nfs_xdr.h +1 -0
index 79fe2dfb470f..2aa4e38af57a 100644
@@ -209,6 +209,7 @@ struct nfs4_sequence_args {
 };
 
 struct nfs4_sequence_res {
+	const struct nfs4_sequence_slot_ops *sr_slot_ops;
 	struct nfs4_slot	*sr_slot;	/* slot used to send request */
 	unsigned long		sr_timestamp;
 	int			sr_status;	/* sequence operation status */
Signature · 1 line
2.52.0
author maintainer
#14 lore raw

PATCH 13/14 NFS: Add a way to disable NFS v4.0 via KConfig

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

I introduce NFS4_MIN_MINOR_VERSION as a parallel to NFS4_MAX_MINOR_VERSION to check if NFS v4.0 has been compiled in and return an appropriate error if not.

---
 fs/nfs/Kconfig      | 9 +++++++++
 fs/nfs/Makefile     | 3 ++-
 fs/nfs/fs_context.c | 3 ++-
 fs/nfs/nfs4_fs.h    | 6 ++++++
 fs/nfs/nfs4client.c | 3 ++-
 fs/nfs/nfs4proc.c   | 2 ++
 fs/nfs/nfs4state.c  | 2 ++
 7 files changed, 25 insertions(+), 3 deletions(-)
fs/nfs/Kconfig +9 -0
index 07932ce9246c..058ed67b98cc 100644
@@ -96,6 +96,15 @@ config NFS_SWAP
 	help
 	  This option enables swapon to work on files located on NFS mounts.
 
+config NFS_V4_0
+	bool "NFS client support for NFSv4.0"
+	depends on NFS_V4
+	help
+	  This option enables support for minor version 0 of the NFSv4 protocol
+	  (RFC 3530) in the kernel's NFS client.
+
+	  If unsure, say N.
+
 config NFS_V4_1
 	bool "NFS client support for NFSv4.1"
 	depends on NFS_V4
fs/nfs/Makefile +2 -1
index d05e69c00fe1..6a9aaf2f913b 100644
@@ -27,9 +27,10 @@ CFLAGS_nfs4trace.o += -I$(src)
 nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
 	  delegation.o nfs4idmap.o callback.o callback_xdr.o callback_proc.o \
 	  nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \
-	  dns_resolve.o nfs4trace.o nfs40proc.o nfs40client.o
+	  dns_resolve.o nfs4trace.o
 nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o
 nfsv4-$(CONFIG_SYSCTL)	+= nfs4sysctl.o
+nfsv4-$(CONFIG_NFS_V4_0)	+= nfs40client.o nfs40proc.o
 nfsv4-$(CONFIG_NFS_V4_1)	+= pnfs.o pnfs_dev.o pnfs_nfs.o
 nfsv4-$(CONFIG_NFS_V4_2)	+= nfs42proc.o nfs42xattr.o
 
fs/nfs/fs_context.c +2 -1
index b4679b7161b0..86750f110053 100644
@@ -806,7 +806,8 @@ static int nfs_fs_context_parse_param(struct fs_context *fc,
 		ctx->mount_server.version = result.uint_32;
 		break;
 	case Opt_minorversion:
-		if (result.uint_32 > NFS4_MAX_MINOR_VERSION)
+		if (result.uint_32 < NFS4_MIN_MINOR_VERSION ||
+		    result.uint_32 > NFS4_MAX_MINOR_VERSION)
 			goto out_of_bounds;
 		ctx->minorversion = result.uint_32;
 		break;
fs/nfs/nfs4_fs.h +6 -0
index a5dd4a837769..5a6728acb589 100644
@@ -10,6 +10,12 @@
 #ifndef __LINUX_FS_NFS_NFS4_FS_H
 #define __LINUX_FS_NFS_NFS4_FS_H
 
+#if defined(CONFIG_NFS_V4_0)
+#define NFS4_MIN_MINOR_VERSION 0
+#else
+#define NFS4_MIN_MINOR_VERSION 1
+#endif
+
 #if defined(CONFIG_NFS_V4_2)
 #define NFS4_MAX_MINOR_VERSION 2
 #elif defined(CONFIG_NFS_V4_1)
fs/nfs/nfs4client.c +2 -1
index c376b2420b6c..00b57e55aba8 100644
@@ -203,7 +203,8 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
 	if (err)
 		goto error;
 
-	if (cl_init->minorversion > NFS4_MAX_MINOR_VERSION) {
+	if (cl_init->minorversion < NFS4_MIN_MINOR_VERSION ||
+	    cl_init->minorversion > NFS4_MAX_MINOR_VERSION) {
 		err = -EINVAL;
 		goto error;
 	}
fs/nfs/nfs4proc.c +2 -0
index ae14e9d65e1b..7ff036afb0e3 100644
@@ -10560,7 +10560,9 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = {
 #endif
 
 const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {
+#if defined(CONFIG_NFS_V4_0)
 	[0] = &nfs_v4_0_minor_ops,
+#endif /* CONFIG_NFS_V4_0 */
 #if defined(CONFIG_NFS_V4_1)
 	[1] = &nfs_v4_1_minor_ops,
 #endif
fs/nfs/nfs4state.c +2 -0
index c7ee5318b660..fe7c0d7cdace 100644
@@ -1800,9 +1800,11 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error)
 	switch (error) {
 	case 0:
 		break;
+#if IS_ENABLED(CONFIG_NFS_V4_0)
 	case -NFS4ERR_CB_PATH_DOWN:
 		nfs40_handle_cb_pathdown(clp);
 		break;
+#endif /* CONFIG_NFS_V4_0 */
 	case -NFS4ERR_NO_GRACE:
 		nfs4_state_end_reclaim_reboot(clp);
 		break;
Signature · 1 line
2.52.0
author maintainer
#15 lore raw

PATCH 14/14 NFS: Merge CONFIG_NFS_V4_1 with CONFIG_NFS_V4

In reply to Anna Schumaker

From: Anna Schumaker <[email protected]>

Compiling the NFSv4 module without any minorversion support doesn't make much sense, so this patch sets NFS v4.1 as the default, always enabled NFS version allowing us to replace all the CONFIG_NFS_V4_1s scattered throughout the code with CONFIG_NFS_V4.

---
 fs/nfs/Kconfig            | 27 ++++--------
 fs/nfs/Makefile           |  3 +-
 fs/nfs/callback.c         | 13 +-----
 fs/nfs/callback.h         |  3 --
 fs/nfs/callback_proc.c    |  3 --
 fs/nfs/callback_xdr.c     | 21 ----------
 fs/nfs/client.c           |  8 ++--
 fs/nfs/internal.h         | 12 ++----
 fs/nfs/netns.h            |  4 +-
 fs/nfs/nfs4_fs.h          | 36 +---------------
 fs/nfs/nfs4client.c       | 23 -----------
 fs/nfs/nfs4proc.c         | 55 -------------------------
 fs/nfs/nfs4session.c      |  4 --
 fs/nfs/nfs4session.h      | 23 -----------
 fs/nfs/nfs4state.c        | 17 --------
 fs/nfs/nfs4trace.c        |  2 -
 fs/nfs/nfs4trace.h        | 16 -------
 fs/nfs/nfs4xdr.c          | 87 ---------------------------------------
 fs/nfs/pnfs.h             |  6 +--
 fs/nfs/read.c             |  4 +-
 fs/nfs/super.c            | 16 ++-----
 fs/nfs/sysfs.c            | 10 ++---
 fs/nfs/write.c            |  2 +-
 include/linux/nfs_fs_sb.h |  2 -
 include/linux/nfs_xdr.h   |  6 +--
 25 files changed, 35 insertions(+), 368 deletions(-)
fs/nfs/Kconfig +9 -18
index 058ed67b98cc..12cb0ca738af 100644
@@ -78,9 +78,10 @@ config NFS_V4
 	tristate "NFS client support for NFS version 4"
 	depends on NFS_FS
 	select KEYS
+	select SUNRPC_BACKCHANNEL
 	help
-	  This option enables support for version 4 of the NFS protocol
-	  (RFC 3530) in the kernel's NFS client.
+	  This option enables support for version 4.1 of the NFS protocol
+	  (RFC 5661) in the kernel's NFS client.
 
 	  To mount NFS servers using NFSv4, you also need to install user
 	  space programs which can be found in the Linux nfs-utils package,
@@ -105,19 +106,9 @@ config NFS_V4_0
 
 	  If unsure, say N.
 
-config NFS_V4_1
-	bool "NFS client support for NFSv4.1"
-	depends on NFS_V4
-	select SUNRPC_BACKCHANNEL
-	help
-	  This option enables support for minor version 1 of the NFSv4 protocol
-	  (RFC 5661) in the kernel's NFS client.
-
-	  If unsure, say N.
-
 config NFS_V4_2
 	bool "NFS client support for NFSv4.2"
-	depends on NFS_V4_1
+	depends on NFS_V4
 	help
 	  This option enables support for minor version 2 of the NFSv4 protocol
 	  in the kernel's NFS client.
@@ -126,22 +117,22 @@ config NFS_V4_2
 
 config PNFS_FILE_LAYOUT
 	tristate
-	depends on NFS_V4_1
+	depends on NFS_V4
 	default NFS_V4
 
 config PNFS_BLOCK
 	tristate
-	depends on NFS_V4_1 && BLK_DEV_DM
+	depends on NFS_V4 && BLK_DEV_DM
 	default NFS_V4
 
 config PNFS_FLEXFILE_LAYOUT
 	tristate
-	depends on NFS_V4_1
+	depends on NFS_V4
 	default NFS_V4
 
 config NFS_V4_1_IMPLEMENTATION_ID_DOMAIN
 	string "NFSv4.1 Implementation ID Domain"
-	depends on NFS_V4_1
+	depends on NFS_V4
 	default "kernel.org"
 	help
 	  This option defines the domain portion of the implementation ID that
@@ -153,7 +144,7 @@ config NFS_V4_1_IMPLEMENTATION_ID_DOMAIN
 
 config NFS_V4_1_MIGRATION
 	bool "NFSv4.1 client support for migration"
-	depends on NFS_V4_1
+	depends on NFS_V4
 	default n
 	help
 	  This option makes the NFS client advertise to NFSv4.1 servers that
fs/nfs/Makefile +1 -2
index 6a9aaf2f913b..c895521f27f3 100644
@@ -27,11 +27,10 @@ CFLAGS_nfs4trace.o += -I$(src)
 nfsv4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
 	  delegation.o nfs4idmap.o callback.o callback_xdr.o callback_proc.o \
 	  nfs4namespace.o nfs4getroot.o nfs4client.o nfs4session.o \
-	  dns_resolve.o nfs4trace.o
+	  dns_resolve.o nfs4trace.o pnfs.o pnfs_dev.o pnfs_nfs.o
 nfsv4-$(CONFIG_NFS_USE_LEGACY_DNS) += cache_lib.o
 nfsv4-$(CONFIG_SYSCTL)	+= nfs4sysctl.o
 nfsv4-$(CONFIG_NFS_V4_0)	+= nfs40client.o nfs40proc.o
-nfsv4-$(CONFIG_NFS_V4_1)	+= pnfs.o pnfs_dev.o pnfs_nfs.o
 nfsv4-$(CONFIG_NFS_V4_2)	+= nfs42proc.o nfs42xattr.o
 
 obj-$(CONFIG_PNFS_FILE_LAYOUT) += filelayout/
fs/nfs/callback.c +1 -12
index fabda0f6ec1a..6af67bdf0e40 100644
@@ -87,7 +87,6 @@ nfs4_callback_svc(void *vrqstp)
 	return 0;
 }
 
-#if defined(CONFIG_NFS_V4_1)
 static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
 		struct svc_serv *serv)
 {
@@ -98,12 +97,6 @@ static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
 		 */
 		xprt->bc_serv = serv;
 }
-#else
-static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
-		struct svc_serv *serv)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
 
 static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
 				  struct svc_serv *serv)
@@ -157,7 +150,7 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
 	}
 
 	ret = 0;
-	if (!IS_ENABLED(CONFIG_NFS_V4_1) || minorversion == 0)
+	if (minorversion == 0)
 		ret = nfs4_callback_up_net(serv, net);
 	else if (xprt->ops->bc_setup)
 		set_bc_enabled(serv);
@@ -198,10 +191,6 @@ static struct svc_serv *nfs_callback_create_svc(int minorversion)
 			cb_info->users);
 
 	threadfn = nfs4_callback_svc;
-#if !defined(CONFIG_NFS_V4_1)
-	if (minorversion)
-		return ERR_PTR(-ENOTSUPP);
-#endif
 	serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE,
 			  threadfn);
 	if (!serv) {
fs/nfs/callback.h +0 -3
index 8809f93d82c0..2a721c422d48 100644
@@ -65,8 +65,6 @@ struct cb_recallargs {
 	uint32_t truncate;
 };
 
-#if defined(CONFIG_NFS_V4_1)
-
 struct referring_call {
 	uint32_t			rc_sequenceid;
 	uint32_t			rc_slotid;
@@ -168,7 +166,6 @@ struct cb_notify_lock_args {
 
 extern __be32 nfs4_callback_notify_lock(void *argp, void *resp,
 					 struct cb_process_state *cps);
-#endif /* CONFIG_NFS_V4_1 */
 #ifdef CONFIG_NFS_V4_2
 struct cb_offloadargs {
 	struct nfs_fh		coa_fh;
fs/nfs/callback_proc.c +0 -3
index 8397c43358bd..a63b97aabcbc 100644
@@ -121,8 +121,6 @@ __be32 nfs4_callback_recall(void *argp, void *resp,
 	return res;
 }
 
-#if defined(CONFIG_NFS_V4_1)
-
 /*
  * Lookup a layout inode by stateid
  *
@@ -693,7 +691,6 @@ __be32 nfs4_callback_notify_lock(void *argp, void *resp,
 
 	return htonl(NFS4_OK);
 }
-#endif /* CONFIG_NFS_V4_1 */
 #ifdef CONFIG_NFS_V4_2
 static void nfs4_copy_cb_args(struct nfs4_copy_state *cp_state,
 				struct cb_offloadargs *args)
fs/nfs/callback_xdr.c +0 -21
index 4254ba3ee7c5..c2fa4a91db26 100644
@@ -30,7 +30,6 @@
 					 (2 + 2 + 3 + 3 + 3 + 3 + 3) * 4)
 #define CB_OP_RECALL_RES_MAXSZ		(CB_OP_HDR_RES_MAXSZ)
 
-#if defined(CONFIG_NFS_V4_1)
 #define CB_OP_LAYOUTRECALL_RES_MAXSZ	(CB_OP_HDR_RES_MAXSZ)
 #define CB_OP_DEVICENOTIFY_RES_MAXSZ	(CB_OP_HDR_RES_MAXSZ)
 #define CB_OP_SEQUENCE_RES_MAXSZ	(CB_OP_HDR_RES_MAXSZ + \
@@ -39,7 +38,6 @@
 #define CB_OP_RECALLANY_RES_MAXSZ	(CB_OP_HDR_RES_MAXSZ)
 #define CB_OP_RECALLSLOT_RES_MAXSZ	(CB_OP_HDR_RES_MAXSZ)
 #define CB_OP_NOTIFY_LOCK_RES_MAXSZ	(CB_OP_HDR_RES_MAXSZ)
-#endif /* CONFIG_NFS_V4_1 */
 #ifdef CONFIG_NFS_V4_2
 #define CB_OP_OFFLOAD_RES_MAXSZ		(CB_OP_HDR_RES_MAXSZ)
 #endif /* CONFIG_NFS_V4_2 */
@@ -205,7 +203,6 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp,
 	return decode_fh(xdr, &args->fh);
 }
 
-#if defined(CONFIG_NFS_V4_1)
 static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
 {
 	stateid->type = NFS4_LAYOUT_STATEID_TYPE;
@@ -521,7 +518,6 @@ static __be32 decode_notify_lock_args(struct svc_rqst *rqstp,
 	return decode_lockowner(xdr, args);
 }
 
-#endif /* CONFIG_NFS_V4_1 */
 #ifdef CONFIG_NFS_V4_2
 static __be32 decode_write_response(struct xdr_stream *xdr,
 					struct cb_offloadargs *args)
@@ -747,8 +743,6 @@ static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr,
 	return status;
 }
 
-#if defined(CONFIG_NFS_V4_1)
-
 static __be32 encode_sessionid(struct xdr_stream *xdr,
 				 const struct nfs4_sessionid *sid)
 {
@@ -846,19 +840,6 @@ static void nfs4_cb_free_slot(struct cb_process_state *cps)
 	}
 }
 
-#else /* CONFIG_NFS_V4_1 */
-
-static __be32
-preprocess_nfs41_op(int nop, unsigned int op_nr, struct callback_op **op)
-{
-	return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
-}
-
-static void nfs4_cb_free_slot(struct cb_process_state *cps)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
-
 #ifdef CONFIG_NFS_V4_2
 static __be32
 preprocess_nfs42_op(int nop, unsigned int op_nr, struct callback_op **op)
@@ -1051,7 +1032,6 @@ static struct callback_op callback_ops[] = {
 		.decode_args = decode_recall_args,
 		.res_maxsize = CB_OP_RECALL_RES_MAXSZ,
 	},
-#if defined(CONFIG_NFS_V4_1)
 	[OP_CB_LAYOUTRECALL] = {
 		.process_op = nfs4_callback_layoutrecall,
 		.decode_args = decode_layoutrecall_args,
@@ -1083,7 +1063,6 @@ static struct callback_op callback_ops[] = {
 		.decode_args = decode_notify_lock_args,
 		.res_maxsize = CB_OP_NOTIFY_LOCK_RES_MAXSZ,
 	},
-#endif /* CONFIG_NFS_V4_1 */
 #ifdef CONFIG_NFS_V4_2
 	[OP_CB_OFFLOAD] = {
 		.process_op = nfs4_callback_offload,
fs/nfs/client.c +3 -5
index 2aaea9c98c2c..4ed25285c8c4 100644
@@ -1263,11 +1263,9 @@ void nfs_clients_init(struct net *net)
 	INIT_LIST_HEAD(&nn->nfs_volume_list);
 #if IS_ENABLED(CONFIG_NFS_V4)
 	idr_init(&nn->cb_ident_idr);
-#endif
-#if IS_ENABLED(CONFIG_NFS_V4_1)
 	INIT_LIST_HEAD(&nn->nfs4_data_server_cache);
 	spin_lock_init(&nn->nfs4_data_server_lock);
-#endif
+#endif /* CONFIG_NFS_V4 */
 	spin_lock_init(&nn->nfs_client_lock);
 	nn->boot_time = ktime_get_real();
 	memset(&nn->rpcstats, 0, sizeof(nn->rpcstats));
@@ -1284,9 +1282,9 @@ void nfs_clients_exit(struct net *net)
 	nfs_cleanup_cb_ident_idr(net);
 	WARN_ON_ONCE(!list_empty(&nn->nfs_client_list));
 	WARN_ON_ONCE(!list_empty(&nn->nfs_volume_list));
-#if IS_ENABLED(CONFIG_NFS_V4_1)
+#if IS_ENABLED(CONFIG_NFS_V4)
 	WARN_ON_ONCE(!list_empty(&nn->nfs4_data_server_cache));
-#endif
+#endif /* CONFIG_NFS_V4 */
 }
 
 #ifdef CONFIG_PROC_FS
fs/nfs/internal.h +4 -8
index e99998e515c0..63e09dfc27a8 100644
@@ -334,17 +334,13 @@ extern int nfs3_decode_dirent(struct xdr_stream *,
 #if IS_ENABLED(CONFIG_NFS_V4)
 extern int nfs4_decode_dirent(struct xdr_stream *,
 				struct nfs_entry *, bool);
-#endif
-#ifdef CONFIG_NFS_V4_1
 extern const u32 nfs41_maxread_overhead;
 extern const u32 nfs41_maxwrite_overhead;
 extern const u32 nfs41_maxgetdevinfo_overhead;
-#endif
 
 /* nfs4proc.c */
-#if IS_ENABLED(CONFIG_NFS_V4)
 extern const struct rpc_procinfo nfs4_procedures[];
-#endif
+#endif /* CONFIG_NFS_V4 */
 
 #ifdef CONFIG_NFS_V4_SECURITY_LABEL
 extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
@@ -639,7 +635,7 @@ void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio);
 int nfs_filemap_write_and_wait_range(struct address_space *mapping,
 		loff_t lstart, loff_t lend);
 
-#ifdef CONFIG_NFS_V4_1
+#ifdef CONFIG_NFS_V4
 static inline void
 pnfs_bucket_clear_pnfs_ds_commit_verifiers(struct pnfs_commit_bucket *buckets,
 		unsigned int nbuckets)
@@ -660,12 +656,12 @@ void nfs_clear_pnfs_ds_commit_verifiers(struct pnfs_ds_commit_info *cinfo)
 				array->nbuckets);
 	rcu_read_unlock();
 }
-#else
+#else /* CONFIG_NFS_V4 */
 static inline
 void nfs_clear_pnfs_ds_commit_verifiers(struct pnfs_ds_commit_info *cinfo)
 {
 }
-#endif
+#endif /* CONFIG_NFS_V4 */
 
 #ifdef CONFIG_MIGRATION
 int nfs_migrate_folio(struct address_space *, struct folio *dst,
fs/nfs/netns.h +1 -3
index 6ba3ea39e928..36658579100d 100644
@@ -31,11 +31,9 @@ struct nfs_net {
 	unsigned short nfs_callback_tcpport;
 	unsigned short nfs_callback_tcpport6;
 	int cb_users[NFS4_MAX_MINOR_VERSION + 1];
-#endif /* CONFIG_NFS_V4 */
-#if IS_ENABLED(CONFIG_NFS_V4_1)
 	struct list_head nfs4_data_server_cache;
 	spinlock_t nfs4_data_server_lock;
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4 */
 	struct nfs_netns_client *nfs_client;
 	spinlock_t nfs_client_lock;
 	ktime_t boot_time;
fs/nfs/nfs4_fs.h +1 -35
index 5a6728acb589..783df6901b84 100644
@@ -18,10 +18,8 @@
 
 #if defined(CONFIG_NFS_V4_2)
 #define NFS4_MAX_MINOR_VERSION 2
-#elif defined(CONFIG_NFS_V4_1)
+#else
 #define NFS4_MAX_MINOR_VERSION 1
-#else
-#define NFS4_MAX_MINOR_VERSION 0
 #endif
 
 #if IS_ENABLED(CONFIG_NFS_V4)
@@ -383,7 +381,6 @@ extern bool nfs4_match_stateid(const nfs4_stateid *s1, const nfs4_stateid *s2);
 extern int nfs4_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle,
 			      struct nfs_fattr *fattr);
 
-#if defined(CONFIG_NFS_V4_1)
 extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
 extern int nfs4_proc_create_session(struct nfs_client *, const struct cred *);
 extern int nfs4_proc_destroy_session(struct nfs4_session *, const struct cred *);
@@ -461,31 +458,6 @@ nfs4_state_protect_write(struct nfs_client *clp, struct rpc_clnt **clntp,
 	    !test_bit(NFS_SP4_MACH_CRED_COMMIT, &clp->cl_sp4_flags))
 		hdr->args.stable = NFS_FILE_SYNC;
 }
-#else /* CONFIG_NFS_v4_1 */
-static inline bool
-is_ds_only_client(struct nfs_client *clp)
-{
-	return false;
-}
-
-static inline bool
-is_ds_client(struct nfs_client *clp)
-{
-	return false;
-}
-
-static inline void
-nfs4_state_protect(struct nfs_client *clp, unsigned long sp4_flags,
-		   struct rpc_clnt **clntp, struct rpc_message *msg)
-{
-}
-
-static inline void
-nfs4_state_protect_write(struct nfs_client *clp, struct rpc_clnt **clntp,
-			 struct rpc_message *msg, struct nfs_pgio_header *hdr)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
 
 extern const struct nfs4_minor_version_ops *nfs_v4_minor_ops[];
 
@@ -518,18 +490,12 @@ int nfs4_discover_server_trunking(struct nfs_client *clp,
 			struct nfs_client **);
 int nfs40_discover_server_trunking(struct nfs_client *clp,
 			struct nfs_client **, const struct cred *);
-#if defined(CONFIG_NFS_V4_1)
 int nfs41_discover_server_trunking(struct nfs_client *clp,
 			struct nfs_client **, const struct cred *);
 extern void nfs4_schedule_session_recovery(struct nfs4_session *, int);
 extern void nfs41_notify_server(struct nfs_client *);
 bool nfs4_check_serverowner_major_id(struct nfs41_server_owner *o1,
 			struct nfs41_server_owner *o2);
-#else
-static inline void nfs4_schedule_session_recovery(struct nfs4_session *session, int err)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
 
 extern struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *, const struct cred *, gfp_t);
 extern void nfs4_put_state_owner(struct nfs4_state_owner *);
fs/nfs/nfs4client.c +0 -23
index 00b57e55aba8..51cf4a37d652 100644
@@ -44,7 +44,6 @@ static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion)
 	return ret < 0 ? ret : 0;
 }
 
-#ifdef CONFIG_NFS_V4_1
 /*
  * Per auth flavor data server rpc clients
  */
@@ -187,7 +186,6 @@ void nfs41_shutdown_client(struct nfs_client *clp)
 	}
 
 }
-#endif	/* CONFIG_NFS_V4_1 */
 
 struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
 {
@@ -217,9 +215,7 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
 	clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion];
 	clp->cl_mig_gen = 1;
 	clp->cl_last_renewal = jiffies;
-#if IS_ENABLED(CONFIG_NFS_V4_1)
 	init_waitqueue_head(&clp->cl_lock_waitq);
-#endif
 	INIT_LIST_HEAD(&clp->pending_cb_stateids);
 
 	if (cl_init->minorversion != 0)
@@ -332,8 +328,6 @@ static int nfs4_init_callback(struct nfs_client *clp)
 	return 0;
 }
 
-#if defined(CONFIG_NFS_V4_1)
-
 /**
  * nfs41_init_client - nfs_client initialization tasks for NFSv4.1+
  * @clp: nfs_client to initialize
@@ -365,8 +359,6 @@ int nfs41_init_client(struct nfs_client *clp)
 	return 0;
 }
 
-#endif	/* CONFIG_NFS_V4_1 */
-
 /*
  * Initialize the minor version specific parts of an NFS4 client record
  */
@@ -508,7 +500,6 @@ int nfs4_match_client(struct nfs_client  *pos,  struct nfs_client *new,
 	return 0;
 }
 
-#ifdef CONFIG_NFS_V4_1
 /*
  * Returns true if the server major ids match
  */
@@ -637,7 +628,6 @@ int nfs41_walk_client_list(struct nfs_client *new,
 	nfs_put_client(prev);
 	return status;
 }
-#endif	/* CONFIG_NFS_V4_1 */
 
 static void nfs4_destroy_server(struct nfs_server *server)
 {
@@ -669,7 +659,6 @@ nfs4_find_client_ident(struct net *net, int cb_ident)
 	return clp;
 }
 
-#if defined(CONFIG_NFS_V4_1)
 /* Common match routine for v4.0 and v4.1 callback services */
 static bool nfs4_cb_match_client(const struct sockaddr *addr,
 		struct nfs_client *clp, u32 minorversion)
@@ -727,16 +716,6 @@ nfs4_find_client_sessionid(struct net *net, const struct sockaddr *addr,
 	return NULL;
 }
 
-#else /* CONFIG_NFS_V4_1 */
-
-struct nfs_client *
-nfs4_find_client_sessionid(struct net *net, const struct sockaddr *addr,
-			   struct nfs4_sessionid *sid, u32 minorversion)
-{
-	return NULL;
-}
-#endif /* CONFIG_NFS_V4_1 */
-
 /*
  * Set up an NFS4 client
  */
@@ -878,7 +857,6 @@ EXPORT_SYMBOL_GPL(nfs4_set_ds_client);
  */
 static void nfs4_session_limit_rwsize(struct nfs_server *server)
 {
-#ifdef CONFIG_NFS_V4_1
 	struct nfs4_session *sess;
 	u32 server_resp_sz;
 	u32 server_rqst_sz;
@@ -895,7 +873,6 @@ static void nfs4_session_limit_rwsize(struct nfs_server *server)
 		server->rsize = server_resp_sz;
 	if (server->wsize > server_rqst_sz)
 		server->wsize = server_rqst_sz;
-#endif /* CONFIG_NFS_V4_1 */
 }
 
 /*
fs/nfs/nfs4proc.c +0 -55

250 lines not on this page · raw message

fs/nfs/nfs4session.c +0 -4
index 5db460476bf2..a2fdd4b80dc4 100644
@@ -408,8 +408,6 @@ void nfs41_wake_slot_table(struct nfs4_slot_table *tbl)
 	}
 }
 
-#if defined(CONFIG_NFS_V4_1)
-
 static void nfs41_set_max_slotid_locked(struct nfs4_slot_table *tbl,
 		u32 target_highest_slotid)
 {
@@ -653,5 +651,3 @@ int nfs4_init_ds_session(struct nfs_client *clp, unsigned long lease_time)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(nfs4_init_ds_session);
-
-#endif	/* defined(CONFIG_NFS_V4_1) */
fs/nfs/nfs4session.h +0 -23
index f9c291e2165c..d2569f599977 100644
@@ -111,7 +111,6 @@ static inline struct nfs4_session *nfs4_get_session(const struct nfs_client *clp
 	return clp->cl_session;
 }
 
-#if defined(CONFIG_NFS_V4_1)
 extern void nfs41_set_target_slotid(struct nfs4_slot_table *tbl,
 		u32 target_highest_slotid);
 extern void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
@@ -154,28 +153,6 @@ static inline void nfs4_copy_sessionid(struct nfs4_sessionid *dst,
  */
 #define nfs_session_id_hash(sess_id) \
 	(~crc32_le(0xFFFFFFFF, &(sess_id)->data[0], sizeof((sess_id)->data)))
-#else /* defined(CONFIG_NFS_V4_1) */
 
-static inline int nfs4_init_session(struct nfs_client *clp)
-{
-	return 0;
-}
-
-/*
- * Determine if sessions are in use.
- */
-static inline int nfs4_has_session(const struct nfs_client *clp)
-{
-	return 0;
-}
-
-static inline int nfs4_has_persistent_session(const struct nfs_client *clp)
-{
-	return 0;
-}
-
-#define nfs_session_id_hash(session) (0)
-
-#endif /* defined(CONFIG_NFS_V4_1) */
 #endif /* IS_ENABLED(CONFIG_NFS_V4) */
 #endif /* __LINUX_FS_NFS_NFS4SESSION_H */
fs/nfs/nfs4state.c +0 -17
index fe7c0d7cdace..2e8f6a8cac50 100644
@@ -259,8 +259,6 @@ static int nfs4_begin_drain_session(struct nfs_client *clp)
 	return nfs4_drain_slot_tbl(&ses->fc_slot_table);
 }
 
-#if defined(CONFIG_NFS_V4_1)
-
 static void nfs41_finish_session_reset(struct nfs_client *clp)
 {
 	clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
@@ -339,8 +337,6 @@ int nfs41_discover_server_trunking(struct nfs_client *clp,
 	return status;
 }
 
-#endif /* CONFIG_NFS_V4_1 */
-
 /**
  * nfs4_get_clid_cred - Acquire credential for a setclientid operation
  * @clp: client state handle
@@ -2306,7 +2302,6 @@ int nfs4_discover_server_trunking(struct nfs_client *clp,
 	return status;
 }
 
-#ifdef CONFIG_NFS_V4_1
 void nfs4_schedule_session_recovery(struct nfs4_session *session, int err)
 {
 	struct nfs_client *clp = session->clp;
@@ -2513,18 +2508,6 @@ static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
 		set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
 	}
 }
-#else /* CONFIG_NFS_V4_1 */
-static int nfs4_reset_session(struct nfs_client *clp) { return 0; }
-
-static int nfs4_bind_conn_to_session(struct nfs_client *clp)
-{
-	return 0;
-}
-
-static void nfs4_layoutreturn_any_run(struct nfs_client *clp)
-{
-}
-#endif /* CONFIG_NFS_V4_1 */
 
 static void nfs4_state_manager(struct nfs_client *clp)
 {
fs/nfs/nfs4trace.c +0 -2
index 987c92d6364b..3fdc013f56d8 100644
@@ -14,7 +14,6 @@
 #define CREATE_TRACE_POINTS
 #include "nfs4trace.h"
 
-#ifdef CONFIG_NFS_V4_1
 EXPORT_TRACEPOINT_SYMBOL_GPL(nfs4_pnfs_read);
 EXPORT_TRACEPOINT_SYMBOL_GPL(nfs4_pnfs_write);
 EXPORT_TRACEPOINT_SYMBOL_GPL(nfs4_pnfs_commit_ds);
@@ -39,4 +38,3 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(bl_pr_key_unreg);
 EXPORT_TRACEPOINT_SYMBOL_GPL(bl_pr_key_unreg_err);
 
 EXPORT_TRACEPOINT_SYMBOL_GPL(fl_getdevinfo);
-#endif
fs/nfs/nfs4trace.h +0 -16
index 6285128e631a..71df432931d3 100644
@@ -71,7 +71,6 @@ DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
-#ifdef CONFIG_NFS_V4_1
 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
@@ -302,8 +301,6 @@ TRACE_EVENT(pnfs_ds_connect,
                 )
 );
 
-#endif /* CONFIG_NFS_V4_1 */
-
 TRACE_EVENT(nfs4_setup_sequence,
 		TP_PROTO(
 			const struct nfs4_session *session,
@@ -1070,7 +1067,6 @@ TRACE_EVENT(nfs4_delegreturn_exit,
 		)
 );
 
-#ifdef CONFIG_NFS_V4_1
 DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
 		TP_PROTO(
 			const struct nfs4_state *state,
@@ -1125,7 +1121,6 @@ DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
-#endif /* CONFIG_NFS_V4_1 */
 
 DECLARE_EVENT_CLASS(nfs4_lookup_event,
 		TP_PROTO(
@@ -1628,12 +1623,8 @@ DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
 
-#ifdef CONFIG_NFS_V4_1
 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
 	(lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
-#else
-#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
-#endif
 
 DECLARE_EVENT_CLASS(nfs4_read_event,
 		TP_PROTO(
@@ -1705,9 +1696,7 @@ DECLARE_EVENT_CLASS(nfs4_read_event,
 			), \
 			TP_ARGS(hdr, error))
 DEFINE_NFS4_READ_EVENT(nfs4_read);
-#ifdef CONFIG_NFS_V4_1
 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
-#endif /* CONFIG_NFS_V4_1 */
 
 DECLARE_EVENT_CLASS(nfs4_write_event,
 		TP_PROTO(
@@ -1780,9 +1769,7 @@ DECLARE_EVENT_CLASS(nfs4_write_event,
 			), \
 			TP_ARGS(hdr, error))
 DEFINE_NFS4_WRITE_EVENT(nfs4_write);
-#ifdef CONFIG_NFS_V4_1
 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
-#endif /* CONFIG_NFS_V4_1 */
 
 DECLARE_EVENT_CLASS(nfs4_commit_event,
 		TP_PROTO(
@@ -1842,7 +1829,6 @@ DECLARE_EVENT_CLASS(nfs4_commit_event,
 			), \
 			TP_ARGS(data, error))
 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
-#ifdef CONFIG_NFS_V4_1
 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
 
 TRACE_EVENT(nfs4_layoutget,
@@ -2876,8 +2862,6 @@ DEFINE_NFS4_XATTR_EVENT(nfs4_removexattr);
 DEFINE_NFS4_INODE_EVENT(nfs4_listxattr);
 #endif /* CONFIG_NFS_V4_2 */
 
-#endif /* CONFIG_NFS_V4_1 */
-
 #endif /* _TRACE_NFS4_H */
 
 #undef TRACE_INCLUDE_PATH
fs/nfs/nfs4xdr.c +0 -87

250 lines not on this page · raw message

fs/nfs/pnfs.h +3 -3
index 91ff877185c8..1e83218de188 100644
@@ -84,7 +84,7 @@ enum pnfs_try_status {
 	PNFS_TRY_AGAIN     = 2,
 };
 
-#ifdef CONFIG_NFS_V4_1
+#if IS_ENABLED(CONFIG_NFS_V4)
 
 #define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4"
 
@@ -705,7 +705,7 @@ static inline void nfs4_print_deviceid(const struct nfs4_deviceid *dev_id)
 }
 
 #endif /* NFS_DEBUG */
-#else  /* CONFIG_NFS_V4_1 */
+#else  /* CONFIG_NFS_V4 */
 
 static inline bool nfs_have_layout(struct inode *inode)
 {
@@ -916,7 +916,7 @@ static inline bool pnfs_layout_is_valid(const struct pnfs_layout_hdr *lo)
 	return false;
 }
 
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4 */
 
 #if IS_ENABLED(CONFIG_NFS_V4_2)
 int pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags);
fs/nfs/read.c +2 -2
index 3c1fa320b3f1..e1fe78d7b8d0 100644
@@ -68,10 +68,10 @@ void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
 	struct nfs_server *server = NFS_SERVER(inode);
 	const struct nfs_pageio_ops *pg_ops = &nfs_pgio_rw_ops;
 
-#ifdef CONFIG_NFS_V4_1
+#if IS_ENABLED(CONFIG_NFS_V4)
 	if (server->pnfs_curr_ld && !force_mds)
 		pg_ops = server->pnfs_curr_ld->pg_read_ops;
-#endif
+#endif /* CONFIG_NFS_V4 */
 	nfs_pageio_init(pgio, inode, pg_ops, compl_ops, &nfs_rw_read_ops,
 			server->rsize, 0);
 }
fs/nfs/super.c +3 -13
index 57d372db03b9..8ff69603d594 100644
@@ -597,18 +597,13 @@ static void show_lease(struct seq_file *m, struct nfs_server *server)
 	seq_printf(m, ",lease_expired=%ld",
 		   time_after(expire, jiffies) ?  0 : (jiffies - expire) / HZ);
 }
-#ifdef CONFIG_NFS_V4_1
+
 static void show_sessions(struct seq_file *m, struct nfs_server *server)
 {
 	if (nfs4_has_session(server->nfs_client))
 		seq_puts(m, ",sessions");
 }
-#else
-static void show_sessions(struct seq_file *m, struct nfs_server *server) {}
-#endif
-#endif
 
-#ifdef CONFIG_NFS_V4_1
 static void show_pnfs(struct seq_file *m, struct nfs_server *server)
 {
 	seq_printf(m, ",pnfs=");
@@ -628,16 +623,11 @@ static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
 			   impl_id->date.seconds, impl_id->date.nseconds);
 	}
 }
-#else
-#if IS_ENABLED(CONFIG_NFS_V4)
-static void show_pnfs(struct seq_file *m, struct nfs_server *server)
-{
-}
-#endif
+#else /* CONFIG_NFS_V4 */
 static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
 {
 }
-#endif
+#endif /* CONFIG_NFS_V4 */
 
 int nfs_show_devname(struct seq_file *m, struct dentry *root)
 {
fs/nfs/sysfs.c +5 -5
index ea6e6168092b..7bf650fda1cb 100644
@@ -293,7 +293,7 @@ shutdown_store(struct kobject *kobj, struct kobj_attribute *attr,
 
 static struct kobj_attribute nfs_sysfs_attr_shutdown = __ATTR_RW(shutdown);
 
-#if IS_ENABLED(CONFIG_NFS_V4_1)
+#if IS_ENABLED(CONFIG_NFS_V4)
 static ssize_t
 implid_domain_show(struct kobject *kobj, struct kobj_attribute *attr,
 				char *buf)
@@ -323,7 +323,7 @@ implid_name_show(struct kobject *kobj, struct kobj_attribute *attr,
 
 static struct kobj_attribute nfs_sysfs_attr_implid_name = __ATTR_RO(implid_name);
 
-#endif /* IS_ENABLED(CONFIG_NFS_V4_1) */
+#endif /* IS_ENABLED(CONFIG_NFS_V4) */
 
 #define RPC_CLIENT_NAME_SIZE 64
 
@@ -362,7 +362,7 @@ static struct kobj_type nfs_sb_ktype = {
 	.child_ns_type = nfs_netns_object_child_ns_type,
 };
 
-#if IS_ENABLED(CONFIG_NFS_V4_1)
+#if IS_ENABLED(CONFIG_NFS_V4)
 static void nfs_sysfs_add_nfsv41_server(struct nfs_server *server)
 {
 	int ret;
@@ -382,11 +382,11 @@ static void nfs_sysfs_add_nfsv41_server(struct nfs_server *server)
 		pr_warn("NFS: sysfs_create_file_ns for server-%d failed (%d)\n",
 			server->s_sysfs_id, ret);
 }
-#else /* CONFIG_NFS_V4_1 */
+#else /* CONFIG_NFS_V4 */
 static inline void nfs_sysfs_add_nfsv41_server(struct nfs_server *server)
 {
 }
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4 */
 
 #if IS_ENABLED(CONFIG_NFS_LOCALIO)
 
fs/nfs/write.c +1 -1
index 336c510f3750..33f785086f42 100644
@@ -1402,7 +1402,7 @@ void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
 	struct nfs_server *server = NFS_SERVER(inode);
 	const struct nfs_pageio_ops *pg_ops = &nfs_pgio_rw_ops;
 
-#ifdef CONFIG_NFS_V4_1
+#if IS_ENABLED(CONFIG_NFS_V4)
 	if (server->pnfs_curr_ld && !force_mds)
 		pg_ops = server->pnfs_curr_ld->pg_write_ops;
 #endif
include/linux/nfs_fs_sb.h +0 -2
index c58b870f31ee..a810a42b6495 100644
@@ -115,9 +115,7 @@ struct nfs_client {
 #define NFS_SP4_MACH_CRED_WRITE    5	/* WRITE */
 #define NFS_SP4_MACH_CRED_COMMIT   6	/* COMMIT */
 #define NFS_SP4_MACH_CRED_PNFS_CLEANUP  7 /* LAYOUTRETURN */
-#if IS_ENABLED(CONFIG_NFS_V4_1)
 	wait_queue_head_t	cl_lock_waitq;
-#endif /* CONFIG_NFS_V4_1 */
 #endif /* CONFIG_NFS_V4 */
 
 	/* Our own IP address, as a null-terminated string.
include/linux/nfs_xdr.h +1 -5
index 2aa4e38af57a..437e6f4af7e0 100644
@@ -1324,10 +1324,6 @@ struct nfs4_fsid_present_res {
 	unsigned char			renew:1;
 };
 
-#endif /* CONFIG_NFS_V4 */
-
-#ifdef CONFIG_NFS_V4_1
-
 struct pnfs_commit_bucket {
 	struct list_head written;
 	struct list_head committing;
@@ -1467,7 +1463,7 @@ struct nfs41_free_stateid_res {
 struct pnfs_ds_commit_info {
 };
 
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_NFS_V4 */
 
 #ifdef CONFIG_NFS_V4_2
 struct nfs42_falloc_args {
Signature · 1 line
2.52.0