@@ -2016,6 +2016,8 @@ bool __ceph_should_report_size(struct ceph_inode_info *ci)
2016
2016
* CHECK_CAPS_AUTHONLY - we should only check the auth cap
2017
2017
* CHECK_CAPS_FLUSH - we should flush any dirty caps immediately, without
2018
2018
* further delay.
2019
+ * CHECK_CAPS_FLUSH_FORCE - we should flush any caps immediately, without
2020
+ * further delay.
2019
2021
*/
2020
2022
void ceph_check_caps (struct ceph_inode_info * ci , int flags )
2021
2023
{
@@ -2097,15 +2099,16 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags)
2097
2099
}
2098
2100
2099
2101
doutc (cl , "%p %llx.%llx file_want %s used %s dirty %s "
2100
- "flushing %s issued %s revoking %s retain %s %s%s%s\n" ,
2102
+ "flushing %s issued %s revoking %s retain %s %s%s%s%s \n" ,
2101
2103
inode , ceph_vinop (inode ), ceph_cap_string (file_wanted ),
2102
2104
ceph_cap_string (used ), ceph_cap_string (ci -> i_dirty_caps ),
2103
2105
ceph_cap_string (ci -> i_flushing_caps ),
2104
2106
ceph_cap_string (issued ), ceph_cap_string (revoking ),
2105
2107
ceph_cap_string (retain ),
2106
2108
(flags & CHECK_CAPS_AUTHONLY ) ? " AUTHONLY" : "" ,
2107
2109
(flags & CHECK_CAPS_FLUSH ) ? " FLUSH" : "" ,
2108
- (flags & CHECK_CAPS_NOINVAL ) ? " NOINVAL" : "" );
2110
+ (flags & CHECK_CAPS_NOINVAL ) ? " NOINVAL" : "" ,
2111
+ (flags & CHECK_CAPS_FLUSH_FORCE ) ? " FLUSH_FORCE" : "" );
2109
2112
2110
2113
/*
2111
2114
* If we no longer need to hold onto old our caps, and we may
@@ -2180,6 +2183,11 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags)
2180
2183
queue_writeback = true;
2181
2184
}
2182
2185
2186
+ if (flags & CHECK_CAPS_FLUSH_FORCE ) {
2187
+ doutc (cl , "force to flush caps\n" );
2188
+ goto ack ;
2189
+ }
2190
+
2183
2191
if (cap == ci -> i_auth_cap &&
2184
2192
(cap -> issued & CEPH_CAP_FILE_WR )) {
2185
2193
/* request larger max_size from MDS? */
@@ -3510,6 +3518,8 @@ static void handle_cap_grant(struct inode *inode,
3510
3518
bool queue_invalidate = false;
3511
3519
bool deleted_inode = false;
3512
3520
bool fill_inline = false;
3521
+ bool revoke_wait = false;
3522
+ int flags = 0 ;
3513
3523
3514
3524
/*
3515
3525
* If there is at least one crypto block then we'll trust
@@ -3705,16 +3715,18 @@ static void handle_cap_grant(struct inode *inode,
3705
3715
ceph_cap_string (cap -> issued ), ceph_cap_string (newcaps ),
3706
3716
ceph_cap_string (revoking ));
3707
3717
if (S_ISREG (inode -> i_mode ) &&
3708
- (revoking & used & CEPH_CAP_FILE_BUFFER ))
3718
+ (revoking & used & CEPH_CAP_FILE_BUFFER )) {
3709
3719
writeback = true; /* initiate writeback; will delay ack */
3710
- else if (queue_invalidate &&
3720
+ revoke_wait = true;
3721
+ } else if (queue_invalidate &&
3711
3722
revoking == CEPH_CAP_FILE_CACHE &&
3712
- (newcaps & CEPH_CAP_FILE_LAZYIO ) == 0 )
3713
- ; /* do nothing yet, invalidation will be queued */
3714
- else if (cap == ci -> i_auth_cap )
3723
+ (newcaps & CEPH_CAP_FILE_LAZYIO ) == 0 ) {
3724
+ revoke_wait = true ; /* do nothing yet, invalidation will be queued */
3725
+ } else if (cap == ci -> i_auth_cap ) {
3715
3726
check_caps = 1 ; /* check auth cap only */
3716
- else
3727
+ } else {
3717
3728
check_caps = 2 ; /* check all caps */
3729
+ }
3718
3730
/* If there is new caps, try to wake up the waiters */
3719
3731
if (~cap -> issued & newcaps )
3720
3732
wake = true;
@@ -3741,8 +3753,9 @@ static void handle_cap_grant(struct inode *inode,
3741
3753
BUG_ON (cap -> issued & ~cap -> implemented );
3742
3754
3743
3755
/* don't let check_caps skip sending a response to MDS for revoke msgs */
3744
- if (le32_to_cpu (grant -> op ) == CEPH_CAP_OP_REVOKE ) {
3756
+ if (! revoke_wait && le32_to_cpu (grant -> op ) == CEPH_CAP_OP_REVOKE ) {
3745
3757
cap -> mds_wanted = 0 ;
3758
+ flags |= CHECK_CAPS_FLUSH_FORCE ;
3746
3759
if (cap == ci -> i_auth_cap )
3747
3760
check_caps = 1 ; /* check auth cap only */
3748
3761
else
@@ -3798,9 +3811,9 @@ static void handle_cap_grant(struct inode *inode,
3798
3811
3799
3812
mutex_unlock (& session -> s_mutex );
3800
3813
if (check_caps == 1 )
3801
- ceph_check_caps (ci , CHECK_CAPS_AUTHONLY | CHECK_CAPS_NOINVAL );
3814
+ ceph_check_caps (ci , flags | CHECK_CAPS_AUTHONLY | CHECK_CAPS_NOINVAL );
3802
3815
else if (check_caps == 2 )
3803
- ceph_check_caps (ci , CHECK_CAPS_NOINVAL );
3816
+ ceph_check_caps (ci , flags | CHECK_CAPS_NOINVAL );
3804
3817
}
3805
3818
3806
3819
/*
0 commit comments