Skip to content
  • Jan Kara's avatar
    ext4: fix trimming starting with block 0 with small blocksize · 0f0a25bf
    Jan Kara authored
    
    
    When s_first_data_block is not zero (which happens e.g. when block size is 1KB)
    and trim ioctl is called to start trimming from block 0, the math in
    ext4_get_group_no_and_offset() overflows. The overall result is that ioctl
    returns EINVAL which is kind of unexpected and we probably don't want
    userspace tools to bother with internal details of filesystem structure.
    So just silently increase starting offset (and shorten length) when starting
    block is below s_first_data_block.
    
    CC: Lukas Czerner <lczerner@redhat.com>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    0f0a25bf