ceph: remove the capsnaps when removing the caps
cover ceph: remove the capsnaps when removing the caps
From: Xiubo Li <[email protected]>
Fix the memory leak for the ceph_inode_info and two warnings.
Xiubo Li (3):
ceph: remove the capsnaps when removing the caps
ceph: don't WARN if we're force umounting
ceph: don't WARN if we're iterate removing the session caps
fs/ceph/caps.c | 62 ++++++++++++++++++++++++++++---------------- fs/ceph/mds_client.c | 36 +++++++++++++++++++++---- fs/ceph/super.h | 6 ++++- 3 files changed, 75 insertions(+), 29 deletions(-)
Signature · 1 line
2.27.0
PATCH 1/3 ceph: remove the capsnaps when removing the caps
From: Xiubo Li <[email protected]>
The capsnaps will ihold the inodes when queuing to flush, so when force umounting it will close the sessions first and if the MDSes respond very fast and the session connections are closed just before killing the superblock, which will flush the msgr queue, then the flush capsnap callback won't ever be called, which will lead the memory leak bug for the ceph_inode_info.
URL: https://tracker.ceph.com/issues/52295
--- fs/ceph/caps.c | 47 +++++++++++++++++++++++++++++--------------- fs/ceph/mds_client.c | 23 +++++++++++++++++++++- fs/ceph/super.h | 3 +++ 3 files changed, 56 insertions(+), 17 deletions(-)
fs/ceph/caps.c +31 -16
@@ -3663,6 +3663,34 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,iput (inode); } +/* +* Caller hold s_mutex and i_ceph_lock. +*/ +void ceph_remove_capsnap (struct inode *inode,struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_mds_client *mdsc =ceph_sb_to_client (inode->i_sb)->mdsc; +bool ret; + +dout ("removing capsnap %p, inode %p ci %p\n" , capsnap, inode, ci); + +WARN_ON (capsnap->dirty_pages || capsnap->writing); +list_del (&capsnap->ci_item); + ret =__detach_cap_flush_from_ci (ci, &capsnap->cap_flush); +if (wake_ci) + *wake_ci = ret; + +spin_lock (&mdsc->cap_dirty_lock); +if (list_empty (&ci->i_cap_flush_list)) +list_del_init (&ci->i_flushing_item); + + ret =__detach_cap_flush_from_mdsc (mdsc, &capsnap->cap_flush); +if (wake_mdsc) + *wake_mdsc = ret; +spin_unlock (&mdsc->cap_dirty_lock); +} +/* * Handle FLUSHSNAP_ACK. MDS has flushed snap data to disk and we can * throw away our cap_snap.
@@ -3700,23 +3728,10 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, capsnap, capsnap->follows); } } -if (flushed) { -WARN_ON (capsnap->dirty_pages || capsnap->writing); -dout (" removing %p cap_snap %p follows %lld\n" , - inode, capsnap, follows); -list_del (&capsnap->ci_item); - wake_ci |=__detach_cap_flush_from_ci (ci, &capsnap->cap_flush); - -spin_lock (&mdsc->cap_dirty_lock); - -if (list_empty (&ci->i_cap_flush_list)) -list_del_init (&ci->i_flushing_item); - - wake_mdsc |=__detach_cap_flush_from_mdsc (mdsc, - &capsnap->cap_flush); -spin_unlock (&mdsc->cap_dirty_lock); - } +if (flushed) +ceph_remove_capsnap (inode, capsnap, &wake_ci, &wake_mdsc);spin_unlock (&ci->i_ceph_lock); +if (flushed) {ceph_put_snap_context (capsnap->context);ceph_put_cap_snap (capsnap);
fs/ceph/mds_client.c +22 -1
@@ -1604,10 +1604,30 @@ int ceph_iterate_session_caps(struct ceph_mds_session *session,return ret; } +static void remove_capsnaps (struct ceph_mds_client *mdsc,struct inode *inode) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_cap_snap *capsnap; + +dout ("removing capsnaps, ci is %p, inode is %p\n" , ci, inode); + +while (!list_empty (&ci->i_cap_snaps)) { + capsnap =list_first_entry (&ci->i_cap_snaps, + struct ceph_cap_snap, ci_item); +ceph_remove_capsnap (inode, capsnap,NULL ,NULL ); +ceph_put_snap_context (capsnap->context); +ceph_put_cap_snap (capsnap); +iput (inode); + } +wake_up_all (&ci->i_cap_wq); +wake_up_all (&mdsc->cap_flushing_wq); +} +static int remove_session_caps_cb (struct inode *inode,struct ceph_cap *cap,void *arg) {struct ceph_fs_client *fsc = (struct ceph_fs_client *)arg; +struct ceph_mds_client *mdsc = fsc->mdsc;struct ceph_inode_info *ci =ceph_inode (inode);LIST_HEAD (to_remove);bool dirty_dropped = false;
@@ -1619,7 +1639,6 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,__ceph_remove_cap (cap, false);if (!ci->i_auth_cap) {struct ceph_cap_flush *cf; -struct ceph_mds_client *mdsc = fsc->mdsc;if (READ_ONCE (fsc->mount_state) >=CEPH_MOUNT_SHUTDOWN ) {if (inode->i_data.nrpages >0 )
@@ -1684,6 +1703,8 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, ci->i_prealloc_cap_flush =NULL ; } } +if (!list_empty (&ci->i_cap_snaps)) +remove_capsnaps (mdsc, inode);spin_unlock (&ci->i_ceph_lock);while (!list_empty (&to_remove)) {struct ceph_cap_flush *cf;
fs/ceph/super.h +3 -0
@@ -1168,6 +1168,9 @@ extern void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, int had);extern void ceph_put_wrbuffer_cap_refs (struct ceph_inode_info *ci,int nr,struct ceph_snap_context *snapc); +extern void ceph_remove_capsnap (struct inode *inode, +struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc);extern void ceph_flush_snaps (struct ceph_inode_info *ci,struct ceph_mds_session **psession);extern bool __ceph_should_report_size (struct ceph_inode_info *ci);
Signature · 1 line
2.27.0
Quoted 22 lines · On Wed, 2021-08-18 at 16:06 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
The capsnaps will ihold the inodes when queuing to flush, so when force umounting it will close the sessions first and if the MDSes respond very fast and the session connections are closed just before killing the superblock, which will flush the msgr queue, then the flush capsnap callback won't ever be called, which will lead the memory leak bug for the
ceph_inode_info.URL: https://tracker.ceph.com/issues/52295
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/caps.c | 47 +++++++++++++++++++++++++++++--------------- fs/ceph/mds_client.c | 23 +++++++++++++++++++++- fs/ceph/super.h | 3 +++ 3 files changed, 56 insertions(+), 17 deletions(-)fs/ceph/caps.c +0
-0
fs/ceph/caps.c static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, · line 3668
Quoted 6 lines
fs/ceph/caps.c +3
-0@@ -3663,6 +3663,34 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,iput (inode); } +/* +* Caller hold s_mutex and i_ceph_lock. +*/
Why add comments like this when we have lockdep_assert_held() ? It's generally better to use that as they illustrate the same relationship and also help catch those who violate the rules.
Quoted 112 lines
fs/ceph/caps.c +28
-16+void ceph_remove_capsnap (struct inode *inode,struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_mds_client *mdsc =ceph_sb_to_client (inode->i_sb)->mdsc; +bool ret; + +dout ("removing capsnap %p, inode %p ci %p\n" , capsnap, inode, ci); + +WARN_ON (capsnap->dirty_pages || capsnap->writing); +list_del (&capsnap->ci_item); + ret =__detach_cap_flush_from_ci (ci, &capsnap->cap_flush); +if (wake_ci) + *wake_ci = ret; + +spin_lock (&mdsc->cap_dirty_lock); +if (list_empty (&ci->i_cap_flush_list)) +list_del_init (&ci->i_flushing_item); + + ret =__detach_cap_flush_from_mdsc (mdsc, &capsnap->cap_flush); +if (wake_mdsc) + *wake_mdsc = ret; +spin_unlock (&mdsc->cap_dirty_lock); +} +/* * Handle FLUSHSNAP_ACK. MDS has flushed snap data to disk and we can * throw away our cap_snap. @@ -3700,23 +3728,10 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, capsnap, capsnap->follows); } } -if (flushed) { -WARN_ON (capsnap->dirty_pages || capsnap->writing); -dout (" removing %p cap_snap %p follows %lld\n" , - inode, capsnap, follows); -list_del (&capsnap->ci_item); - wake_ci |=__detach_cap_flush_from_ci (ci, &capsnap->cap_flush); - -spin_lock (&mdsc->cap_dirty_lock); - -if (list_empty (&ci->i_cap_flush_list)) -list_del_init (&ci->i_flushing_item); - - wake_mdsc |=__detach_cap_flush_from_mdsc (mdsc, - &capsnap->cap_flush); -spin_unlock (&mdsc->cap_dirty_lock); - } +if (flushed) +ceph_remove_capsnap (inode, capsnap, &wake_ci, &wake_mdsc);spin_unlock (&ci->i_ceph_lock); +if (flushed) {ceph_put_snap_context (capsnap->context);ceph_put_cap_snap (capsnap);fs/ceph/mds_client.c +22
-1@@ -1604,10 +1604,30 @@ int ceph_iterate_session_caps(struct ceph_mds_session *session,return ret; } +static void remove_capsnaps (struct ceph_mds_client *mdsc,struct inode *inode) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_cap_snap *capsnap; + +dout ("removing capsnaps, ci is %p, inode is %p\n" , ci, inode); + +while (!list_empty (&ci->i_cap_snaps)) { + capsnap =list_first_entry (&ci->i_cap_snaps, + struct ceph_cap_snap, ci_item); +ceph_remove_capsnap (inode, capsnap,NULL ,NULL ); +ceph_put_snap_context (capsnap->context); +ceph_put_cap_snap (capsnap); +iput (inode); + } +wake_up_all (&ci->i_cap_wq); +wake_up_all (&mdsc->cap_flushing_wq); +} +static int remove_session_caps_cb (struct inode *inode,struct ceph_cap *cap,void *arg) {struct ceph_fs_client *fsc = (struct ceph_fs_client *)arg; +struct ceph_mds_client *mdsc = fsc->mdsc;struct ceph_inode_info *ci =ceph_inode (inode);LIST_HEAD (to_remove);bool dirty_dropped = false;@@ -1619,7 +1639,6 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,__ceph_remove_cap (cap, false);if (!ci->i_auth_cap) {struct ceph_cap_flush *cf; -struct ceph_mds_client *mdsc = fsc->mdsc;if (READ_ONCE (fsc->mount_state) >=CEPH_MOUNT_SHUTDOWN ) {if (inode->i_data.nrpages >0 )@@ -1684,6 +1703,8 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, ci->i_prealloc_cap_flush =NULL ; } } +if (!list_empty (&ci->i_cap_snaps)) +remove_capsnaps (mdsc, inode);spin_unlock (&ci->i_ceph_lock);while (!list_empty (&to_remove)) {struct ceph_cap_flush *cf;fs/ceph/super.h +0
-0
fs/ceph/super.h extern void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, · line 1176
Quoted 9 lines
fs/ceph/super.h +3
-0@@ -1168,6 +1168,9 @@ extern void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, int had);extern void ceph_put_wrbuffer_cap_refs (struct ceph_inode_info *ci,int nr,struct ceph_snap_context *snapc); +extern void ceph_remove_capsnap (struct inode *inode, +struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc);extern void ceph_flush_snaps (struct ceph_inode_info *ci,struct ceph_mds_session **psession);extern bool __ceph_should_report_size (struct ceph_inode_info *ci);
Patch looks reasonable otherwise.
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 26 lines · Jeff Layton
Quoted 25 lines · On Wed, 2021-08-18 at 16:06 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
The capsnaps will ihold the inodes when queuing to flush, so when force umounting it will close the sessions first and if the MDSes respond very fast and the session connections are closed just before killing the superblock, which will flush the msgr queue, then the flush capsnap callback won't ever be called, which will lead the memory leak bug for the
ceph_inode_info.URL: https://tracker.ceph.com/issues/52295
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/caps.c | 47 +++++++++++++++++++++++++++++--------------- fs/ceph/mds_client.c | 23 +++++++++++++++++++++- fs/ceph/super.h | 3 +++ 3 files changed, 56 insertions(+), 17 deletions(-)fs/ceph/caps.c +0
-0@@ -3663,6 +3663,34 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,iput (inode); }
Quoted 7 lines
fs/ceph/caps.c static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, · line 3668
Quoted 3 lines
fs/ceph/caps.c +3
-0+/* +* Caller hold s_mutex and i_ceph_lock. +*/ Why add comments like this when we have
lockdep_assert_held()? It's generally better to use that as they illustrate the same relationship and also help catch those who violate the rules.
Okay, I will switch to lockdep_assert_held().
Thanks
Quoted 122 lines
Quoted 112 lines
fs/ceph/caps.c +28
-16+void ceph_remove_capsnap (struct inode *inode,struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_mds_client *mdsc =ceph_sb_to_client (inode->i_sb)->mdsc; +bool ret; + +dout ("removing capsnap %p, inode %p ci %p\n" , capsnap, inode, ci); + +WARN_ON (capsnap->dirty_pages || capsnap->writing); +list_del (&capsnap->ci_item); + ret =__detach_cap_flush_from_ci (ci, &capsnap->cap_flush); +if (wake_ci) + *wake_ci = ret; + +spin_lock (&mdsc->cap_dirty_lock); +if (list_empty (&ci->i_cap_flush_list)) +list_del_init (&ci->i_flushing_item); + + ret =__detach_cap_flush_from_mdsc (mdsc, &capsnap->cap_flush); +if (wake_mdsc) + *wake_mdsc = ret; +spin_unlock (&mdsc->cap_dirty_lock); +} +/* * Handle FLUSHSNAP_ACK. MDS has flushed snap data to disk and we can * throw away our cap_snap. @@ -3700,23 +3728,10 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, capsnap, capsnap->follows); } } -if (flushed) { -WARN_ON (capsnap->dirty_pages || capsnap->writing); -dout (" removing %p cap_snap %p follows %lld\n" , - inode, capsnap, follows); -list_del (&capsnap->ci_item); - wake_ci |=__detach_cap_flush_from_ci (ci, &capsnap->cap_flush); - -spin_lock (&mdsc->cap_dirty_lock); - -if (list_empty (&ci->i_cap_flush_list)) -list_del_init (&ci->i_flushing_item); - - wake_mdsc |=__detach_cap_flush_from_mdsc (mdsc, - &capsnap->cap_flush); -spin_unlock (&mdsc->cap_dirty_lock); - } +if (flushed) +ceph_remove_capsnap (inode, capsnap, &wake_ci, &wake_mdsc);spin_unlock (&ci->i_ceph_lock); +if (flushed) {ceph_put_snap_context (capsnap->context);ceph_put_cap_snap (capsnap);fs/ceph/mds_client.c +22
-1@@ -1604,10 +1604,30 @@ int ceph_iterate_session_caps(struct ceph_mds_session *session,return ret; } +static void remove_capsnaps (struct ceph_mds_client *mdsc,struct inode *inode) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_cap_snap *capsnap; + +dout ("removing capsnaps, ci is %p, inode is %p\n" , ci, inode); + +while (!list_empty (&ci->i_cap_snaps)) { + capsnap =list_first_entry (&ci->i_cap_snaps, + struct ceph_cap_snap, ci_item); +ceph_remove_capsnap (inode, capsnap,NULL ,NULL ); +ceph_put_snap_context (capsnap->context); +ceph_put_cap_snap (capsnap); +iput (inode); + } +wake_up_all (&ci->i_cap_wq); +wake_up_all (&mdsc->cap_flushing_wq); +} +static int remove_session_caps_cb (struct inode *inode,struct ceph_cap *cap,void *arg) {struct ceph_fs_client *fsc = (struct ceph_fs_client *)arg; +struct ceph_mds_client *mdsc = fsc->mdsc;struct ceph_inode_info *ci =ceph_inode (inode);LIST_HEAD (to_remove);bool dirty_dropped = false;@@ -1619,7 +1639,6 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,__ceph_remove_cap (cap, false);if (!ci->i_auth_cap) {struct ceph_cap_flush *cf; -struct ceph_mds_client *mdsc = fsc->mdsc;if (READ_ONCE (fsc->mount_state) >=CEPH_MOUNT_SHUTDOWN ) {if (inode->i_data.nrpages >0 )@@ -1684,6 +1703,8 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, ci->i_prealloc_cap_flush =NULL ; } } +if (!list_empty (&ci->i_cap_snaps)) +remove_capsnaps (mdsc, inode);spin_unlock (&ci->i_ceph_lock);while (!list_empty (&to_remove)) {struct ceph_cap_flush *cf;fs/ceph/super.h +0
-0fs/ceph/super.h extern void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, · line 1176
Quoted 9 lines
fs/ceph/super.h +3
-0@@ -1168,6 +1168,9 @@ extern void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, int had);extern void ceph_put_wrbuffer_cap_refs (struct ceph_inode_info *ci,int nr,struct ceph_snap_context *snapc); +extern void ceph_remove_capsnap (struct inode *inode, +struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc);extern void ceph_flush_snaps (struct ceph_inode_info *ci,struct ceph_mds_session **psession);extern bool __ceph_should_report_size (struct ceph_inode_info *ci);Patch looks reasonable otherwise.
Quoted 28 lines · On Wed, 2021-08-18 at 16:06 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
The capsnaps will ihold the inodes when queuing to flush, so when force umounting it will close the sessions first and if the MDSes respond very fast and the session connections are closed just before killing the superblock, which will flush the msgr queue, then the flush capsnap callback won't ever be called, which will lead the memory leak bug for the
ceph_inode_info.URL: https://tracker.ceph.com/issues/52295
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/caps.c | 47 +++++++++++++++++++++++++++++--------------- fs/ceph/mds_client.c | 23 +++++++++++++++++++++- fs/ceph/super.h | 3 +++ 3 files changed, 56 insertions(+), 17 deletions(-)fs/ceph/caps.c +3
-0@@ -3663,6 +3663,34 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,iput (inode); } +/* +* Caller hold s_mutex and i_ceph_lock. +*/
fs/ceph/caps.c static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, · line 3678
Quoted 10 lines
fs/ceph/caps.c +10
-0+void ceph_remove_capsnap (struct inode *inode,struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_mds_client *mdsc =ceph_sb_to_client (inode->i_sb)->mdsc; +bool ret; + +dout ("removing capsnap %p, inode %p ci %p\n" , capsnap, inode, ci); + +WARN_ON (capsnap->dirty_pages || capsnap->writing);
Can we make this a WARN_ON_ONCE too?
Quoted 111 lines
fs/ceph/caps.c +18
-16+list_del (&capsnap->ci_item); + ret =__detach_cap_flush_from_ci (ci, &capsnap->cap_flush); +if (wake_ci) + *wake_ci = ret; + +spin_lock (&mdsc->cap_dirty_lock); +if (list_empty (&ci->i_cap_flush_list)) +list_del_init (&ci->i_flushing_item); + + ret =__detach_cap_flush_from_mdsc (mdsc, &capsnap->cap_flush); +if (wake_mdsc) + *wake_mdsc = ret; +spin_unlock (&mdsc->cap_dirty_lock); +} +/* * Handle FLUSHSNAP_ACK. MDS has flushed snap data to disk and we can * throw away our cap_snap. @@ -3700,23 +3728,10 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, capsnap, capsnap->follows); } } -if (flushed) { -WARN_ON (capsnap->dirty_pages || capsnap->writing); -dout (" removing %p cap_snap %p follows %lld\n" , - inode, capsnap, follows); -list_del (&capsnap->ci_item); - wake_ci |=__detach_cap_flush_from_ci (ci, &capsnap->cap_flush); - -spin_lock (&mdsc->cap_dirty_lock); - -if (list_empty (&ci->i_cap_flush_list)) -list_del_init (&ci->i_flushing_item); - - wake_mdsc |=__detach_cap_flush_from_mdsc (mdsc, - &capsnap->cap_flush); -spin_unlock (&mdsc->cap_dirty_lock); - } +if (flushed) +ceph_remove_capsnap (inode, capsnap, &wake_ci, &wake_mdsc);spin_unlock (&ci->i_ceph_lock); +if (flushed) {ceph_put_snap_context (capsnap->context);ceph_put_cap_snap (capsnap);fs/ceph/mds_client.c +22
-1@@ -1604,10 +1604,30 @@ int ceph_iterate_session_caps(struct ceph_mds_session *session,return ret; } +static void remove_capsnaps (struct ceph_mds_client *mdsc,struct inode *inode) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_cap_snap *capsnap; + +dout ("removing capsnaps, ci is %p, inode is %p\n" , ci, inode); + +while (!list_empty (&ci->i_cap_snaps)) { + capsnap =list_first_entry (&ci->i_cap_snaps, + struct ceph_cap_snap, ci_item); +ceph_remove_capsnap (inode, capsnap,NULL ,NULL ); +ceph_put_snap_context (capsnap->context); +ceph_put_cap_snap (capsnap); +iput (inode); + } +wake_up_all (&ci->i_cap_wq); +wake_up_all (&mdsc->cap_flushing_wq); +} +static int remove_session_caps_cb (struct inode *inode,struct ceph_cap *cap,void *arg) {struct ceph_fs_client *fsc = (struct ceph_fs_client *)arg; +struct ceph_mds_client *mdsc = fsc->mdsc;struct ceph_inode_info *ci =ceph_inode (inode);LIST_HEAD (to_remove);bool dirty_dropped = false;@@ -1619,7 +1639,6 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,__ceph_remove_cap (cap, false);if (!ci->i_auth_cap) {struct ceph_cap_flush *cf; -struct ceph_mds_client *mdsc = fsc->mdsc;if (READ_ONCE (fsc->mount_state) >=CEPH_MOUNT_SHUTDOWN ) {if (inode->i_data.nrpages >0 )@@ -1684,6 +1703,8 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, ci->i_prealloc_cap_flush =NULL ; } } +if (!list_empty (&ci->i_cap_snaps)) +remove_capsnaps (mdsc, inode);spin_unlock (&ci->i_ceph_lock);while (!list_empty (&to_remove)) {struct ceph_cap_flush *cf;fs/ceph/super.h +3
-0@@ -1168,6 +1168,9 @@ extern void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, int had);extern void ceph_put_wrbuffer_cap_refs (struct ceph_inode_info *ci,int nr,struct ceph_snap_context *snapc); +extern void ceph_remove_capsnap (struct inode *inode, +struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc);extern void ceph_flush_snaps (struct ceph_inode_info *ci,struct ceph_mds_session **psession);extern bool __ceph_should_report_size (struct ceph_inode_info *ci);
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 26 lines · Jeff Layton
Quoted 25 lines · On Wed, 2021-08-18 at 16:06 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
The capsnaps will ihold the inodes when queuing to flush, so when force umounting it will close the sessions first and if the MDSes respond very fast and the session connections are closed just before killing the superblock, which will flush the msgr queue, then the flush capsnap callback won't ever be called, which will lead the memory leak bug for the
ceph_inode_info.URL: https://tracker.ceph.com/issues/52295
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/caps.c | 47 +++++++++++++++++++++++++++++--------------- fs/ceph/mds_client.c | 23 +++++++++++++++++++++- fs/ceph/super.h | 3 +++ 3 files changed, 56 insertions(+), 17 deletions(-)fs/ceph/caps.c +0
-0@@ -3663,6 +3663,34 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,iput (inode); }
Quoted 14 lines
fs/ceph/caps.c static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, · line 3678
Quoted 13 lines
fs/ceph/caps.c +13
-0+/* +* Caller hold s_mutex and i_ceph_lock. +*/ +void ceph_remove_capsnap (struct inode *inode,struct ceph_cap_snap *capsnap, +bool *wake_ci,bool *wake_mdsc) +{ +struct ceph_inode_info *ci =ceph_inode (inode); +struct ceph_mds_client *mdsc =ceph_sb_to_client (inode->i_sb)->mdsc; +bool ret; + +dout ("removing capsnap %p, inode %p ci %p\n" , capsnap, inode, ci); + +WARN_ON (capsnap->dirty_pages || capsnap->writing);Can we make this a
WARN_ON_ONCEtoo?
Yeah, will fix it.
Thanks
PATCH 2/3 ceph: don't WARN if we're force umounting
In reply to [email protected]From: Xiubo Li <[email protected]>
Force umount will try to close the sessions by setting the session state to _CLOSING, so in ceph_kill_sb after that it will warn on it.
URL: https://tracker.ceph.com/issues/52295
--- fs/ceph/mds_client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/ceph/mds_client.c +7 -2
@@ -4558,6 +4558,8 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc)bool check_session_state (struct ceph_mds_session *s) { +struct ceph_fs_client *fsc = s->s_mdsc->fsc; +switch (s->s_state) {case CEPH_MDS_SESSION_OPEN :if (s->s_ttl &&time_after (jiffies, s->s_ttl)) {
@@ -4566,8 +4568,11 @@ bool check_session_state(struct ceph_mds_session *s) }break ;case CEPH_MDS_SESSION_CLOSING : -/* Should never reach this when we're unmounting */ -WARN_ON_ONCE (s->s_ttl); +/* +* Should never reach this when none force unmounting +*/ +if (READ_ONCE (fsc->mount_state) !=CEPH_MOUNT_SHUTDOWN ) +WARN_ON_ONCE (s->s_ttl); fallthrough;case CEPH_MDS_SESSION_NEW :case CEPH_MDS_SESSION_RESTARTING :
Signature · 1 line
2.27.0
Re: [PATCH 2/3] ceph: don't WARN if we're force umounting
Quoted 25 lines · On Wed, 2021-08-18 at 16:06 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
Force umount will try to close the sessions by setting the session state to
_CLOSING, so inceph_kill_sbafter that it will warn on it.URL: https://tracker.ceph.com/issues/52295
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/mds_client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)fs/ceph/mds_client.c +2
-0@@ -4558,6 +4558,8 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc)bool check_session_state (struct ceph_mds_session *s) { +struct ceph_fs_client *fsc = s->s_mdsc->fsc; +switch (s->s_state) {case CEPH_MDS_SESSION_OPEN :if (s->s_ttl &&time_after (jiffies, s->s_ttl)) {
fs/ceph/mds_client.c bool check_session_state(struct ceph_mds_session *s) · line 4575
Quoted 10 lines
fs/ceph/mds_client.c +5
-2@@ -4566,8 +4568,11 @@ bool check_session_state(struct ceph_mds_session *s) }break ;case CEPH_MDS_SESSION_CLOSING : -/* Should never reach this when we're unmounting */ -WARN_ON_ONCE (s->s_ttl); +/* +* Should never reach this when none force unmounting +*/ +if (READ_ONCE (fsc->mount_state) !=CEPH_MOUNT_SHUTDOWN ) +WARN_ON_ONCE (s->s_ttl);
How about something like this instead?
WARN_ON_ONCE(s->s_ttl && READ_ONCE(fsc->mount_state) != CEPH_MOUNT_SHUTDOWN);
Quoted 3 lines
fs/ceph/mds_client.c +0
-0fallthrough;case CEPH_MDS_SESSION_NEW :case CEPH_MDS_SESSION_RESTARTING :
Signature · 1 line
Jeff Layton <[email protected]>
Re: [PATCH 2/3] ceph: don't WARN if we're force umounting
Quoted 38 lines · Jeff Layton
Quoted 25 lines · On Wed, 2021-08-18 at 16:06 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
Force umount will try to close the sessions by setting the session state to
_CLOSING, so inceph_kill_sbafter that it will warn on it.URL: https://tracker.ceph.com/issues/52295
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/mds_client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)fs/ceph/mds_client.c +2
-0@@ -4558,6 +4558,8 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc)bool check_session_state (struct ceph_mds_session *s) { +struct ceph_fs_client *fsc = s->s_mdsc->fsc; +switch (s->s_state) {case CEPH_MDS_SESSION_OPEN :if (s->s_ttl &&time_after (jiffies, s->s_ttl)) {fs/ceph/mds_client.c bool check_session_state(struct ceph_mds_session *s) · line 4575
Quoted 10 lines
fs/ceph/mds_client.c +5
-2@@ -4566,8 +4568,11 @@ bool check_session_state(struct ceph_mds_session *s) }break ;case CEPH_MDS_SESSION_CLOSING : -/* Should never reach this when we're unmounting */ -WARN_ON_ONCE (s->s_ttl); +/* +* Should never reach this when none force unmounting +*/ +if (READ_ONCE (fsc->mount_state) !=CEPH_MOUNT_SHUTDOWN ) +WARN_ON_ONCE (s->s_ttl);How about something like this instead?
Quoted 1 line
WARN_ON_ONCE(s->s_ttl && READ_ONCE(fsc->mount_state) != CEPH_MOUNT_SHUTDOWN);
This looks good to me too. Will fix it.
Thanks
Quoted 4 lines
Quoted 4 lines
fs/ceph/mds_client.c +0
-0fallthrough;case CEPH_MDS_SESSION_NEW :case CEPH_MDS_SESSION_RESTARTING :
PATCH 3/3 ceph: don't WARN if we're iterate removing the session caps
In reply to [email protected]From: Xiubo Li <[email protected]>
For example in case force umounting it will remove all the session caps one by one even it's dirty cap.
URL: https://tracker.ceph.com/issues/52295
--- fs/ceph/caps.c | 15 ++++++++------- fs/ceph/mds_client.c | 4 ++-- fs/ceph/super.h | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-)
fs/ceph/caps.c +8 -7
@@ -1101,7 +1101,7 @@ int ceph_is_any_caps(struct inode *inode)* caller should hold i_ceph_lock. * caller will not hold session s_mutex if called from destroy_inode. */ -void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release) +void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release,bool warn) {struct ceph_mds_session *session = cap->session;struct ceph_inode_info *ci = cap->ci;
@@ -1121,7 +1121,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)/* remove from inode's cap rbtree, and clear auth cap */ rb_erase (&cap->ci_node, &ci->i_caps);if (ci->i_auth_cap == cap) { -WARN_ON_ONCE (!list_empty (&ci->i_dirty_item) && +WARN_ON_ONCE (warn && !list_empty (&ci->i_dirty_item) && !mdsc->fsc->blocklisted); ci->i_auth_cap =NULL ; }
@@ -1304,7 +1304,7 @@ void __ceph_remove_caps(struct ceph_inode_info *ci)while (p) { struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node); p =rb_next (p); -__ceph_remove_cap (cap, true); +__ceph_remove_cap (cap, true, true); }spin_unlock (&ci->i_ceph_lock); }
@@ -3815,7 +3815,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, goto out_unlock;if (target <0 ) { -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }
@@ -3850,7 +3850,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,change_auth_cap_ses (ci, tcap->session); } } -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }else if (tsession) {/* add placeholder for the export tagert */
@@ -3867,7 +3867,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,spin_unlock (&mdsc->cap_dirty_lock); } -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }
@@ -3978,7 +3978,8 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, ocap->mseq, mds,le32_to_cpu (ph->seq), le32_to_cpu(ph->mseq)); } -__ceph_remove_cap (ocap, (ph->flags &CEPH_CAP_FLAG_RELEASE )); +__ceph_remove_cap (ocap, (ph->flags &CEPH_CAP_FLAG_RELEASE ), + true); } *old_issued = issued;
fs/ceph/mds_client.c +2 -2
@@ -1636,7 +1636,7 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,dout ("removing cap %p, ci is %p, inode is %p\n" , cap, ci, &ci->vfs_inode);spin_lock (&ci->i_ceph_lock); -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, false);if (!ci->i_auth_cap) {struct ceph_cap_flush *cf;
@@ -2008,7 +2008,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)if (oissued) {/* we aren't the only cap.. just remove us */ -__ceph_remove_cap (cap, true); +__ceph_remove_cap (cap, true, true); (*remaining)--; }else {struct dentry *dentry;
fs/ceph/super.h +2 -1
@@ -1142,7 +1142,8 @@ extern void ceph_add_cap(struct inode *inode, unsigned issued, unsigned wanted, unsigned cap, unsigned seq, u64 realmino, int flags, struct ceph_cap **new_cap); -extern void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release); +extern void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release, +bool warn);extern void __ceph_remove_caps (struct ceph_inode_info *ci);extern void ceph_put_cap (struct ceph_mds_client *mdsc,struct ceph_cap *cap);
Signature · 1 line
2.27.0
Re: [PATCH 3/3] ceph: don't WARN if we're iterate removing the session caps
Quoted 18 lines · On Wed, 2021-08-18 at 16:06 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
For example in case force umounting it will remove all the session caps one by one even it's dirty cap.
URL: https://tracker.ceph.com/issues/52295
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/caps.c | 15 ++++++++------- fs/ceph/mds_client.c | 4 ++-- fs/ceph/super.h | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-)fs/ceph/caps.c +0
-0
fs/ceph/caps.c int ceph_is_any_caps(struct inode *inode) · line 1104
Quoted 5 lines
fs/ceph/caps.c +1
-1@@ -1101,7 +1101,7 @@ int ceph_is_any_caps(struct inode *inode)* caller should hold i_ceph_lock. * caller will not hold session s_mutex if called from destroy_inode. */ -void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release) +void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release,bool warn)
I think it'd be better to refactor __ceph_remove_cap so that it has a wrapper function that does the WARN_ON_ONCE call under the right conditions.
Maybe add a ceph_remove_cap() that does:
WARN_ON_ONCE(ci && ci->i_auth_cap == cap && !list_empty(&ci->i_dirty_item) && !mdsc->fsc->blocklisted);
...and then calls __ceph_remove_cap(). Then you could have the ones that set "warn" to false call __ceph_remove_cap() and the others would call ceph_remove_cap(). That's at least a little less ugly (and more efficient).
Alternately, I guess you could try to test what state the session is in and only warn if it's not being force-unmounted?
Quoted 94 lines
fs/ceph/caps.c +7
-6{struct ceph_mds_session *session = cap->session;struct ceph_inode_info *ci = cap->ci;@@ -1121,7 +1121,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)/* remove from inode's cap rbtree, and clear auth cap */ rb_erase (&cap->ci_node, &ci->i_caps);if (ci->i_auth_cap == cap) { -WARN_ON_ONCE (!list_empty (&ci->i_dirty_item) && +WARN_ON_ONCE (warn && !list_empty (&ci->i_dirty_item) && !mdsc->fsc->blocklisted); ci->i_auth_cap =NULL ; }@@ -1304,7 +1304,7 @@ void __ceph_remove_caps(struct ceph_inode_info *ci)while (p) { struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node); p =rb_next (p); -__ceph_remove_cap (cap, true); +__ceph_remove_cap (cap, true, true); }spin_unlock (&ci->i_ceph_lock); }@@ -3815,7 +3815,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, goto out_unlock;if (target <0 ) { -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }@@ -3850,7 +3850,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,change_auth_cap_ses (ci, tcap->session); } } -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }else if (tsession) {/* add placeholder for the export tagert */ @@ -3867,7 +3867,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,spin_unlock (&mdsc->cap_dirty_lock); } -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }@@ -3978,7 +3978,8 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, ocap->mseq, mds,le32_to_cpu (ph->seq), le32_to_cpu(ph->mseq)); } -__ceph_remove_cap (ocap, (ph->flags &CEPH_CAP_FLAG_RELEASE )); +__ceph_remove_cap (ocap, (ph->flags &CEPH_CAP_FLAG_RELEASE ), + true); } *old_issued = issued;fs/ceph/mds_client.c +2
-2@@ -1636,7 +1636,7 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,dout ("removing cap %p, ci is %p, inode is %p\n" , cap, ci, &ci->vfs_inode);spin_lock (&ci->i_ceph_lock); -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, false);if (!ci->i_auth_cap) {struct ceph_cap_flush *cf;@@ -2008,7 +2008,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)if (oissued) {/* we aren't the only cap.. just remove us */ -__ceph_remove_cap (cap, true); +__ceph_remove_cap (cap, true, true); (*remaining)--; }else {struct dentry *dentry;fs/ceph/super.h +2
-1@@ -1142,7 +1142,8 @@ extern void ceph_add_cap(struct inode *inode, unsigned issued, unsigned wanted, unsigned cap, unsigned seq, u64 realmino, int flags, struct ceph_cap **new_cap); -extern void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release); +extern void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release, +bool warn);extern void __ceph_remove_caps (struct ceph_inode_info *ci);extern void ceph_put_cap (struct ceph_mds_client *mdsc,struct ceph_cap *cap);
Signature · 1 line
Jeff Layton <[email protected]>
Re: [PATCH 3/3] ceph: don't WARN if we're iterate removing the session caps
Quoted 30 lines · Jeff Layton
Quoted 18 lines · On Wed, 2021-08-18 at 16:06 +0800, [email protected] wrote:
From: Xiubo Li <[email protected]>
For example in case force umounting it will remove all the session caps one by one even it's dirty cap.
URL: https://tracker.ceph.com/issues/52295
Signed-off-by Xiubo Li <[email protected]>--- fs/ceph/caps.c | 15 ++++++++------- fs/ceph/mds_client.c | 4 ++-- fs/ceph/super.h | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-)fs/ceph/caps.c +0
-0fs/ceph/caps.c int ceph_is_any_caps(struct inode *inode) · line 1104
Quoted 5 lines
fs/ceph/caps.c +1
-1@@ -1101,7 +1101,7 @@ int ceph_is_any_caps(struct inode *inode)* caller should hold i_ceph_lock. * caller will not hold session s_mutex if called from destroy_inode. */ -void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release) +void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release,bool warn)I think it'd be better to refactor
__ceph_remove_capso that it has a wrapper function that does theWARN_ON_ONCEcall under the right conditions.Maybe add a
ceph_remove_cap()that does:
Quoted 8 lines
WARN_ON_ONCE(ci && ci->i_auth_cap == cap && !list_empty(&ci->i_dirty_item) && !mdsc->fsc->blocklisted);...and then calls
__ceph_remove_cap(). Then you could have the ones that set "warn" to false call__ceph_remove_cap()and the others would callceph_remove_cap(). That's at least a little less ugly (and more efficient).
Sure, make sense.
Quoted 2 lines
Alternately, I guess you could try to test what state the session is in and only warn if it's not being force-unmounted?
I will try this later.
Thanks
Quoted 94 lines
Quoted 94 lines
fs/ceph/caps.c +7
-6{struct ceph_mds_session *session = cap->session;struct ceph_inode_info *ci = cap->ci;@@ -1121,7 +1121,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)/* remove from inode's cap rbtree, and clear auth cap */ rb_erase (&cap->ci_node, &ci->i_caps);if (ci->i_auth_cap == cap) { -WARN_ON_ONCE (!list_empty (&ci->i_dirty_item) && +WARN_ON_ONCE (warn && !list_empty (&ci->i_dirty_item) && !mdsc->fsc->blocklisted); ci->i_auth_cap =NULL ; }@@ -1304,7 +1304,7 @@ void __ceph_remove_caps(struct ceph_inode_info *ci)while (p) { struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node); p =rb_next (p); -__ceph_remove_cap (cap, true); +__ceph_remove_cap (cap, true, true); }spin_unlock (&ci->i_ceph_lock); }@@ -3815,7 +3815,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, goto out_unlock;if (target <0 ) { -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }@@ -3850,7 +3850,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,change_auth_cap_ses (ci, tcap->session); } } -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }else if (tsession) {/* add placeholder for the export tagert */ @@ -3867,7 +3867,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,spin_unlock (&mdsc->cap_dirty_lock); } -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, true); goto out_unlock; }@@ -3978,7 +3978,8 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, ocap->mseq, mds,le32_to_cpu (ph->seq), le32_to_cpu(ph->mseq)); } -__ceph_remove_cap (ocap, (ph->flags &CEPH_CAP_FLAG_RELEASE )); +__ceph_remove_cap (ocap, (ph->flags &CEPH_CAP_FLAG_RELEASE ), + true); } *old_issued = issued;fs/ceph/mds_client.c +2
-2@@ -1636,7 +1636,7 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,dout ("removing cap %p, ci is %p, inode is %p\n" , cap, ci, &ci->vfs_inode);spin_lock (&ci->i_ceph_lock); -__ceph_remove_cap (cap, false); +__ceph_remove_cap (cap, false, false);if (!ci->i_auth_cap) {struct ceph_cap_flush *cf;@@ -2008,7 +2008,7 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)if (oissued) {/* we aren't the only cap.. just remove us */ -__ceph_remove_cap (cap, true); +__ceph_remove_cap (cap, true, true); (*remaining)--; }else {struct dentry *dentry;fs/ceph/super.h +2
-1@@ -1142,7 +1142,8 @@ extern void ceph_add_cap(struct inode *inode, unsigned issued, unsigned wanted, unsigned cap, unsigned seq, u64 realmino, int flags, struct ceph_cap **new_cap); -extern void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release); +extern void __ceph_remove_cap (struct ceph_cap *cap,bool queue_release, +bool warn);extern void __ceph_remove_caps (struct ceph_inode_info *ci);extern void ceph_put_cap (struct ceph_mds_client *mdsc,struct ceph_cap *cap);