• Jan Kara's avatar
    dax: Fix xarray entry association for mixed mappings · 1571c029
    Jan Kara authored
    When inserting entry into xarray, we store mapping and index in
    corresponding struct pages for memory error handling. When it happened
    that one process was mapping file at PMD granularity while another
    process at PTE granularity, we could wrongly deassociate PMD range and
    then reassociate PTE range leaving the rest of struct pages in PMD range
    without mapping information which could later cause missed notifications
    about memory errors. Fix the problem by calling the association /
    deassociation code if and only if we are really going to update the
    xarray (deassociating and associating zero or empty entries is just
    no-op so there's no reason to complicate the code with trying to avoid
    the calls for these cases).
    
    Cc: <stable@vger.kernel.org>
    Fixes: d2c997c0 ("fs, dax: use page->mapping to warn if truncate...")
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    1571c029
dax.c 45.9 KB