• J
    ceph: Fix race between hole punch and page fault · 057ba5b2
    Jan Kara 提交于
    Ceph has a following race between hole punching and page fault:
    
    CPU1                                  CPU2
    ceph_fallocate()
      ...
      ceph_zero_pagecache_range()
                                          ceph_filemap_fault()
                                            faults in page in the range being
                                            punched
      ceph_zero_objects()
    
    And now we have a page in punched range with invalid data. Fix the
    problem by using mapping->invalidate_lock similarly to other
    filesystems. Note that using invalidate_lock also fixes a similar race
    wrt ->readpage().
    
    CC: Jeff Layton <jlayton@kernel.org>
    CC: ceph-devel@vger.kernel.org
    Reviewed-by: NJeff Layton <jlayton@kernel.org>
    Signed-off-by: NJan Kara <jack@suse.cz>
    057ba5b2
addr.c 53.2 KB