]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: fix pending vmtruncate race
authorYan, Zheng <zheng.z.yan@intel.com>
Tue, 2 Jul 2013 04:40:19 +0000 (12:40 +0800)
committerSage Weil <sage@inktank.com>
Wed, 3 Jul 2013 22:32:56 +0000 (15:32 -0700)
commite629c7ae391000ca9f57d9c11fdac3546db5d5b9
treef38df9c1746a1419e7942afb4534625175a5d353
parentff64921a17943b4e53fc126f2417ea9606f29e4a
ceph: fix pending vmtruncate race

The locking order for pending vmtruncate is wrong, it can lead to
following race:

        write                  wmtruncate work
------------------------    ----------------------
lock i_mutex
check i_truncate_pending   check i_truncate_pending
truncate_inode_pages()     lock i_mutex (blocked)
copy data to page cache
unlock i_mutex
                           truncate_inode_pages()

The fix is take i_mutex before calling __ceph_do_pending_vmtruncate()

Fixes: http://tracker.ceph.com/issues/5453
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Sage Weil <sage@inktank.com>
fs/ceph/caps.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/super.h