ceph: decease session->s_trim_caps only after caps get trimmed
Subsystems (2)
PATCH 1/1 ceph: decease session->s_trim_caps only after caps get trimmed
d_prune_aliases() does not prune dentry that has non-zero reference count. If we want trim_caps() to trim 'N' caps, the first 'N' inodes in session->s_caps are all directories with child dentry, trim_caps() can fail to trim anything.
--- fs/ceph/mds_client.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ceph/mds_client.c +6 -2
@@ -1490,16 +1490,20 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)if ((used | wanted) & ~oissued & mine) goto out;/* we need these caps */ - session->s_trim_caps--;if (oissued) {/* we aren't the only cap.. just remove us */ __ceph_remove_cap (cap, true); + session->s_trim_caps--; }else { +int refs;/* try dropping referring dentries */ spin_unlock (&ci->i_ceph_lock);d_prune_aliases (inode); + refs =atomic_read (&inode->i_count); +if (refs ==1 ) + session->s_trim_caps--;dout ("trim_caps_cb %p cap %p pruned, count now %d\n" , - inode, cap,atomic_read (&inode->i_count)); + inode, cap, refs);return 0 ; }
Signature · 1 line
2.13.6
Please ignore this mail.
Quoted 43 lines · Zheng
d_prune_aliases()does not prune dentry that has non-zero reference count. If we wanttrim_caps()to trim 'N' caps, the first 'N' inodes insession->s_capsare all directories with child dentry,trim_caps()can fail to trim anything.Signed-off-by "Yan, Zheng" <[email protected]>---
fs/ceph/mds_client.c| 8 ++++++--1 file changed, 6 insertions(+), 2 deletions(-)fs/ceph/mds_client.c +6
-2@@ -1490,16 +1490,20 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)if ((used | wanted) & ~oissued & mine) goto out;/* we need these caps */ - session->s_trim_caps--;if (oissued) {/* we aren't the only cap.. just remove us */ __ceph_remove_cap (cap, true); + session->s_trim_caps--; }else { +int refs;/* try dropping referring dentries */ spin_unlock (&ci->i_ceph_lock);d_prune_aliases (inode); + refs =atomic_read (&inode->i_count); +if (refs ==1 ) + session->s_trim_caps--;dout ("trim_caps_cb %p cap %p pruned, count now %d\n" , - inode, cap,atomic_read (&inode->i_count)); + inode, cap, refs);return 0 ; }Signature · 1 line
2.13.6
Quoted 28 lines · Zheng
d_prune_aliases()does not prune dentry that has non-zero reference count. If we wanttrim_caps()to trim 'N' caps, the first 'N' inodes insession->s_capsare all directories with child dentry,trim_caps()can fail to trim anything.Signed-off-by "Yan, Zheng" <[email protected]>--- fs/ceph/mds_client.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)fs/ceph/mds_client.c +2
-1@@ -1490,16 +1490,20 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)if ((used | wanted) & ~oissued & mine) goto out;/* we need these caps */ - session->s_trim_caps--;if (oissued) {/* we aren't the only cap.. just remove us */ __ceph_remove_cap (cap, true); + session->s_trim_caps--; }else { +int refs;/* try dropping referring dentries */ spin_unlock (&ci->i_ceph_lock);
fs/ceph/mds_client.c static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg) · line 1509
Quoted 10 lines
fs/ceph/mds_client.c +4
-1d_prune_aliases (inode); + refs =atomic_read (&inode->i_count); +if (refs ==1 ) + session->s_trim_caps--;dout ("trim_caps_cb %p cap %p pruned, count now %d\n" , - inode, cap,atomic_read (&inode->i_count)); + inode, cap, refs);return 0 ; }