Skip to content

Commit e27d359

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
SUNRPC/NFS: Add Kbuild dependencies for NFS_DEBUG/RPC_DEBUG
This allows us to turn on/off the dprintk() debugging interfaces for those distributions that don't ship the 'rpcdebug' utility. It also allows us to add Kbuild dependencies. Specifically, we already know that dprintk() in general relies on CONFIG_SYSCTL. Now it turns out that the NFS dprintks depend on CONFIG_CRC32 after we added support for the filehandle hash. Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 3b3be88 commit e27d359

7 files changed

Lines changed: 31 additions & 13 deletions

File tree

‎fs/nfs/Kconfig‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,9 @@ config NFS_USE_KERNEL_DNS
144144
depends on NFS_V4 && !NFS_USE_LEGACY_DNS
145145
select DNS_RESOLVER
146146
default y
147+
148+
config NFS_DEBUG
149+
bool
150+
depends on NFS_FS && SUNRPC_DEBUG
151+
select CRC32
152+
default y

‎fs/nfs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ struct nfs_fh *nfs_alloc_fhandle(void)
10471047
return fh;
10481048
}
10491049

1050-
#ifdef RPC_DEBUG
1050+
#ifdef NFS_DEBUG
10511051
/*
10521052
* _nfs_display_fhandle_hash - calculate the crc32 hash for the filehandle
10531053
* in the same way that wireshark does

‎fs/nfs/mount_clnt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <linux/nfs_fs.h>
1717
#include "internal.h"
1818

19-
#ifdef RPC_DEBUG
19+
#ifdef NFS_DEBUG
2020
# define NFSDBG_FACILITY NFSDBG_MOUNT
2121
#endif
2222

‎fs/nfs/nfsroot.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static char nfs_export_path[NFS_MAXPATHLEN + 1] __initdata = "";
104104
/* server:export path string passed to super.c */
105105
static char nfs_root_device[NFS_MAXPATHLEN + 1] __initdata = "";
106106

107-
#ifdef RPC_DEBUG
107+
#ifdef NFS_DEBUG
108108
/*
109109
* When the "nfsrootdebug" kernel command line option is specified,
110110
* enable debugging messages for NFSROOT.

‎include/linux/nfs_fs.h‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@
3838

3939
#ifdef __KERNEL__
4040

41+
/*
42+
* Enable dprintk() debugging support for nfs client.
43+
*/
44+
#ifdef CONFIG_NFS_DEBUG
45+
# define NFS_DEBUG
46+
#endif
47+
4148
#include <linux/in.h>
4249
#include <linux/mm.h>
4350
#include <linux/pagemap.h>
@@ -391,7 +398,7 @@ static inline void nfs_free_fhandle(const struct nfs_fh *fh)
391398
kfree(fh);
392399
}
393400

394-
#ifdef RPC_DEBUG
401+
#ifdef NFS_DEBUG
395402
extern u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh);
396403
static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
397404
{
@@ -650,14 +657,6 @@ nfs_fileid_to_ino_t(u64 fileid)
650657

651658
#ifdef __KERNEL__
652659

653-
/*
654-
* Enable debugging support for nfs client.
655-
* Requires RPC_DEBUG.
656-
*/
657-
#ifdef RPC_DEBUG
658-
# define NFS_DEBUG
659-
#endif
660-
661660
# undef ifdebug
662661
# ifdef NFS_DEBUG
663662
# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac))

‎include/linux/sunrpc/debug.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/*
3232
* Enable RPC debugging/profiling.
3333
*/
34-
#ifdef CONFIG_SYSCTL
34+
#ifdef CONFIG_SUNRPC_DEBUG
3535
#define RPC_DEBUG
3636
#endif
3737
#ifdef CONFIG_TRACEPOINTS

‎net/sunrpc/Kconfig‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,16 @@ config RPCSEC_GSS_KRB5
3939
Kerberos support should be installed.
4040

4141
If unsure, say Y.
42+
43+
config SUNRPC_DEBUG
44+
bool "RPC: Enable dprintk debugging"
45+
depends on SUNRPC && SYSCTL
46+
help
47+
This option enables a sysctl-based debugging interface
48+
that is be used by the 'rpcdebug' utility to turn on or off
49+
logging of different aspects of the kernel RPC activity.
50+
51+
Disabling this option will make your kernel slightly smaller,
52+
but makes troubleshooting NFS issues significantly harder.
53+
54+
If unsure, say Y.

0 commit comments

Comments
 (0)