Skip to contentSkip to conversation

NFSv4_2: SSC helper should use its own config.

PATCH Superseded Dai Ngo 4 participants 6 messages Jan 23, 2021 – Jan 27, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Dai Ngo

author reviewer
#0 lore raw

PATCH 1/1 NFSv4_2: SSC helper should use its own config.

Currently NFSv4_2 SSC helper, nfs_ssc, incorrectly uses GRACE_PERIOD as its config. Fix by adding new config NFS_V4_2_SSC_HELPER which depends on NFS_V4_2 and is automatically selected when NFSD_V4 is enabled. Also removed the file name from a comment in nfs_ssc.c.

Fixes 0cfcd405e758 (NFSv4.2: Fix NFS4ERR_STALE error when doing inter server copy)
---
 fs/Kconfig              |  3 +++
 fs/nfs/nfs4file.c       |  4 ++++
 fs/nfs/super.c          | 12 ++++++++++++
 fs/nfs_common/Makefile  |  2 +-
 fs/nfs_common/nfs_ssc.c |  2 --
 fs/nfsd/Kconfig         |  1 +
 6 files changed, 21 insertions(+), 3 deletions(-)
fs/Kconfig +3 -0
index aa4c12282301..d33a31239cbc 100644
@@ -333,6 +333,9 @@ config NFS_COMMON
 	depends on NFSD || NFS_FS || LOCKD
 	default y
 
+config NFS_V4_2_SSC_HELPER
+	tristate
+
 source "net/sunrpc/Kconfig"
 source "fs/ceph/Kconfig"
 source "fs/cifs/Kconfig"
fs/nfs/nfs4file.c +4 -0
index 57b3821d975a..441a2fa073c8 100644
@@ -420,7 +420,9 @@ static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = {
  */
 void nfs42_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 
 /**
@@ -431,7 +433,9 @@ void nfs42_ssc_register_ops(void)
  */
 void nfs42_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 #endif /* CONFIG_NFS_V4_2 */
 
fs/nfs/super.c +12 -0
index 4034102010f0..c7a924580eec 100644
@@ -86,9 +86,11 @@ const struct super_operations nfs_sops = {
 };
 EXPORT_SYMBOL_GPL(nfs_sops);
 
+#ifdef CONFIG_NFS_V4_2
 static const struct nfs_ssc_client_ops nfs_ssc_clnt_ops_tbl = {
 	.sco_sb_deactive = nfs_sb_deactive,
 };
+#endif
 
 #if IS_ENABLED(CONFIG_NFS_V4)
 static int __init register_nfs4_fs(void)
@@ -111,15 +113,21 @@ static void unregister_nfs4_fs(void)
 }
 #endif
 
+#ifdef CONFIG_NFS_V4_2
 static void nfs_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_register(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
 
 static void nfs_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_unregister(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
+#endif /* CONFIG_NFS_V4_2 */
 
 static struct shrinker acl_shrinker = {
 	.count_objects	= nfs_access_cache_count,
@@ -148,7 +156,9 @@ int __init register_nfs_fs(void)
 	ret = register_shrinker(&acl_shrinker);
 	if (ret < 0)
 		goto error_3;
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_register_ops();
+#endif
 	return 0;
 error_3:
 	nfs_unregister_sysctl();
@@ -168,7 +178,9 @@ void __exit unregister_nfs_fs(void)
 	unregister_shrinker(&acl_shrinker);
 	nfs_unregister_sysctl();
 	unregister_nfs4_fs();
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_unregister_ops();
+#endif
 	unregister_filesystem(&nfs_fs_type);
 }
 
fs/nfs_common/Makefile +1 -1
index fa82f5aaa6d9..119c75ab9fd0 100644
@@ -7,4 +7,4 @@ obj-$(CONFIG_NFS_ACL_SUPPORT) += nfs_acl.o
 nfs_acl-objs := nfsacl.o
 
 obj-$(CONFIG_GRACE_PERIOD) += grace.o
-obj-$(CONFIG_GRACE_PERIOD) += nfs_ssc.o
+obj-$(CONFIG_NFS_V4_2_SSC_HELPER) += nfs_ssc.o
fs/nfs_common/nfs_ssc.c +0 -2
index f43bbb373913..7c1509e968c8 100644
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * fs/nfs_common/nfs_ssc_comm.c
- *
  * Helper for knfsd's SSC to access ops in NFS client modules
  *
  * Author: Dai Ngo <[email protected]>
fs/nfsd/Kconfig +1 -0
index dbbc583d6273..821e5913faee 100644
@@ -76,6 +76,7 @@ config NFSD_V4
 	select CRYPTO_MD5
 	select CRYPTO_SHA256
 	select GRACE_PERIOD
+	select NFS_V4_2_SSC_HELPER if NFS_V4_2
 	help
 	  This option enables support in your system's NFS server for
 	  version 4 of the NFS protocol (RFC 3530).
Signature · 1 line
2.9.5
#1 lore raw

Seems reasonable to me.--b.

Quoted 148 lines · Dai Ngo

Currently NFSv4_2 SSC helper, nfs_ssc, incorrectly uses GRACE_PERIOD as its config. Fix by adding new config NFS_V4_2_SSC_HELPER which depends on NFS_V4_2 and is automatically selected when NFSD_V4 is enabled. Also removed the file name from a comment in nfs_ssc.c.

Fixes 0cfcd405e758 (NFSv4.2: Fix NFS4ERR_STALE error when doing inter server copy)
---
 fs/Kconfig              |  3 +++
 fs/nfs/nfs4file.c       |  4 ++++
 fs/nfs/super.c          | 12 ++++++++++++
 fs/nfs_common/Makefile  |  2 +-
 fs/nfs_common/nfs_ssc.c |  2 --
 fs/nfsd/Kconfig         |  1 +
 6 files changed, 21 insertions(+), 3 deletions(-)
fs/Kconfig +3 -0
index aa4c12282301..d33a31239cbc 100644
@@ -333,6 +333,9 @@ config NFS_COMMON
 	depends on NFSD || NFS_FS || LOCKD
 	default y
 
+config NFS_V4_2_SSC_HELPER
+	tristate
+
 source "net/sunrpc/Kconfig"
 source "fs/ceph/Kconfig"
 source "fs/cifs/Kconfig"
fs/nfs/nfs4file.c +4 -0
index 57b3821d975a..441a2fa073c8 100644
@@ -420,7 +420,9 @@ static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = {
  */
 void nfs42_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 
 /**
@@ -431,7 +433,9 @@ void nfs42_ssc_register_ops(void)
  */
 void nfs42_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 #endif /* CONFIG_NFS_V4_2 */
 
fs/nfs/super.c +12 -0
index 4034102010f0..c7a924580eec 100644
@@ -86,9 +86,11 @@ const struct super_operations nfs_sops = {
 };
 EXPORT_SYMBOL_GPL(nfs_sops);
 
+#ifdef CONFIG_NFS_V4_2
 static const struct nfs_ssc_client_ops nfs_ssc_clnt_ops_tbl = {
 	.sco_sb_deactive = nfs_sb_deactive,
 };
+#endif
 
 #if IS_ENABLED(CONFIG_NFS_V4)
 static int __init register_nfs4_fs(void)
@@ -111,15 +113,21 @@ static void unregister_nfs4_fs(void)
 }
 #endif
 
+#ifdef CONFIG_NFS_V4_2
 static void nfs_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_register(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
 
 static void nfs_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_unregister(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
+#endif /* CONFIG_NFS_V4_2 */
 
 static struct shrinker acl_shrinker = {
 	.count_objects	= nfs_access_cache_count,
@@ -148,7 +156,9 @@ int __init register_nfs_fs(void)
 	ret = register_shrinker(&acl_shrinker);
 	if (ret < 0)
 		goto error_3;
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_register_ops();
+#endif
 	return 0;
 error_3:
 	nfs_unregister_sysctl();
@@ -168,7 +178,9 @@ void __exit unregister_nfs_fs(void)
 	unregister_shrinker(&acl_shrinker);
 	nfs_unregister_sysctl();
 	unregister_nfs4_fs();
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_unregister_ops();
+#endif
 	unregister_filesystem(&nfs_fs_type);
 }
 
fs/nfs_common/Makefile +1 -1
index fa82f5aaa6d9..119c75ab9fd0 100644
@@ -7,4 +7,4 @@ obj-$(CONFIG_NFS_ACL_SUPPORT) += nfs_acl.o
 nfs_acl-objs := nfsacl.o
 
 obj-$(CONFIG_GRACE_PERIOD) += grace.o
-obj-$(CONFIG_GRACE_PERIOD) += nfs_ssc.o
+obj-$(CONFIG_NFS_V4_2_SSC_HELPER) += nfs_ssc.o
fs/nfs_common/nfs_ssc.c +0 -2
index f43bbb373913..7c1509e968c8 100644
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * fs/nfs_common/nfs_ssc_comm.c
- *
  * Helper for knfsd's SSC to access ops in NFS client modules
  *
  * Author: Dai Ngo <[email protected]>
fs/nfsd/Kconfig +1 -0
index dbbc583d6273..821e5913faee 100644
@@ -76,6 +76,7 @@ config NFSD_V4
 	select CRYPTO_MD5
 	select CRYPTO_SHA256
 	select GRACE_PERIOD
+	select NFS_V4_2_SSC_HELPER if NFS_V4_2
 	help
 	  This option enables support in your system's NFS server for
 	  version 4 of the NFS protocol (RFC 3530).
Signature · 1 line
2.9.5
#2 lore raw
In reply to Dai Ngo
Quoted 10 lines · Dai Ngo

Currently NFSv4_2 SSC helper, nfs_ssc, incorrectly uses GRACE_PERIOD as its config. Fix by adding new config NFS_V4_2_SSC_HELPER which depends on NFS_V4_2 and is automatically selected when NFSD_V4 is enabled. Also removed the file name from a comment in nfs_ssc.c.

Fixes 0cfcd405e758 (NFSv4.2: Fix NFS4ERR_STALE error when doing inter server copy)

This patch feels more like a clean up / refactor then a fix, so I'm not certain we want to request an automatic backport to stable for it. Dai, would you mind if we dropped the
Fixes: tag, or is there something I missed?

Quoted 143 lines

---

fs/Kconfig              |  3 +++
fs/nfs/nfs4file.c       |  4 ++++
fs/nfs/super.c          | 12 ++++++++++++
fs/nfs_common/Makefile  |  2 +-
fs/nfs_common/nfs_ssc.c |  2 --
fs/nfsd/Kconfig         |  1 +
6 files changed, 21 insertions(+), 3 deletions(-)
fs/Kconfig +3 -0
index aa4c12282301..d33a31239cbc 100644
@@ -333,6 +333,9 @@ config NFS_COMMON
 	depends on NFSD || NFS_FS || LOCKD
 	default y
 
+config NFS_V4_2_SSC_HELPER
+	tristate
+

source "net/sunrpc/Kconfig"
source "fs/ceph/Kconfig"
source "fs/cifs/Kconfig"

fs/nfs/nfs4file.c +4 -0
index 57b3821d975a..441a2fa073c8 100644
@@ -420,7 +420,9 @@ static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = {
 */
 void nfs42_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 
 /**
@@ -431,7 +433,9 @@ void nfs42_ssc_register_ops(void)
 */
 void nfs42_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 #endif /* CONFIG_NFS_V4_2 */
 
fs/nfs/super.c +10 -0
index 4034102010f0..c7a924580eec 100644
@@ -86,9 +86,11 @@ const struct super_operations nfs_sops = {
 };
 EXPORT_SYMBOL_GPL(nfs_sops);
 
+#ifdef CONFIG_NFS_V4_2
 static const struct nfs_ssc_client_ops nfs_ssc_clnt_ops_tbl = {
 	.sco_sb_deactive = nfs_sb_deactive,
 };
+#endif
 
 #if IS_ENABLED(CONFIG_NFS_V4)
 static int __init register_nfs4_fs(void)
@@ -111,15 +113,21 @@ static void unregister_nfs4_fs(void)
 }
 #endif
 
+#ifdef CONFIG_NFS_V4_2
 static void nfs_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_register(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
 
 static void nfs_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_unregister(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
+#endif /* CONFIG_NFS_V4_2 */
 
 static struct shrinker acl_shrinker = {
 	.count_objects	= nfs_access_cache_count,
@@ -148,7 +156,9 @@ int __init register_nfs_fs(void)
 	ret = register_shrinker(&acl_shrinker);
 	if (ret < 0)
 		goto error_3;
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_register_ops();
+#endif
 	return 0;

error_3:

	nfs_unregister_sysctl();
fs/nfs/super.c +2 -0
@@ -168,7 +178,9 @@ void __exit unregister_nfs_fs(void)
 	unregister_shrinker(&acl_shrinker);
 	nfs_unregister_sysctl();
 	unregister_nfs4_fs();
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_unregister_ops();
+#endif
 	unregister_filesystem(&nfs_fs_type);
 }
 
fs/nfs_common/Makefile +0 -0
index fa82f5aaa6d9..119c75ab9fd0 100644
@@ -7,4 +7,4 @@ obj-$(CONFIG_NFS_ACL_SUPPORT) += nfs_acl.o

nfs_acl-objs := nfsacl.o

obj-$(CONFIG_GRACE_PERIOD) += grace.o

fs/nfs_common/Makefile +1 -1
-obj-$(CONFIG_GRACE_PERIOD) += nfs_ssc.o
+obj-$(CONFIG_NFS_V4_2_SSC_HELPER) += nfs_ssc.o
fs/nfs_common/nfs_ssc.c +0 -2
index f43bbb373913..7c1509e968c8 100644
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * fs/nfs_common/nfs_ssc_comm.c
- *
 * Helper for knfsd's SSC to access ops in NFS client modules
 *
 * Author: Dai Ngo <[email protected]>
fs/nfsd/Kconfig +1 -0
index dbbc583d6273..821e5913faee 100644
@@ -76,6 +76,7 @@ config NFSD_V4
 	select CRYPTO_MD5
 	select CRYPTO_SHA256
 	select GRACE_PERIOD
+	select NFS_V4_2_SSC_HELPER if NFS_V4_2
 	help
 	  This option enables support in your system's NFS server for
 	  version 4 of the NFS protocol (RFC 3530).
Signature · 1 line
2.9.5

--
Chuck Lever

author reviewer
#3 lore raw
Quoted 8 lines · Chuck Lever
Quoted 8 lines · Dai Ngo

Currently NFSv4_2 SSC helper, nfs_ssc, incorrectly uses GRACE_PERIOD as its config. Fix by adding new config NFS_V4_2_SSC_HELPER which depends on NFS_V4_2 and is automatically selected when NFSD_V4 is enabled. Also removed the file name from a comment in nfs_ssc.c.

Quoted 5 lines
Quoted 1 line
Fixes 0cfcd405e758 (NFSv4.2: Fix NFS4ERR_STALE error when doing inter server copy)

This patch feels more like a clean up / refactor then a fix, so I'm not certain we want to request an automatic backport to stable for it. Dai, would you mind if we dropped the
Fixes: tag, or is there something I missed?

Yes, it's a cleanup. The Fixes: tag is not needed. Thank you Chuck,

-Dai

Quoted 149 lines
Quoted 144 lines

---

fs/Kconfig              |  3 +++
fs/nfs/nfs4file.c       |  4 ++++
fs/nfs/super.c          | 12 ++++++++++++
fs/nfs_common/Makefile  |  2 +-
fs/nfs_common/nfs_ssc.c |  2 --
fs/nfsd/Kconfig         |  1 +
6 files changed, 21 insertions(+), 3 deletions(-)
fs/Kconfig +3 -0
index aa4c12282301..d33a31239cbc 100644
@@ -333,6 +333,9 @@ config NFS_COMMON
 	depends on NFSD || NFS_FS || LOCKD
 	default y
 
+config NFS_V4_2_SSC_HELPER
+	tristate
+

source "net/sunrpc/Kconfig"
source "fs/ceph/Kconfig"
source "fs/cifs/Kconfig"

fs/nfs/nfs4file.c +4 -0
index 57b3821d975a..441a2fa073c8 100644
@@ -420,7 +420,9 @@ static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = {
  */
 void nfs42_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 
 /**
@@ -431,7 +433,9 @@ void nfs42_ssc_register_ops(void)
  */
 void nfs42_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 #endif /* CONFIG_NFS_V4_2 */
 
fs/nfs/super.c +10 -0
index 4034102010f0..c7a924580eec 100644
@@ -86,9 +86,11 @@ const struct super_operations nfs_sops = {
 };
 EXPORT_SYMBOL_GPL(nfs_sops);
 
+#ifdef CONFIG_NFS_V4_2
 static const struct nfs_ssc_client_ops nfs_ssc_clnt_ops_tbl = {
 	.sco_sb_deactive = nfs_sb_deactive,
 };
+#endif
 
 #if IS_ENABLED(CONFIG_NFS_V4)
 static int __init register_nfs4_fs(void)
@@ -111,15 +113,21 @@ static void unregister_nfs4_fs(void)
 }
 #endif
 
+#ifdef CONFIG_NFS_V4_2
 static void nfs_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_register(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
 
 static void nfs_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_unregister(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
+#endif /* CONFIG_NFS_V4_2 */
 
 static struct shrinker acl_shrinker = {
 	.count_objects	= nfs_access_cache_count,
@@ -148,7 +156,9 @@ int __init register_nfs_fs(void)
 	ret = register_shrinker(&acl_shrinker);
 	if (ret < 0)
 		goto error_3;
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_register_ops();
+#endif
 	return 0;

error_3:

	nfs_unregister_sysctl();
fs/nfs/super.c +2 -0
@@ -168,7 +178,9 @@ void __exit unregister_nfs_fs(void)
 	unregister_shrinker(&acl_shrinker);
 	nfs_unregister_sysctl();
 	unregister_nfs4_fs();
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_unregister_ops();
+#endif
 	unregister_filesystem(&nfs_fs_type);
 }
 
fs/nfs_common/Makefile +0 -0
index fa82f5aaa6d9..119c75ab9fd0 100644
@@ -7,4 +7,4 @@ obj-$(CONFIG_NFS_ACL_SUPPORT) += nfs_acl.o

nfs_acl-objs := nfsacl.o

obj-$(CONFIG_GRACE_PERIOD) += grace.o

fs/nfs_common/Makefile +1 -1
-obj-$(CONFIG_GRACE_PERIOD) += nfs_ssc.o
+obj-$(CONFIG_NFS_V4_2_SSC_HELPER) += nfs_ssc.o
fs/nfs_common/nfs_ssc.c +0 -2
index f43bbb373913..7c1509e968c8 100644
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * fs/nfs_common/nfs_ssc_comm.c
- *
  * Helper for knfsd's SSC to access ops in NFS client modules
  *
  * Author: Dai Ngo <[email protected]>
fs/nfsd/Kconfig +1 -0
index dbbc583d6273..821e5913faee 100644
@@ -76,6 +76,7 @@ config NFSD_V4
 	select CRYPTO_MD5
 	select CRYPTO_SHA256
 	select GRACE_PERIOD
+	select NFS_V4_2_SSC_HELPER if NFS_V4_2
 	help
 	  This option enables support in your system's NFS server for
 	  version 4 of the NFS protocol (RFC 3530).
Signature · 1 line
2.9.5

--
Chuck Lever

#4 lore raw
In reply to Dai Ngo

Hi Dai-

Quoted 9 lines · Dai Ngo

Currently NFSv4_2 SSC helper, nfs_ssc, incorrectly uses GRACE_PERIOD as its config. Fix by adding new config NFS_V4_2_SSC_HELPER which depends on NFS_V4_2 and is automatically selected when NFSD_V4 is enabled. Also removed the file name from a comment in nfs_ssc.c.

Fixes 0cfcd405e758 (NFSv4.2: Fix NFS4ERR_STALE error when doing inter server copy)

Thanks for your patch. It has been committed to the for-next branch at

git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git

in preparation for the v5.12 merge window.

Quoted 142 lines

---

fs/Kconfig              |  3 +++
fs/nfs/nfs4file.c       |  4 ++++
fs/nfs/super.c          | 12 ++++++++++++
fs/nfs_common/Makefile  |  2 +-
fs/nfs_common/nfs_ssc.c |  2 --
fs/nfsd/Kconfig         |  1 +
6 files changed, 21 insertions(+), 3 deletions(-)
fs/Kconfig +3 -0
index aa4c12282301..d33a31239cbc 100644
@@ -333,6 +333,9 @@ config NFS_COMMON
 	depends on NFSD || NFS_FS || LOCKD
 	default y
 
+config NFS_V4_2_SSC_HELPER
+	tristate
+

source "net/sunrpc/Kconfig"
source "fs/ceph/Kconfig"
source "fs/cifs/Kconfig"

fs/nfs/nfs4file.c +4 -0
index 57b3821d975a..441a2fa073c8 100644
@@ -420,7 +420,9 @@ static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = {
 */
 void nfs42_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 
 /**
@@ -431,7 +433,9 @@ void nfs42_ssc_register_ops(void)
 */
 void nfs42_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl);
+#endif
 }
 #endif /* CONFIG_NFS_V4_2 */
 
fs/nfs/super.c +10 -0
index 4034102010f0..c7a924580eec 100644
@@ -86,9 +86,11 @@ const struct super_operations nfs_sops = {
 };
 EXPORT_SYMBOL_GPL(nfs_sops);
 
+#ifdef CONFIG_NFS_V4_2
 static const struct nfs_ssc_client_ops nfs_ssc_clnt_ops_tbl = {
 	.sco_sb_deactive = nfs_sb_deactive,
 };
+#endif
 
 #if IS_ENABLED(CONFIG_NFS_V4)
 static int __init register_nfs4_fs(void)
@@ -111,15 +113,21 @@ static void unregister_nfs4_fs(void)
 }
 #endif
 
+#ifdef CONFIG_NFS_V4_2
 static void nfs_ssc_register_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_register(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
 
 static void nfs_ssc_unregister_ops(void)
 {
+#ifdef CONFIG_NFSD_V4
 	nfs_ssc_unregister(&nfs_ssc_clnt_ops_tbl);
+#endif
 }
+#endif /* CONFIG_NFS_V4_2 */
 
 static struct shrinker acl_shrinker = {
 	.count_objects	= nfs_access_cache_count,
@@ -148,7 +156,9 @@ int __init register_nfs_fs(void)
 	ret = register_shrinker(&acl_shrinker);
 	if (ret < 0)
 		goto error_3;
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_register_ops();
+#endif
 	return 0;

error_3:

	nfs_unregister_sysctl();
fs/nfs/super.c +2 -0
@@ -168,7 +178,9 @@ void __exit unregister_nfs_fs(void)
 	unregister_shrinker(&acl_shrinker);
 	nfs_unregister_sysctl();
 	unregister_nfs4_fs();
+#ifdef CONFIG_NFS_V4_2
 	nfs_ssc_unregister_ops();
+#endif
 	unregister_filesystem(&nfs_fs_type);
 }
 
fs/nfs_common/Makefile +0 -0
index fa82f5aaa6d9..119c75ab9fd0 100644
@@ -7,4 +7,4 @@ obj-$(CONFIG_NFS_ACL_SUPPORT) += nfs_acl.o

nfs_acl-objs := nfsacl.o

obj-$(CONFIG_GRACE_PERIOD) += grace.o

fs/nfs_common/Makefile +1 -1
-obj-$(CONFIG_GRACE_PERIOD) += nfs_ssc.o
+obj-$(CONFIG_NFS_V4_2_SSC_HELPER) += nfs_ssc.o
fs/nfs_common/nfs_ssc.c +0 -2
index f43bbb373913..7c1509e968c8 100644
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * fs/nfs_common/nfs_ssc_comm.c
- *
 * Helper for knfsd's SSC to access ops in NFS client modules
 *
 * Author: Dai Ngo <[email protected]>
fs/nfsd/Kconfig +1 -0
index dbbc583d6273..821e5913faee 100644
@@ -76,6 +76,7 @@ config NFSD_V4
 	select CRYPTO_MD5
 	select CRYPTO_SHA256
 	select GRACE_PERIOD
+	select NFS_V4_2_SSC_HELPER if NFS_V4_2
 	help
 	  This option enables support in your system's NFS server for
 	  version 4 of the NFS protocol (RFC 3530).
Signature · 1 line
2.9.5

--
Chuck Lever

#5 lore raw
In reply to Dai Ngo
Thank you for the patch! Yet something to improve:

Hi Dai,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on nfs/linux-next]
[also build test ERROR on linus/master nfsd/nfsd-next v5.11-rc5 next-20210125] [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]

url:    https://github.com/0day-ci/linux/commits/Dai-Ngo/NFSv4_2-SSC-helper-should-use-its-own-config/20210124-141002
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: x86_64-kexec (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/39c41233a1cdc4dc2d2a690293049510d384a2b2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dai-Ngo/NFSv4_2-SSC-helper-should-use-its-own-config/20210124-141002
        git checkout 39c41233a1cdc4dc2d2a690293049510d384a2b2
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

ld: fs/nfs/super.o: in function `nfs_ssc_register_ops':
fs/nfs/super.c:120: undefined reference to `nfs_ssc_register'
ld: fs/nfs/super.o: in function `nfs_ssc_unregister_ops':
fs/nfs/super.c:127: undefined reference to `nfs_ssc_unregister'
ld: fs/nfs/nfs4file.o: in function `nfs42_ssc_register_ops':

>> fs/nfs/nfs4file.c:424: undefined reference to `nfs42_ssc_register'
   ld: fs/nfs/nfs4file.o: in function `nfs42_ssc_unregister_ops':
>> fs/nfs/nfs4file.c:437: undefined reference to `nfs42_ssc_unregister'

vim +424 fs/nfs/nfs4file.c

0cfcd405e758ba Dai Ngo           2020-10-18  414  
0cfcd405e758ba Dai Ngo           2020-10-18  415  /**
0cfcd405e758ba Dai Ngo           2020-10-18  416   * nfs42_ssc_register_ops - Wrapper to register NFS_V4 ops in nfs_common
0cfcd405e758ba Dai Ngo           2020-10-18  417   *
0cfcd405e758ba Dai Ngo           2020-10-18  418   * Return values:
0cfcd405e758ba Dai Ngo           2020-10-18  419   *   None
0cfcd405e758ba Dai Ngo           2020-10-18  420   */
0cfcd405e758ba Dai Ngo           2020-10-18  421  void nfs42_ssc_register_ops(void)
0cfcd405e758ba Dai Ngo           2020-10-18  422  {
39c41233a1cdc4 Dai Ngo           2021-01-22  423  #ifdef CONFIG_NFSD_V4
0cfcd405e758ba Dai Ngo           2020-10-18 @424  	nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl);
39c41233a1cdc4 Dai Ngo           2021-01-22  425  #endif
0cfcd405e758ba Dai Ngo           2020-10-18  426  }
0cfcd405e758ba Dai Ngo           2020-10-18  427  
0cfcd405e758ba Dai Ngo           2020-10-18  428  /**
0cfcd405e758ba Dai Ngo           2020-10-18  429   * nfs42_ssc_unregister_ops - wrapper to un-register NFS_V4 ops in nfs_common
0cfcd405e758ba Dai Ngo           2020-10-18  430   *
0cfcd405e758ba Dai Ngo           2020-10-18  431   * Return values:
0cfcd405e758ba Dai Ngo           2020-10-18  432   *   None.
0cfcd405e758ba Dai Ngo           2020-10-18  433   */
0cfcd405e758ba Dai Ngo           2020-10-18  434  void nfs42_ssc_unregister_ops(void)
0cfcd405e758ba Dai Ngo           2020-10-18  435  {
39c41233a1cdc4 Dai Ngo           2021-01-22  436  #ifdef CONFIG_NFSD_V4
0cfcd405e758ba Dai Ngo           2020-10-18 @437  	nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl);
39c41233a1cdc4 Dai Ngo           2021-01-22  438  #endif
0cfcd405e758ba Dai Ngo           2020-10-18  439  }

6b7153da2c1a58 Christoph Hellwig 2015-11-13 440 #endif /* CONFIG_NFS_V4_2 */
bea51b30b28103 Peng Tao 2015-09-26 441

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org