Skip to content

Commit

Permalink
ceph: defer stopping mdsc delayed_work
Browse files Browse the repository at this point in the history
commit e7e607b upstream.

Flushing the dirty buffer may take a long time if the cluster is
overloaded or if there is network issue. So we should ping the
MDSs periodically to keep alive, else the MDS will blocklist
the kclient.

Cc: stable@vger.kernel.org
Link: https://tracker.ceph.com/issues/61843
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Milind Changire <mchangir@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
lxbsz authored and gregkh committed Aug 11, 2023
1 parent ad82aac commit a062da5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -4758,7 +4758,7 @@ static void delayed_work(struct work_struct *work)

dout("mdsc delayed_work\n");

if (mdsc->stopping)
if (mdsc->stopping >= CEPH_MDSC_STOPPING_FLUSHED)
return;

mutex_lock(&mdsc->mutex);
Expand Down Expand Up @@ -4937,7 +4937,7 @@ void send_flush_mdlog(struct ceph_mds_session *s)
void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc)
{
dout("pre_umount\n");
mdsc->stopping = 1;
mdsc->stopping = CEPH_MDSC_STOPPING_BEGIN;

ceph_mdsc_iterate_sessions(mdsc, send_flush_mdlog, true);
ceph_mdsc_iterate_sessions(mdsc, lock_unlock_session, false);
Expand Down
5 changes: 5 additions & 0 deletions fs/ceph/mds_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ struct cap_wait {
int want;
};

enum {
CEPH_MDSC_STOPPING_BEGIN = 1,
CEPH_MDSC_STOPPING_FLUSHED = 2,
};

/*
* mds client state
*/
Expand Down
10 changes: 10 additions & 0 deletions fs/ceph/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,16 @@ static void ceph_kill_sb(struct super_block *s)
ceph_mdsc_pre_umount(fsc->mdsc);
flush_fs_workqueues(fsc);

/*
* Though the kill_anon_super() will finally trigger the
* sync_filesystem() anyway, we still need to do it here
* and then bump the stage of shutdown to stop the work
* queue as earlier as possible.
*/
sync_filesystem(s);

fsc->mdsc->stopping = CEPH_MDSC_STOPPING_FLUSHED;

kill_anon_super(s);

fsc->client->extra_mon_dispatch = NULL;
Expand Down

0 comments on commit a062da5

Please sign in to comment.