Re: [GIT PULL] bcachefs for v6.7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "Kent" == Kent Overstreet <kent.overstreet@xxxxxxxxx> writes:

> On Tue, Oct 31, 2023 at 05:48:39PM -0400, John Stoffel wrote:
>> 
>> Using latest HEAD from linux git (commit
>> 5a6a09e97199d6600d31383055f9d43fbbcbe86f (HEAD -> master,
>> origin/master, origin/HEAD), and the following config, I get this
>> failure when compiling on x86_64 Debian Bullseye (11):
>> 
>> 
>> CC      fs/bcachefs/btree_io.o
>> In file included from fs/bcachefs/btree_io.c:11:
>> fs/bcachefs/btree_io.c: In function ‘bch2_btree_post_write_cleanup’:
>> fs/bcachefs/btree_update_interior.h:274:36: error: array subscript 0 is outside the bounds of an interior zero-length array ‘struct bkey_packed[0]’ [-Werror=zero-length-bounds]
>> 274 |   __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]);
>> |                                    ^~~~~~~~~~~~~~~~~~~
>> In file included from fs/bcachefs/bcachefs.h:206,
>> from fs/bcachefs/btree_io.c:3:
>> fs/bcachefs/bcachefs_format.h:2344:21: note: while referencing ‘start’
>> 2344 |  struct bkey_packed start[0];
>> |                     ^~~~~
>> In file included from fs/bcachefs/btree_io.c:11:
>> fs/bcachefs/btree_io.c: In function ‘bch2_btree_init_next’:
>> fs/bcachefs/btree_update_interior.h:274:36: error: array subscript 0 is outside the bounds of an interior zero-length array ‘struct bkey_packed[0]’ [-Werror=zero-length-bounds]
>> 274 |   __bch_btree_u64s_remaining(c, b, &bne->keys.start[0]);
>> |                                    ^~~~~~~~~~~~~~~~~~~
>> In file included from fs/bcachefs/bcachefs.h:206,
>> from fs/bcachefs/btree_io.c:3:
>> fs/bcachefs/bcachefs_format.h:2344:21: note: while referencing ‘start’
>> 2344 |  struct bkey_packed start[0];
>> |                     ^~~~~
>> cc1: all warnings being treated as errors
>> make[4]: *** [scripts/Makefile.build:243: fs/bcachefs/btree_io.o] Error 1
>> make[3]: *** [scripts/Makefile.build:480: fs/bcachefs] Error 2
>> make[2]: *** [scripts/Makefile.build:480: fs] Error 2
>> make[1]: *** [/local/src/kernel/git/linux/Makefile:1913: .] Error 2
>> make: *** [Makefile:234: __sub-make] Error 2

> It seems gcc 10 complains in situations gcc 11 does not.

> I've got the following patch running through my testing automation now:

> -- >8 --
> From: Kent Overstreet <kent.overstreet@xxxxxxxxx>
> Date: Tue, 31 Oct 2023 18:05:22 -0400
> Subject: [PATCH] bcachefs: Fix build errors with gcc 10

> gcc 10 seems to complain about array bounds in situations where gcc 11
> does not - curious.

> This unfortunately requires adding some casts for now; we may
> investigate getting rid of our __u64 _data[] VLA in a future patch so
> that our start[0] members can be VLAs.

> Reported-by: John Stoffel <john@xxxxxxxxxxx>
> Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>

> diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
> index 29b000c6b7e1..5b44598b9df9 100644
> --- a/fs/bcachefs/bcachefs_format.h
> +++ b/fs/bcachefs/bcachefs_format.h
> @@ -1617,9 +1617,7 @@ struct journal_seq_blacklist_entry {
 
>  struct bch_sb_field_journal_seq_blacklist {
>  	struct bch_sb_field	field;
> -
> -	struct journal_seq_blacklist_entry start[0];
> -	__u64			_data[];
> +	struct journal_seq_blacklist_entry start[];
>  };
 
>  struct bch_sb_field_errors {
> diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c
> index 8140b6e6e9a6..32693f7c6221 100644
> --- a/fs/bcachefs/btree_trans_commit.c
> +++ b/fs/bcachefs/btree_trans_commit.c
> @@ -681,7 +681,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
>  						       BCH_JSET_ENTRY_overwrite,
i-> btree_id, i->level,
i-> old_k.u64s);
> -				bkey_reassemble(&entry->start[0],
> +				bkey_reassemble((struct bkey_i *) entry->start,
>  						(struct bkey_s_c) { &i->old_k, i->old_v });
>  			}
 
> @@ -689,7 +689,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
>  					       BCH_JSET_ENTRY_btree_keys,
i-> btree_id, i->level,
i-> k->k.u64s);
> -			bkey_copy(&entry->start[0], i->k);
> +			bkey_copy((struct bkey_i *) entry->start, i->k);
>  		}
 
>  		trans_for_each_wb_update(trans, wb) {
> @@ -697,7 +697,7 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
>  					       BCH_JSET_ENTRY_btree_keys,
wb-> btree, 0,
wb-> k.k.u64s);
> -			bkey_copy(&entry->start[0], &wb->k);
> +			bkey_copy((struct bkey_i *) entry->start, &wb->k);
>  		}
 
>  		if (trans->journal_seq)
> diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
> index d029e0348c91..89ada89eafe7 100644
> --- a/fs/bcachefs/btree_update_interior.c
> +++ b/fs/bcachefs/btree_update_interior.c
> @@ -2411,7 +2411,7 @@ void bch2_journal_entry_to_btree_root(struct bch_fs *c, struct jset_entry *entry
 
r-> level = entry->level;
r-> alive = true;
> -	bkey_copy(&r->key, &entry->start[0]);
> +	bkey_copy(&r->key, (struct bkey_i *) entry->start);
 
>  	mutex_unlock(&c->btree_root_lock);
>  }
> diff --git a/fs/bcachefs/btree_update_interior.h b/fs/bcachefs/btree_update_interior.h
> index 5e0a467fe905..d92b3cf5f5e0 100644
> --- a/fs/bcachefs/btree_update_interior.h
> +++ b/fs/bcachefs/btree_update_interior.h
> @@ -271,7 +271,7 @@ static inline struct btree_node_entry *want_new_bset(struct bch_fs *c,
>  	struct btree_node_entry *bne = max(write_block(b),
>  			(void *) btree_bkey_last(b, bset_tree_last(b)));
>  	ssize_t remaining_space =
> -		__bch_btree_u64s_remaining(c, b, &bne->keys.start[0]);
> +		__bch_btree_u64s_remaining(c, b, bne->keys.start);
 
>  	if (unlikely(bset_written(b, bset(b, t)))) {
>  		if (remaining_space > (ssize_t) (block_bytes(c) >> 3))
> diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
> index f73338f37bf1..9600b8083175 100644
> --- a/fs/bcachefs/recovery.c
> +++ b/fs/bcachefs/recovery.c
> @@ -226,7 +226,7 @@ static int journal_replay_entry_early(struct bch_fs *c,
 
>  		if (entry->u64s) {
r-> level = entry->level;
> -			bkey_copy(&r->key, &entry->start[0]);
> +			bkey_copy(&r->key, (struct bkey_i *) entry->start);
r-> error = 0;
>  		} else {
r-> error = -EIO;


So this fixes the compile error, thanks!  Sorry for not reporting the
gcc version better.  And it also compiles nicely when I remove all the
BACHEFS .config entries, accept all the defaults from 'make oldconfig'
and re-compile.

Cheers,
John





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux