ceph: avoid calling ceph_renew_caps() infinitely
__ceph_caps_mds_wanted() ignores caps from stale session. So the return value of __ceph_caps_mds_wanted() can keep the same across ceph_renew_caps(). This causes try_get_cap_refs() to keep calling ceph_renew_caps(). The fix is ignore the session valid check for the try_get_cap_refs() case. If session is stale, just let the caps requester sleep. Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
parent
00f06cba53
commit
c1944fedd8
|
@ -867,7 +867,7 @@ int __ceph_caps_file_wanted(struct ceph_inode_info *ci)
|
||||||
/*
|
/*
|
||||||
* Return caps we have registered with the MDS(s) as 'wanted'.
|
* Return caps we have registered with the MDS(s) as 'wanted'.
|
||||||
*/
|
*/
|
||||||
int __ceph_caps_mds_wanted(struct ceph_inode_info *ci)
|
int __ceph_caps_mds_wanted(struct ceph_inode_info *ci, bool check)
|
||||||
{
|
{
|
||||||
struct ceph_cap *cap;
|
struct ceph_cap *cap;
|
||||||
struct rb_node *p;
|
struct rb_node *p;
|
||||||
|
@ -875,7 +875,7 @@ int __ceph_caps_mds_wanted(struct ceph_inode_info *ci)
|
||||||
|
|
||||||
for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) {
|
for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) {
|
||||||
cap = rb_entry(p, struct ceph_cap, ci_node);
|
cap = rb_entry(p, struct ceph_cap, ci_node);
|
||||||
if (!__cap_is_valid(cap))
|
if (check && !__cap_is_valid(cap))
|
||||||
continue;
|
continue;
|
||||||
if (cap == ci->i_auth_cap)
|
if (cap == ci->i_auth_cap)
|
||||||
mds_wanted |= cap->mds_wanted;
|
mds_wanted |= cap->mds_wanted;
|
||||||
|
@ -2491,7 +2491,7 @@ again:
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
mds_wanted = __ceph_caps_mds_wanted(ci);
|
mds_wanted = __ceph_caps_mds_wanted(ci, false);
|
||||||
if (need & ~(mds_wanted & need)) {
|
if (need & ~(mds_wanted & need)) {
|
||||||
dout("get_cap_refs %p caps were dropped"
|
dout("get_cap_refs %p caps were dropped"
|
||||||
" (session killed?)\n", inode);
|
" (session killed?)\n", inode);
|
||||||
|
|
|
@ -283,7 +283,7 @@ int ceph_open(struct inode *inode, struct file *file)
|
||||||
spin_lock(&ci->i_ceph_lock);
|
spin_lock(&ci->i_ceph_lock);
|
||||||
if (__ceph_is_any_real_caps(ci) &&
|
if (__ceph_is_any_real_caps(ci) &&
|
||||||
(((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) {
|
(((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) {
|
||||||
int mds_wanted = __ceph_caps_mds_wanted(ci);
|
int mds_wanted = __ceph_caps_mds_wanted(ci, true);
|
||||||
int issued = __ceph_caps_issued(ci, NULL);
|
int issued = __ceph_caps_issued(ci, NULL);
|
||||||
|
|
||||||
dout("open %p fmode %d want %s issued %s using existing\n",
|
dout("open %p fmode %d want %s issued %s using existing\n",
|
||||||
|
|
|
@ -602,7 +602,7 @@ static inline int __ceph_caps_wanted(struct ceph_inode_info *ci)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* what the mds thinks we want */
|
/* what the mds thinks we want */
|
||||||
extern int __ceph_caps_mds_wanted(struct ceph_inode_info *ci);
|
extern int __ceph_caps_mds_wanted(struct ceph_inode_info *ci, bool check);
|
||||||
|
|
||||||
extern void ceph_caps_init(struct ceph_mds_client *mdsc);
|
extern void ceph_caps_init(struct ceph_mds_client *mdsc);
|
||||||
extern void ceph_caps_finalize(struct ceph_mds_client *mdsc);
|
extern void ceph_caps_finalize(struct ceph_mds_client *mdsc);
|
||||||
|
|
Loading…
Reference in New Issue