• C
    f2fs: fix lock dependency in between dio_rwsem & i_mmap_sem · 21020812
    Chao Yu 提交于
    test/generic/208 reports a potential deadlock as below:
    
    Chain exists of:
      &mm->mmap_sem --> &fi->i_mmap_sem --> &fi->dio_rwsem[WRITE]
    
     Possible unsafe locking scenario:
    
           CPU0                    CPU1
           ----                    ----
      lock(&fi->dio_rwsem[WRITE]);
                                   lock(&fi->i_mmap_sem);
                                   lock(&fi->dio_rwsem[WRITE]);
      lock(&mm->mmap_sem);
    
    This patch changes the lock dependency as below in fallocate() to
    fix this issue:
    - dio_rwsem
     - i_mmap_sem
    
    Fixes: bb06664a ("f2fs: avoid race in between GC and block exchange")
    Signed-off-by: NChao Yu <yuchao0@huawei.com>
    Signed-off-by: NJaegeuk Kim <jaegeuk@kernel.org>
    21020812
file.c 65.9 KB