diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-07-02 00:40:20 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-03 18:32:57 -0400 |
commit | b1530f57042297f85330a140a6921b6f95fe74d3 (patch) | |
tree | 0af45d94a71bd69d59aa0d2399a5c06623d9170c /fs/ceph | |
parent | b415bf4f9fe25f39934f5c464125e4a2dffb6d08 (diff) |
ceph: fix cap revoke race
If caps are been revoking by the auth MDS, don't consider them as
issued even they are still issued by non-auth MDS. The non-auth
MDS should also be revoking/exporting these caps, the client just
hasn't received the cap revoke/export message.
The race I encountered is: When caps are exporting to new MDS, the
client receives cap import message and cap revoke message from the
new MDS, then receives cap export message from the old MDS. When
the client receives cap revoke message from the new MDS, the revoking
caps are still issued by the old MDS, so the client does nothing.
Later when the cap export message is received, the client removes
the caps issued by the old MDS. (Another way to fix the race is
calling ceph_check_caps() in handle_cap_export())
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/caps.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 16266f3e9a33..7045a8dfaad4 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -690,6 +690,15 @@ int __ceph_caps_issued(struct ceph_inode_info *ci, int *implemented) | |||
690 | if (implemented) | 690 | if (implemented) |
691 | *implemented |= cap->implemented; | 691 | *implemented |= cap->implemented; |
692 | } | 692 | } |
693 | /* | ||
694 | * exclude caps issued by non-auth MDS, but are been revoking | ||
695 | * by the auth MDS. The non-auth MDS should be revoking/exporting | ||
696 | * these caps, but the message is delayed. | ||
697 | */ | ||
698 | if (ci->i_auth_cap) { | ||
699 | cap = ci->i_auth_cap; | ||
700 | have &= ~cap->implemented | cap->issued; | ||
701 | } | ||
693 | return have; | 702 | return have; |
694 | } | 703 | } |
695 | 704 | ||