Skip to content

Commit 68c62be

Browse files
lxbszidryomov
authored andcommitted
ceph: try to check caps immediately after async creating finishes
We should call the check_caps() again immediately after the async creating finishes in case the MDS is waiting for caps revocation to finish. Link: https://tracker.ceph.com/issues/46904 Signed-off-by: Xiubo Li <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent e4b731c commit 68c62be

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

fs/ceph/caps.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,8 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags)
19161916

19171917
spin_lock(&ci->i_ceph_lock);
19181918
if (ci->i_ceph_flags & CEPH_I_ASYNC_CREATE) {
1919+
ci->i_ceph_flags |= CEPH_I_ASYNC_CHECK_CAPS;
1920+
19191921
/* Don't send messages until we get async create reply */
19201922
spin_unlock(&ci->i_ceph_lock);
19211923
return;

fs/ceph/file.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

547556
static void ceph_async_create_cb(struct ceph_mds_client *mdsc,

fs/ceph/super.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,8 @@ static inline struct inode *ceph_find_inode(struct super_block *sb,
593593
#define CEPH_ASYNC_CREATE_BIT (12) /* async create in flight for this */
594594
#define CEPH_I_ASYNC_CREATE (1 << CEPH_ASYNC_CREATE_BIT)
595595
#define CEPH_I_SHUTDOWN (1 << 13) /* inode is no longer usable */
596+
#define CEPH_I_ASYNC_CHECK_CAPS (1 << 14) /* check caps immediately after async
597+
creating finishes */
596598

597599
/*
598600
* Masks of ceph inode work.

0 commit comments

Comments
 (0)