2011-12-06 20:57:22

by Olga Kornievskaia

[permalink] [raw]
Subject: pnfs nfsd compile problems

Latest pnfs-all-latest (commit
58deb32bd36e92f5f44ac6d5e5ab3c36732c4ebd) doesn't compile if
CONFIG_PNFSD_BLOCK is not enabled.

1st compile error is in (and probably gcc version dependent):
CC [M] fs/nfsd/nfsctl.o
In file included from fs/nfsd/nfsctl.c:18:0:
include/linux/nfsd/nfsd4_block.h: In function ?pnfs_block_enabled?:
include/linux/nfsd/nfsd4_block.h:104:46: error: parameter name omitted
include/linux/nfsd/nfsd4_block.h:104:46: error: parameter name omitted
make[2]: *** [fs/nfsd/nfsctl.o] Error 1

Something like this fixed that problem:
diff --git a/include/linux/nfsd/nfsd4_block.h b/include/linux/nfsd/nfsd4_block.h
index 9c2941f..7d620a0 100644
--- a/include/linux/nfsd/nfsd4_block.h
+++ b/include/linux/nfsd/nfsd4_block.h
@@ -101,7 +101,7 @@ extern bl_comm_t *bl_comm_global; // Ugly...

#else

-static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
+static inline bool pnfs_block_enabled(struct inode *a, int b) { return false; }
static inline void nfsd_bl_init(void) {}

#endif /* CONFIG_PNFSD_BLOCK */

However, next is

CC [M] fs/nfsd/vfs.o
fs/nfsd/vfs.c: In function ?_nfsd_setattr?:
fs/nfsd/vfs.c:389:5: error: implicit declaration of function
?bl_layoutrecall? [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

make[2]: *** [fs/nfsd/vfs.o] Error 1

Perhaps, bl_layoutrecall() should be defined regardless if
CONFIG_PNFSD_BLOCK is defined?

So a combined patch for both is:
diff --git a/include/linux/nfsd/nfsd4_block.h b/include/linux/nfsd/nfsd4_block.h
index 9c2941f..06a33ca 100644
--- a/include/linux/nfsd/nfsd4_block.h
+++ b/include/linux/nfsd/nfsd4_block.h
@@ -101,7 +101,8 @@ extern bl_comm_t *bl_comm_global; // Ugly...

#else

-static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
+int bl_layoutrecall(struct inode *inode, int type, u64 offset, u64
len, bool with_nfs4_state_lock);
+static inline bool pnfs_block_enabled(struct inode *a, int b) { return false; }
static inline void nfsd_bl_init(void) {}

#endif /* CONFIG_PNFSD_BLOCK */

Then, the next problem is
CC [M] fs/nfsd/export.o
fs/nfsd/export.c: In function ?pnfsd_check_export?:
fs/nfsd/export.c:387:30: error: ?bl_export_ops? undeclared (first use
in this function)
fs/nfsd/export.c:387:30: note: each undeclared identifier is reported
only once for each function it appears in
make[2]: *** [fs/nfsd/export.o] Error 1

This structure is only defined if CONFIG_PNFSD_BLOCK defined...

Something like this to fix?
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 82c8194..62550dc 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -384,7 +384,9 @@ static int pnfsd_check_export(struct inode *inode, int *flag
if (pnfs_block_enabled(inode, *flags)) {
if (!inode->i_sb->s_pnfs_op) {
dprintk("set pnfs block export structure\n");
+#if defined(CONFIG_PNFSD_BLOCK)
inode->i_sb->s_pnfs_op = &bl_export_ops;
+#endif
} else
dprintk("pnfs block enabled, fs provided s_pnfs_op\n");
dprintk("pnfs block enabled, sb=%p s_pnfs_op=%p\n",


2011-12-08 00:08:09

by Olga Kornievskaia

[permalink] [raw]
Subject: Re: pnfs nfsd compile problems

On Wed, Dec 7, 2011 at 6:46 PM, Olga Kornievskaia <[email protected]> wrote:
> On Wed, Dec 7, 2011 at 9:05 AM, Benny Halevy <[email protected]> wrote:
>> On 2011-12-06 22:57, Olga Kornievskaia wrote:
>>> Latest pnfs-all-latest (commit
>>> 58deb32bd36e92f5f44ac6d5e5ab3c36732c4ebd) doesn't compile if
>>> CONFIG_PNFSD_BLOCK is not enabled.
>>>
>>> 1st compile error is in (and probably gcc version dependent):
>>> ? CC [M] ?fs/nfsd/nfsctl.o
>>> In file included from fs/nfsd/nfsctl.c:18:0:
>>> include/linux/nfsd/nfsd4_block.h: In function ?pnfs_block_enabled?:
>>> include/linux/nfsd/nfsd4_block.h:104:46: error: parameter name omitted
>>> include/linux/nfsd/nfsd4_block.h:104:46: error: parameter name omitted
>>
>> Sorry. The patch in reply to this message should fix that.
>>
>> Benny
>>
>> diff --git a/fs/nfsd/nfsd4_block.h b/fs/nfsd/nfsd4_block.h
>> index 9c2941f..4ce5755 100644
>> --- a/fs/nfsd/nfsd4_block.h
>> +++ b/fs/nfsd/nfsd4_block.h
>> @@ -100,7 +100,7 @@ int bl_layoutreturn(struct inode *,
>>
>> ?#else
>>
>> -static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
>> +static inline bool pnfs_block_enabled(struct inode *i, int ex_flags) { return false; }
>> ?static inline void nfsd_bl_init(void) {}
>>
>> ?#endif /* CONFIG_PNFSD_BLOCK */
>>
>
> Sure that fixes problem #1. 2 more to go.

Sorry, bad git pull. I see that you moved things around. I can confirm
that all compiles correctly.

2011-12-07 14:05:44

by Benny Halevy

[permalink] [raw]
Subject: Re: pnfs nfsd compile problems

On 2011-12-06 22:57, Olga Kornievskaia wrote:
> Latest pnfs-all-latest (commit
> 58deb32bd36e92f5f44ac6d5e5ab3c36732c4ebd) doesn't compile if
> CONFIG_PNFSD_BLOCK is not enabled.
>
> 1st compile error is in (and probably gcc version dependent):
> CC [M] fs/nfsd/nfsctl.o
> In file included from fs/nfsd/nfsctl.c:18:0:
> include/linux/nfsd/nfsd4_block.h: In function ?pnfs_block_enabled?:
> include/linux/nfsd/nfsd4_block.h:104:46: error: parameter name omitted
> include/linux/nfsd/nfsd4_block.h:104:46: error: parameter name omitted

Sorry. The patch in reply to this message should fix that.

Benny

diff --git a/fs/nfsd/nfsd4_block.h b/fs/nfsd/nfsd4_block.h
index 9c2941f..4ce5755 100644
--- a/fs/nfsd/nfsd4_block.h
+++ b/fs/nfsd/nfsd4_block.h
@@ -100,7 +100,7 @@ int bl_layoutreturn(struct inode *,

#else

-static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
+static inline bool pnfs_block_enabled(struct inode *i, int ex_flags) { return false; }
static inline void nfsd_bl_init(void) {}

#endif /* CONFIG_PNFSD_BLOCK */


> make[2]: *** [fs/nfsd/nfsctl.o] Error 1
>
> Something like this fixed that problem:
> diff --git a/include/linux/nfsd/nfsd4_block.h b/include/linux/nfsd/nfsd4_block.h
> index 9c2941f..7d620a0 100644
> --- a/include/linux/nfsd/nfsd4_block.h
> +++ b/include/linux/nfsd/nfsd4_block.h
> @@ -101,7 +101,7 @@ extern bl_comm_t *bl_comm_global; // Ugly...
>
> #else
>
> -static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
> +static inline bool pnfs_block_enabled(struct inode *a, int b) { return false; }
> static inline void nfsd_bl_init(void) {}
>
> #endif /* CONFIG_PNFSD_BLOCK */
>
> However, next is
>
> CC [M] fs/nfsd/vfs.o
> fs/nfsd/vfs.c: In function ?_nfsd_setattr?:
> fs/nfsd/vfs.c:389:5: error: implicit declaration of function
> ?bl_layoutrecall? [-Werror=implicit-function-declaration]
> cc1: some warnings being treated as errors
>
> make[2]: *** [fs/nfsd/vfs.o] Error 1
>
> Perhaps, bl_layoutrecall() should be defined regardless if
> CONFIG_PNFSD_BLOCK is defined?
>
> So a combined patch for both is:
> diff --git a/include/linux/nfsd/nfsd4_block.h b/include/linux/nfsd/nfsd4_block.h
> index 9c2941f..06a33ca 100644
> --- a/include/linux/nfsd/nfsd4_block.h
> +++ b/include/linux/nfsd/nfsd4_block.h
> @@ -101,7 +101,8 @@ extern bl_comm_t *bl_comm_global; // Ugly...
>
> #else
>
> -static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
> +int bl_layoutrecall(struct inode *inode, int type, u64 offset, u64
> len, bool with_nfs4_state_lock);
> +static inline bool pnfs_block_enabled(struct inode *a, int b) { return false; }
> static inline void nfsd_bl_init(void) {}
>
> #endif /* CONFIG_PNFSD_BLOCK */
>
> Then, the next problem is
> CC [M] fs/nfsd/export.o
> fs/nfsd/export.c: In function ?pnfsd_check_export?:
> fs/nfsd/export.c:387:30: error: ?bl_export_ops? undeclared (first use
> in this function)
> fs/nfsd/export.c:387:30: note: each undeclared identifier is reported
> only once for each function it appears in
> make[2]: *** [fs/nfsd/export.o] Error 1
>
> This structure is only defined if CONFIG_PNFSD_BLOCK defined...
>
> Something like this to fix?
> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
> index 82c8194..62550dc 100644
> --- a/fs/nfsd/export.c
> +++ b/fs/nfsd/export.c
> @@ -384,7 +384,9 @@ static int pnfsd_check_export(struct inode *inode, int *flag
> if (pnfs_block_enabled(inode, *flags)) {
> if (!inode->i_sb->s_pnfs_op) {
> dprintk("set pnfs block export structure\n");
> +#if defined(CONFIG_PNFSD_BLOCK)
> inode->i_sb->s_pnfs_op = &bl_export_ops;
> +#endif
> } else
> dprintk("pnfs block enabled, fs provided s_pnfs_op\n");
> dprintk("pnfs block enabled, sb=%p s_pnfs_op=%p\n",
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2011-12-07 23:46:10

by Olga Kornievskaia

[permalink] [raw]
Subject: Re: pnfs nfsd compile problems

On Wed, Dec 7, 2011 at 9:05 AM, Benny Halevy <[email protected]> wrote:
> On 2011-12-06 22:57, Olga Kornievskaia wrote:
>> Latest pnfs-all-latest (commit
>> 58deb32bd36e92f5f44ac6d5e5ab3c36732c4ebd) doesn't compile if
>> CONFIG_PNFSD_BLOCK is not enabled.
>>
>> 1st compile error is in (and probably gcc version dependent):
>> ? CC [M] ?fs/nfsd/nfsctl.o
>> In file included from fs/nfsd/nfsctl.c:18:0:
>> include/linux/nfsd/nfsd4_block.h: In function ?pnfs_block_enabled?:
>> include/linux/nfsd/nfsd4_block.h:104:46: error: parameter name omitted
>> include/linux/nfsd/nfsd4_block.h:104:46: error: parameter name omitted
>
> Sorry. The patch in reply to this message should fix that.
>
> Benny
>
> diff --git a/fs/nfsd/nfsd4_block.h b/fs/nfsd/nfsd4_block.h
> index 9c2941f..4ce5755 100644
> --- a/fs/nfsd/nfsd4_block.h
> +++ b/fs/nfsd/nfsd4_block.h
> @@ -100,7 +100,7 @@ int bl_layoutreturn(struct inode *,
>
> ?#else
>
> -static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
> +static inline bool pnfs_block_enabled(struct inode *i, int ex_flags) { return false; }
> ?static inline void nfsd_bl_init(void) {}
>
> ?#endif /* CONFIG_PNFSD_BLOCK */
>

Sure that fixes problem #1. 2 more to go.


>
>> make[2]: *** [fs/nfsd/nfsctl.o] Error 1
>>
>> Something like this fixed that problem:
>> diff --git a/include/linux/nfsd/nfsd4_block.h b/include/linux/nfsd/nfsd4_block.h
>> index 9c2941f..7d620a0 100644
>> --- a/include/linux/nfsd/nfsd4_block.h
>> +++ b/include/linux/nfsd/nfsd4_block.h
>> @@ -101,7 +101,7 @@ extern bl_comm_t ? ?*bl_comm_global; ? ? ? ?// Ugly...
>>
>> ?#else
>>
>> -static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
>> +static inline bool pnfs_block_enabled(struct inode *a, int b) { return false; }
>> ?static inline void nfsd_bl_init(void) {}
>>
>> ?#endif /* CONFIG_PNFSD_BLOCK */
>>
>> However, next is
>>
>> ? CC [M] ?fs/nfsd/vfs.o
>> fs/nfsd/vfs.c: In function ?_nfsd_setattr?:
>> fs/nfsd/vfs.c:389:5: error: implicit declaration of function
>> ?bl_layoutrecall? [-Werror=implicit-function-declaration]
>> cc1: some warnings being treated as errors
>>
>> make[2]: *** [fs/nfsd/vfs.o] Error 1
>>
>> Perhaps, bl_layoutrecall() should be defined regardless if
>> CONFIG_PNFSD_BLOCK is defined?
>>
>> So a combined patch for both is:
>> diff --git a/include/linux/nfsd/nfsd4_block.h b/include/linux/nfsd/nfsd4_block.h
>> index 9c2941f..06a33ca 100644
>> --- a/include/linux/nfsd/nfsd4_block.h
>> +++ b/include/linux/nfsd/nfsd4_block.h
>> @@ -101,7 +101,8 @@ extern bl_comm_t ? ?*bl_comm_global; ? ? ? ?// Ugly...
>>
>> ?#else
>>
>> -static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
>> +int bl_layoutrecall(struct inode *inode, int type, u64 offset, u64
>> len, bool with_nfs4_state_lock);
>> +static inline bool pnfs_block_enabled(struct inode *a, int b) { return false; }
>> ?static inline void nfsd_bl_init(void) {}
>>
>> ?#endif /* CONFIG_PNFSD_BLOCK */
>>
>> Then, the next problem is
>> ? CC [M] ?fs/nfsd/export.o
>> fs/nfsd/export.c: In function ?pnfsd_check_export?:
>> fs/nfsd/export.c:387:30: error: ?bl_export_ops? undeclared (first use
>> in this function)
>> fs/nfsd/export.c:387:30: note: each undeclared identifier is reported
>> only once for each function it appears in
>> make[2]: *** [fs/nfsd/export.o] Error 1
>>
>> This structure is only defined if CONFIG_PNFSD_BLOCK defined...
>>
>> Something like this to fix?
>> diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
>> index 82c8194..62550dc 100644
>> --- a/fs/nfsd/export.c
>> +++ b/fs/nfsd/export.c
>> @@ -384,7 +384,9 @@ static int pnfsd_check_export(struct inode *inode, int *flag
>> ? ? ? ? if (pnfs_block_enabled(inode, *flags)) {
>> ? ? ? ? ? ? ? ? if (!inode->i_sb->s_pnfs_op) {
>> ? ? ? ? ? ? ? ? ? ? ? ? dprintk("set pnfs block export structure\n");
>> +#if defined(CONFIG_PNFSD_BLOCK)
>> ? ? ? ? ? ? ? ? ? ? ? ? inode->i_sb->s_pnfs_op = &bl_export_ops;
>> +#endif
>> ? ? ? ? ? ? ? ? } else
>> ? ? ? ? ? ? ? ? ? ? ? ? dprintk("pnfs block enabled, fs provided s_pnfs_op\n");
>> ? ? ? ? ? ? ? ? dprintk("pnfs block enabled, sb=%p s_pnfs_op=%p\n",
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at ?http://vger.kernel.org/majordomo-info.html

2011-12-07 14:10:00

by Benny Halevy

[permalink] [raw]
Subject: [PATCH] SQUASHME: pnfsd-block: fix compile error when PNFSD_BLOCK in not enabled

Reported-by: Olga Kornievskaia <[email protected]>
Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfsd/export.c | 2 ++
fs/nfsd/nfs4proc.c | 10 ++++------
fs/nfsd/nfsd4_block.h | 18 ++++++++++++++++--
fs/nfsd/vfs.c | 7 +++----
4 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index a38713e..730f395 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -381,6 +381,7 @@ static int pnfsd_check_export(struct inode *inode, int *flags)
return 0;
#endif /* CONFIG_PNFSD_LOCAL_EXPORT */

+#if defined(CONFIG_PNFSD_BLOCK)
if (pnfs_block_enabled(inode, *flags)) {
if (!inode->i_sb->s_pnfs_op) {
dprintk("set pnfs block export structure\n");
@@ -392,6 +393,7 @@ static int pnfsd_check_export(struct inode *inode, int *flags)

return 0;
}
+#endif /* CONFIG_PNFSD_BLOCK */

#endif /* CONFIG_PNFSD */

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 7b5d897..aa79a45 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -904,12 +904,10 @@ static __be32 nfsd4_do_lookupp(struct svc_rqst *rqstp, struct svc_fh *fh)

nfsd4_get_verifier(cstate->current_fh.fh_dentry->d_inode->i_sb,
&write->wr_verifier);
- if (pnfs_block_enabled(cstate->current_fh.fh_dentry->d_inode, 0)) {
- status = bl_layoutrecall(cstate->current_fh.fh_dentry->d_inode,
- RETURN_FILE, write->wr_offset, write->wr_buflen, false);
- if (status)
- goto out_put;
- }
+ status = bl_recall_layout(cstate->current_fh.fh_dentry->d_inode,
+ RETURN_FILE, write->wr_offset, write->wr_buflen, false);
+ if (status)
+ goto out_put;
status = nfsd_write(rqstp, &cstate->current_fh, filp,
write->wr_offset, rqstp->rq_vec, write->wr_vlen,
&cnt, &write->wr_how_written);
diff --git a/fs/nfsd/nfsd4_block.h b/fs/nfsd/nfsd4_block.h
index 9c2941f..38387de 100644
--- a/fs/nfsd/nfsd4_block.h
+++ b/fs/nfsd/nfsd4_block.h
@@ -77,7 +77,7 @@

#ifdef CONFIG_PNFSD_BLOCK

-bool pnfs_block_enabled(struct inode *, int);
+bool pnfs_block_enabled(struct inode *, int ex_flags);
void nfsd_bl_init(void);
int bl_layout_type(struct super_block *sb);
int bl_getdeviceiter(struct super_block *, u32 layout_type,
@@ -97,13 +97,27 @@ int bl_layoutreturn(struct inode *,
int bl_init_proc(void);
int bl_upcall(bl_comm_t *, bl_comm_msg_t *, bl_comm_res_t **);

+
+static inline int
+bl_recall_layout(struct inode *inode, int type, u64 offset, u64 len, bool with_nfs4_state_lock)
+{
+ if (pnfs_block_enabled(inode, 0))
+ return bl_layoutrecall(inode, type, offset, len, with_nfs4_state_lock);
+}
+
extern bl_comm_t *bl_comm_global; // Ugly...

#else

-static inline bool pnfs_block_enabled(struct inode *, int) { return false; }
+static inline bool pnfs_block_enabled(struct inode *i, int ex_flags) { return false; }
static inline void nfsd_bl_init(void) {}

+static inline int bl_recall_layout(struct inode *inode, int type, u64 offset,
+ u64 len, bool with_nfs4_state_lock)
+{
+ return 0;
+}
+
#endif /* CONFIG_PNFSD_BLOCK */
#endif /* __KERNEL__ */

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index c4629fb..24091be 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -385,10 +385,9 @@ static int nfsd_break_lease(struct inode *inode)
if (is_inode_pnfsd_lexp(inode))
pnfsd_lexp_recall_layout(inode, with_nfs4_state_lock);
#endif /* CONFIG_PNFSD_LOCAL_EXPORT */
- if (pnfs_block_enabled(inode, 0))
- err = bl_layoutrecall(inode, RETURN_FILE,
- iap->ia_size, inode->i_size - iap->ia_size,
- with_nfs4_state_lock);
+ err = bl_recall_layout(inode, RETURN_FILE, iap->ia_size,
+ inode->i_size - iap->ia_size,
+ with_nfs4_state_lock);
}

host_err = get_write_access(inode);
--
1.7.6