On Wed, Oct 25, 2023 at 8:22 AM <xiubli@xxxxxxxxxx> wrote: > > From: Xiubo Li <xiubli@xxxxxxxxxx> > > When unlinking a file the check caps could be delayed for more than > 5 seconds, but in MDS side it maybe waiting for the clients to > release caps. > > This will add a dedicated work queue and list to help trigger to > fire the check caps and dirty buffer flushing immediately. > > URL: https://tracker.ceph.com/issues/50223 > Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx> > --- > fs/ceph/caps.c | 17 ++++++++++++++++- > fs/ceph/mds_client.c | 34 ++++++++++++++++++++++++++++++++++ > fs/ceph/mds_client.h | 4 ++++ > 3 files changed, 54 insertions(+), 1 deletion(-) > > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c > index 9b9ec1adc19d..be4f986e082d 100644 > --- a/fs/ceph/caps.c > +++ b/fs/ceph/caps.c > @@ -4790,7 +4790,22 @@ int ceph_drop_caps_for_unlink(struct inode *inode) > if (__ceph_caps_dirty(ci)) { > struct ceph_mds_client *mdsc = > ceph_inode_to_fs_client(inode)->mdsc; > - __cap_delay_requeue_front(mdsc, ci); > + > + doutc(mdsc->fsc->client, "%p %llx.%llx\n", inode, > + ceph_vinop(inode)); > + spin_lock(&mdsc->cap_unlink_delay_lock); > + ci->i_ceph_flags |= CEPH_I_FLUSH; > + if (!list_empty(&ci->i_cap_delay_list)) > + list_del_init(&ci->i_cap_delay_list); > + list_add_tail(&ci->i_cap_delay_list, > + &mdsc->cap_unlink_delay_list); > + spin_unlock(&mdsc->cap_unlink_delay_lock); > + > + /* > + * Fire the work immediately, because the MDS maybe > + * waiting for caps release. > + */ > + schedule_work(&mdsc->cap_unlink_work); Hi Xiubo, This schedules a work an a system-wide workqueue, not specific to CephFS. Is there something that ensures that it gets flushed as part of unmount and possibly on other occasions that have to do with individual inodes? Thanks, Ilya