On Wed, 9 Jan 2019 at 14:43, Mark Syms <mark.s...@citrix.com> wrote: > We don't yet know how the assert got triggered as we've only seen it once > and in the original form it looks like it would be very hard to trigger in > any normal case (given that in default usage i_blocks should be at least 8 > times what any putative value for change could be). So, for the assert to > have triggered we've been asked to remove at least 8 times the number of > blocks currently allocated to the inode. Possible causes could be a double > release or some other higher level bug that will require further > investigation to uncover. >
The following change has at least survived xfstests: --- a/fs/gfs2/inode.h +++ b/fs/gfs2/inode.h @@ -61,8 +61,8 @@ static inline u64 gfs2_get_inode_blocks(const struct inode *inode) static inline void gfs2_add_inode_blocks(struct inode *inode, s64 change) { - gfs2_assert(GFS2_SB(inode), (change >= 0 || inode->i_blocks > -change)); - change *= (GFS2_SB(inode)->sd_sb.sb_bsize/GFS2_BASIC_BLOCK); + change <<= inode->i_blkbits - 9; + gfs2_assert(GFS2_SB(inode), change >= 0 || inode->i_blocks >= -change); inode->i_blocks += change; } Andreas