2015-02-16 11:36:22

by Daniel Thompson

[permalink] [raw]
Subject: [PATCH] nfsd: Fix v2-only build regression

Currently if nfsd is configured as v2 only then the kernel fails to build.
This is a regression introduced by 9cf514ccfacb("nfsd: implement pNFS
operations"). It occurs because inline code from the xdr4.h header is
now included from generic nfsd code (via pnfs.h).

This patch takes the simplest route and makes conditional the problematic
inline function.

Note: I also tried extending the #ifdef CONFIG_NFSD_PNFS to cover almost
all of the pnfs.h header file. That works great too but feels more
invasive. However I can dust this off if that were preferable for
any reason.

Signed-off-by: Daniel Thompson <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: J. Bruce Fields <[email protected]>
---
fs/nfsd/xdr4.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 0bda93e58e1b..960a75d921c0 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -627,6 +627,7 @@ void warn_on_nonidempotent_op(struct nfsd4_op *op);

#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)

+#ifdef CONFIG_NFSD_V3
static inline void
set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
{
@@ -642,6 +643,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;

}
+#endif

int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *,
--
1.9.3


2015-02-16 13:24:54

by Daniel Thompson

[permalink] [raw]
Subject: Re: [PATCH] nfsd: Fix v2-only build regression

On 16/02/15 11:54, Arnd Bergmann wrote:
> On Monday 16 February 2015 11:36:03 Daniel Thompson wrote:
>> Currently if nfsd is configured as v2 only then the kernel fails to build.
>> This is a regression introduced by 9cf514ccfacb("nfsd: implement pNFS
>> operations"). It occurs because inline code from the xdr4.h header is
>> now included from generic nfsd code (via pnfs.h).
>>
>> This patch takes the simplest route and makes conditional the problematic
>> inline function.
>>
>> Note: I also tried extending the #ifdef CONFIG_NFSD_PNFS to cover almost
>> all of the pnfs.h header file. That works great too but feels more
>> invasive. However I can dust this off if that were preferable for
>> any reason.
>>
>
> I believe this was fixed last Friday in the patch below. Do you still
> see the problem on today's linux-next?

Thanks Arnd. I overlooked this patch (which didn't pop out very clearly
in the google searches I did).

It is fixed in linux-next.


Daniel.

2015-02-16 11:54:24

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] nfsd: Fix v2-only build regression

On Monday 16 February 2015 11:36:03 Daniel Thompson wrote:
> Currently if nfsd is configured as v2 only then the kernel fails to build.
> This is a regression introduced by 9cf514ccfacb("nfsd: implement pNFS
> operations"). It occurs because inline code from the xdr4.h header is
> now included from generic nfsd code (via pnfs.h).
>
> This patch takes the simplest route and makes conditional the problematic
> inline function.
>
> Note: I also tried extending the #ifdef CONFIG_NFSD_PNFS to cover almost
> all of the pnfs.h header file. That works great too but feels more
> invasive. However I can dust this off if that were preferable for
> any reason.
>

I believe this was fixed last Friday in the patch below. Do you still
see the problem on today's linux-next?

Arnd

commit 3cd9ac34d50121470859bc3fe7eddbd2d498f374
Author: J. Bruce Fields <[email protected]>
Date: Fri Feb 13 12:34:25 2015 -0500

nfsd4: fix v3-less build

Includes of pnfs.h in export.c and fcntl.c also bring in xdr4.h, which
won't build without CONFIG_NFSD_V3, breaking non-V3 builds. Ifdef-out
most of pnfs.h in that case.

Reported-by: Bas Peters <[email protected]>
Reported-by: Jim Davis <[email protected]>
Fixes: 9cf514ccfac "nfsd: implement pNFS operations"
Signed-off-by: J. Bruce Fields <[email protected]>

diff --git a/fs/nfsd/pnfs.h b/fs/nfsd/pnfs.h
index fedb4d620a81..d4c4453674c6 100644
--- a/fs/nfsd/pnfs.h
+++ b/fs/nfsd/pnfs.h
@@ -1,6 +1,7 @@
#ifndef _FS_NFSD_PNFS_H
#define _FS_NFSD_PNFS_H 1

+#ifdef CONFIG_NFSD_V4
#include <linux/exportfs.h>
#include <linux/nfsd/export.h>

@@ -50,6 +51,7 @@ __be32 nfsd4_return_client_layouts(struct svc_rqst *rqstp,
int nfsd4_set_deviceid(struct nfsd4_deviceid *id, const struct svc_fh *fhp,
u32 device_generation);
struct nfsd4_deviceid_map *nfsd4_find_devid_map(int idx);
+#endif /* CONFIG_NFSD_V4 */

#ifdef CONFIG_NFSD_PNFS
void nfsd4_setup_layout_type(struct svc_export *exp);
@@ -59,6 +61,9 @@ void nfsd4_return_all_file_layouts(struct nfs4_client *clp,
int nfsd4_init_pnfs(void);
void nfsd4_exit_pnfs(void);
#else
+struct nfs4_client;
+struct nfs4_file;
+
static inline void nfsd4_setup_layout_type(struct svc_export *exp)
{
}