• Qu Wenruo's avatar
    btrfs: scrub: reject unsupported scrub flags · 604e6681
    Qu Wenruo authored
    Since the introduction of scrub interface, the only flag that we support
    is BTRFS_SCRUB_READONLY.  Thus there is no sanity checks, if there are
    some undefined flags passed in, we just ignore them.
    
    This is problematic if we want to introduce new scrub flags, as we have
    no way to determine if such flags are supported.
    
    Address the problem by introducing a check for the flags, and if
    unsupported flags are set, return -EOPNOTSUPP to inform the user space.
    
    This check should be backported for all supported kernels before any new
    scrub flags are introduced.
    
    CC: stable@vger.kernel.org # 4.14+
    Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    604e6681
ioctl.c 115 KB