Re: [BUILD FAILURE] nfs4state.c fails to compile with gcc 4.5.4

From: Linus Torvalds
Date: Wed Nov 29 2017 - 22:44:41 EST


On Wed, Nov 29, 2017 at 7:39 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Yeah, I'm the world expert at working around this gcc bug but the nfs4
> one had me stumped when I looked at it, so I shelved it for revisiting
> later.

Does the attached patch fix it? I don't have old compilers.

Linus
fs/nfs/nfs4state.c | 3 +--
include/linux/nfs4.h | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 54fd56d715a8..9db5d0d57fcb 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -71,8 +71,7 @@ const nfs4_stateid zero_stateid = {
};
const nfs4_stateid invalid_stateid = {
{
- .seqid = cpu_to_be32(0xffffffffU),
- .other = { 0 },
+ { .seqid = cpu_to_be32(0xffffffffU), .other = { 0 }, },
},
.type = NFS4_INVALID_STATEID_TYPE,
};
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 47adac640191..e394ba0cd6c5 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -53,11 +53,11 @@ typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;

struct nfs4_stateid_struct {
union {
- char data[NFS4_STATEID_SIZE];
struct {
__be32 seqid;
char other[NFS4_STATEID_OTHER_SIZE];
} __attribute__ ((packed));
+ char data[NFS4_STATEID_SIZE];
};

enum {