aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2013-11-22 00:56:24 -0500
committerYan, Zheng <zheng.z.yan@intel.com>2014-01-21 00:29:32 -0500
commit979abfdd5c7ca4abe3f0157a6ea9bfef41114c89 (patch)
treeae9320e0a88a3e393954f560033a7d0f429b3b85 /fs/ceph/mds_client.c
parent9563f88c1fa01341d125e396edc654a8dbcab2d2 (diff)
ceph: fix trim caps
- don't trim auth cap if there are flusing caps - don't trim auth cap if any 'write' cap is wanted - allow trimming non-auth cap even if the inode is dirty Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r--fs/ceph/mds_client.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 4a13f6e72069..73c79431cbff 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1214,7 +1214,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)
1214{ 1214{
1215 struct ceph_mds_session *session = arg; 1215 struct ceph_mds_session *session = arg;
1216 struct ceph_inode_info *ci = ceph_inode(inode); 1216 struct ceph_inode_info *ci = ceph_inode(inode);
1217 int used, oissued, mine; 1217 int used, wanted, oissued, mine;
1218 1218
1219 if (session->s_trim_caps <= 0) 1219 if (session->s_trim_caps <= 0)
1220 return -1; 1220 return -1;
@@ -1222,14 +1222,19 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)
1222 spin_lock(&ci->i_ceph_lock); 1222 spin_lock(&ci->i_ceph_lock);
1223 mine = cap->issued | cap->implemented; 1223 mine = cap->issued | cap->implemented;
1224 used = __ceph_caps_used(ci); 1224 used = __ceph_caps_used(ci);
1225 wanted = __ceph_caps_file_wanted(ci);
1225 oissued = __ceph_caps_issued_other(ci, cap); 1226 oissued = __ceph_caps_issued_other(ci, cap);
1226 1227
1227 dout("trim_caps_cb %p cap %p mine %s oissued %s used %s\n", 1228 dout("trim_caps_cb %p cap %p mine %s oissued %s used %s wanted %s\n",
1228 inode, cap, ceph_cap_string(mine), ceph_cap_string(oissued), 1229 inode, cap, ceph_cap_string(mine), ceph_cap_string(oissued),
1229 ceph_cap_string(used)); 1230 ceph_cap_string(used), ceph_cap_string(wanted));
1230 if (ci->i_dirty_caps) 1231 if (cap == ci->i_auth_cap) {
1231 goto out; /* dirty caps */ 1232 if (ci->i_dirty_caps | ci->i_flushing_caps)
1232 if ((used & ~oissued) & mine) 1233 goto out;
1234 if ((used | wanted) & CEPH_CAP_ANY_WR)
1235 goto out;
1236 }
1237 if ((used | wanted) & ~oissued & mine)
1233 goto out; /* we need these caps */ 1238 goto out; /* we need these caps */
1234 1239
1235 session->s_trim_caps--; 1240 session->s_trim_caps--;