On Thu 19-08-21 14:57:03, Zhang Yi wrote: > In ext4_inode_blocks_set(), huge_file feature should exist when setting > i_blocks beyond a 32 bit variable could be represented, return EFBIG if > not. This error should never happen in theory since sb->s_maxbytes should > not have allowed this, and we have already init sb->s_maxbytes according > to this feature in ext4_fill_super(). So switch to use WARN_ON_ONCE > instead. > > Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx> > --- One comment below: > @@ -4918,10 +4918,15 @@ static int ext4_inode_blocks_set(handle_t *handle, > raw_inode->i_blocks_lo = cpu_to_le32(i_blocks); > raw_inode->i_blocks_high = 0; > ext4_clear_inode_flag(inode, EXT4_INODE_HUGE_FILE); > - return 0; > + return; > } > - if (!ext4_has_feature_huge_file(sb)) > - return -EFBIG; > + > + /* > + * This should never happen since sb->s_maxbytes should not have > + * allowed this, which was set according to the huge_file feature > + * in ext4_fill_super(). > + */ > + WARN_ON_ONCE(!ext4_has_feature_huge_file(sb)); Thinking about this a bit more, this could also happen due to fs corruption. So we probably need to call ext4_error_inode() here instead of WARN_ON_ONCE(). Also it will result in properly marking fs as having errors. But since we hold i_raw_lock at this call site we need to keep the error bail out from ext4_inode_blocks_set() and in ext4_do_update_inode() finish updating inode and then call ext4_error_inode() after dropping i_raw_lock. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR