ceph: take i_mutex before getting Fw cap
authorYan, Zheng <zheng.z.yan@intel.com>
Fri, 12 Apr 2013 08:11:10 +0000 (16:11 +0800)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 04:18:53 +0000 (21:18 -0700)
commit37505d5768b9389a5ef7bc1efa465d4484a5462e
tree208daa8785fe4847061a1dafee58ff32b5b861e6
parent26be88087ae8a04a5b576aa2f490597b649fc132
ceph: take i_mutex before getting Fw cap

There is deadlock as illustrated bellow. The fix is taking i_mutex
before getting Fw cap reference.

      write                    truncate                 MDS
---------------------     --------------------      --------------
get Fw cap
                          lock i_mutex
lock i_mutex (blocked)
                          request setattr.size  ->
                                                <-   revoke Fw cap

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
fs/ceph/caps.c
fs/ceph/file.c