On Wed, Oct 09, 2024 at 05:53:40PM GMT, Dan Carpenter wrote:
> Hello Kent Overstreet,
>
> Commit 6375feaa7a3b ("bcachefs:
> bcachefs_metadata_version_inode_has_child_snapshots") from Sep 29,
> 2024 (linux-next), leads to the following Smatch static checker
> warning:
>
> fs/bcachefs/fsck.c:1183 check_inode()
> warn: should this be a bitwise negate mask?
>
> fs/bcachefs/fsck.c
> 1168
> 1169 ret = bch2_inode_has_child_snapshots(trans, k.k->p);
> 1170 if (ret < 0)
> 1171 goto err;
> 1172
> 1173 if (fsck_err_on(ret != !!(u.bi_flags &
> BCH_INODE_has_child_snapshot),
> 1174 trans, inode_has_child_snapshots_wrong,
> 1175 "inode has_child_snapshots flag wrong
> (should be %u)\n%s",
> 1176 ret,
> 1177 (printbuf_reset(&buf),
> 1178 bch2_inode_unpacked_to_text(&buf, &u),
> 1179 buf.buf))) {
> 1180 if (ret)
> 1181 u.bi_flags |= BCH_INODE_has_child_snapshot;
> 1182 else
> --> 1183 u.bi_flags &= !BCH_INODE_has_child_snapshot;
>
> This was intended to be u.bi_flags &= ~BCH_INODE_has_child_snapshot otherwise
> it's the same as "u.bi_flags = 0;"
Thanks, fixed