diff options
author | Sage Weil <sage@newdream.net> | 2010-06-24 18:12:37 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-06-29 12:31:55 -0400 |
commit | ec97f88ba6d4256927fde516033ee76d5d85b54a (patch) | |
tree | 0df9cb10364afdb9092a089ba0da4a15f3c25a06 /fs | |
parent | a1a31e734241aefcb2b30fb0cc0376977b6d2ba8 (diff) |
ceph: only release clean, unused caps with mds requests
We can drop caps with an mds request. Ensure we only drop unused AND
clean caps, since the MDS doesn't support cap writeback in that context,
nor do we track it. If caps are dirty, and the MDS needs them back, we
it will revoke and we will flush in the normal fashion.
This fixes a possibly loss of metadata.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/caps.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 619b61655ee5..d4fcdda7676c 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2886,18 +2886,19 @@ int ceph_encode_inode_release(void **p, struct inode *inode, | |||
2886 | struct ceph_inode_info *ci = ceph_inode(inode); | 2886 | struct ceph_inode_info *ci = ceph_inode(inode); |
2887 | struct ceph_cap *cap; | 2887 | struct ceph_cap *cap; |
2888 | struct ceph_mds_request_release *rel = *p; | 2888 | struct ceph_mds_request_release *rel = *p; |
2889 | int used, dirty; | ||
2889 | int ret = 0; | 2890 | int ret = 0; |
2890 | int used = 0; | ||
2891 | 2891 | ||
2892 | spin_lock(&inode->i_lock); | 2892 | spin_lock(&inode->i_lock); |
2893 | used = __ceph_caps_used(ci); | 2893 | used = __ceph_caps_used(ci); |
2894 | dirty = __ceph_caps_dirty(ci); | ||
2894 | 2895 | ||
2895 | dout("encode_inode_release %p mds%d used %s drop %s unless %s\n", inode, | 2896 | dout("encode_inode_release %p mds%d used|dirty %s drop %s unless %s\n", |
2896 | mds, ceph_cap_string(used), ceph_cap_string(drop), | 2897 | inode, mds, ceph_cap_string(used|dirty), ceph_cap_string(drop), |
2897 | ceph_cap_string(unless)); | 2898 | ceph_cap_string(unless)); |
2898 | 2899 | ||
2899 | /* only drop unused caps */ | 2900 | /* only drop unused, clean caps */ |
2900 | drop &= ~used; | 2901 | drop &= ~(used | dirty); |
2901 | 2902 | ||
2902 | cap = __get_cap_for_mds(ci, mds); | 2903 | cap = __get_cap_for_mds(ci, mds); |
2903 | if (cap && __cap_is_valid(cap)) { | 2904 | if (cap && __cap_is_valid(cap)) { |