@@ -313,7 +313,7 @@ int ceph_renew_caps(struct inode *inode, int fmode)
313313 spin_unlock (& ci -> i_ceph_lock );
314314 dout ("renew caps %p want %s issued %s updating mds_wanted\n" ,
315315 inode , ceph_cap_string (wanted ), ceph_cap_string (issued ));
316- ceph_check_caps (ci , 0 , NULL );
316+ ceph_check_caps (ci , 0 );
317317 return 0 ;
318318 }
319319 spin_unlock (& ci -> i_ceph_lock );
@@ -408,7 +408,7 @@ int ceph_open(struct inode *inode, struct file *file)
408408 if ((issued & wanted ) != wanted &&
409409 (mds_wanted & wanted ) != wanted &&
410410 ceph_snap (inode ) != CEPH_SNAPDIR )
411- ceph_check_caps (ci , 0 , NULL );
411+ ceph_check_caps (ci , 0 );
412412
413413 return ceph_init_file (inode , file , fmode );
414414 } else if (ceph_snap (inode ) != CEPH_NOSNAP &&
@@ -534,14 +534,23 @@ static void wake_async_create_waiters(struct inode *inode,
534534 struct ceph_mds_session * session )
535535{
536536 struct ceph_inode_info * ci = ceph_inode (inode );
537+ bool check_cap = false;
537538
538539 spin_lock (& ci -> i_ceph_lock );
539540 if (ci -> i_ceph_flags & CEPH_I_ASYNC_CREATE ) {
540541 ci -> i_ceph_flags &= ~CEPH_I_ASYNC_CREATE ;
541542 wake_up_bit (& ci -> i_ceph_flags , CEPH_ASYNC_CREATE_BIT );
543+
544+ if (ci -> i_ceph_flags & CEPH_I_ASYNC_CHECK_CAPS ) {
545+ ci -> i_ceph_flags &= ~CEPH_I_ASYNC_CHECK_CAPS ;
546+ check_cap = true;
547+ }
542548 }
543549 ceph_kick_flushing_inode_caps (session , ci );
544550 spin_unlock (& ci -> i_ceph_lock );
551+
552+ if (check_cap )
553+ ceph_check_caps (ci , CHECK_CAPS_FLUSH );
545554}
546555
547556static void ceph_async_create_cb (struct ceph_mds_client * mdsc ,
@@ -1092,7 +1101,7 @@ static void ceph_aio_complete(struct inode *inode,
10921101 loff_t endoff = aio_req -> iocb -> ki_pos + aio_req -> total_len ;
10931102 if (endoff > i_size_read (inode )) {
10941103 if (ceph_inode_set_size (inode , endoff ))
1095- ceph_check_caps (ci , CHECK_CAPS_AUTHONLY , NULL );
1104+ ceph_check_caps (ci , CHECK_CAPS_AUTHONLY );
10961105 }
10971106
10981107 spin_lock (& ci -> i_ceph_lock );
@@ -1421,8 +1430,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
14211430 if (write && pos > size ) {
14221431 if (ceph_inode_set_size (inode , pos ))
14231432 ceph_check_caps (ceph_inode (inode ),
1424- CHECK_CAPS_AUTHONLY ,
1425- NULL );
1433+ CHECK_CAPS_AUTHONLY );
14261434 }
14271435 }
14281436
@@ -1577,8 +1585,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
15771585 check_caps = ceph_inode_set_size (inode , pos );
15781586 if (check_caps )
15791587 ceph_check_caps (ceph_inode (inode ),
1580- CHECK_CAPS_AUTHONLY ,
1581- NULL );
1588+ CHECK_CAPS_AUTHONLY );
15821589 }
15831590
15841591 }
@@ -1906,7 +1913,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
19061913 if (dirty )
19071914 __mark_inode_dirty (inode , dirty );
19081915 if (ceph_quota_is_max_bytes_approaching (inode , iocb -> ki_pos ))
1909- ceph_check_caps (ci , CHECK_CAPS_FLUSH , NULL );
1916+ ceph_check_caps (ci , CHECK_CAPS_FLUSH );
19101917 }
19111918
19121919 dout ("aio_write %p %llx.%llx %llu~%u dropping cap refs on %s\n" ,
@@ -2521,8 +2528,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
25212528 /* Let the MDS know about dst file size change */
25222529 if (ceph_inode_set_size (dst_inode , dst_off ) ||
25232530 ceph_quota_is_max_bytes_approaching (dst_inode , dst_off ))
2524- ceph_check_caps (dst_ci , CHECK_CAPS_AUTHONLY | CHECK_CAPS_FLUSH ,
2525- NULL );
2531+ ceph_check_caps (dst_ci , CHECK_CAPS_AUTHONLY | CHECK_CAPS_FLUSH );
25262532 }
25272533 /* Mark Fw dirty */
25282534 spin_lock (& dst_ci -> i_ceph_lock );
0 commit comments