Skip to content

Commit

Permalink
SUNRPC/NFS: Add Kbuild dependencies for NFS_DEBUG/RPC_DEBUG
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Mar 20, 2012
1 parent 3b3be88 commit e27d359
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 13 deletions.
6 changes: 6 additions & 0 deletions fs/nfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,9 @@ config NFS_USE_KERNEL_DNS
depends on NFS_V4 && !NFS_USE_LEGACY_DNS
select DNS_RESOLVER
default y

config NFS_DEBUG
bool
depends on NFS_FS && SUNRPC_DEBUG
select CRC32
default y
2 changes: 1 addition & 1 deletion fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ struct nfs_fh *nfs_alloc_fhandle(void)
return fh;
}

#ifdef RPC_DEBUG
#ifdef NFS_DEBUG
/*
* _nfs_display_fhandle_hash - calculate the crc32 hash for the filehandle
* in the same way that wireshark does
Expand Down
2 changes: 1 addition & 1 deletion fs/nfs/mount_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/nfs_fs.h>
#include "internal.h"

#ifdef RPC_DEBUG
#ifdef NFS_DEBUG
# define NFSDBG_FACILITY NFSDBG_MOUNT
#endif

Expand Down
2 changes: 1 addition & 1 deletion fs/nfs/nfsroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static char nfs_export_path[NFS_MAXPATHLEN + 1] __initdata = "";
/* server:export path string passed to super.c */
static char nfs_root_device[NFS_MAXPATHLEN + 1] __initdata = "";

#ifdef RPC_DEBUG
#ifdef NFS_DEBUG
/*
* When the "nfsrootdebug" kernel command line option is specified,
* enable debugging messages for NFSROOT.
Expand Down
17 changes: 8 additions & 9 deletions include/linux/nfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@

#ifdef __KERNEL__

/*
* Enable dprintk() debugging support for nfs client.
*/
#ifdef CONFIG_NFS_DEBUG
# define NFS_DEBUG
#endif

#include <linux/in.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
Expand Down Expand Up @@ -391,7 +398,7 @@ static inline void nfs_free_fhandle(const struct nfs_fh *fh)
kfree(fh);
}

#ifdef RPC_DEBUG
#ifdef NFS_DEBUG
extern u32 _nfs_display_fhandle_hash(const struct nfs_fh *fh);
static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
{
Expand Down Expand Up @@ -650,14 +657,6 @@ nfs_fileid_to_ino_t(u64 fileid)

#ifdef __KERNEL__

/*
* Enable debugging support for nfs client.
* Requires RPC_DEBUG.
*/
#ifdef RPC_DEBUG
# define NFS_DEBUG
#endif

# undef ifdebug
# ifdef NFS_DEBUG
# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac))
Expand Down
2 changes: 1 addition & 1 deletion include/linux/sunrpc/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/*
* Enable RPC debugging/profiling.
*/
#ifdef CONFIG_SYSCTL
#ifdef CONFIG_SUNRPC_DEBUG
#define RPC_DEBUG
#endif
#ifdef CONFIG_TRACEPOINTS
Expand Down
13 changes: 13 additions & 0 deletions net/sunrpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,16 @@ config RPCSEC_GSS_KRB5
Kerberos support should be installed.

If unsure, say Y.

config SUNRPC_DEBUG
bool "RPC: Enable dprintk debugging"
depends on SUNRPC && SYSCTL
help
This option enables a sysctl-based debugging interface
that is be used by the 'rpcdebug' utility to turn on or off
logging of different aspects of the kernel RPC activity.

Disabling this option will make your kernel slightly smaller,
but makes troubleshooting NFS issues significantly harder.

If unsure, say Y.

0 comments on commit e27d359

Please sign in to comment.