Whamcloud - gitweb
LU-17272 osc: check cl_dirty_max_pages 37/53037/4
authorHongchao Zhang <hongchao@whamcloud.com>
Wed, 26 Jun 2024 06:56:26 +0000 (14:56 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Aug 2024 21:56:48 +0000 (21:56 +0000)
In osc_queue_sync_pages, the client_obd->cl_dirty_max_pages
should also be checked along with the grant check.

Signed-off-by: Hongchao Zhang <hongchao@whamcloud.com>
Change-Id: I3d22fdcf6d8ea99b48bc1f42e7b686ab4ba0e1f0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53037
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <patrick.farrell@oracle.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osc/osc_cache.c

index c4c13f4..b884c00 100644 (file)
@@ -2611,7 +2611,9 @@ int osc_queue_sync_pages(const struct lu_env *env, struct cl_io *io,
 
                CDEBUG(D_CACHE, "requesting %d bytes grant\n", grants);
                spin_lock(&cli->cl_loi_list_lock);
-               if (osc_reserve_grant(cli, grants) == 0) {
+               if (osc_reserve_grant(cli, grants) == 0 &&
+                   cli->cl_dirty_pages + page_count <
+                                                   cli->cl_dirty_max_pages) {
                        list_for_each_entry(oap, list, oap_pending_item) {
                                osc_consume_write_grant(cli,
                                                        &oap->oap_brw_page);
@@ -2622,12 +2624,12 @@ int osc_queue_sync_pages(const struct lu_env *env, struct cl_io *io,
                } else {
                        /* We cannot report ENOSPC correctly if we do parallel
                         * DIO (async RPC submission), so turn off parallel dio
-                        * if there is not sufficient grant available.  This
-                        * makes individual RPCs synchronous.
+                        * if there is not sufficient grant or dirty pages
+                        * available. This makes individual RPCs synchronous.
                         */
                        io->ci_parallel_dio = false;
                        CDEBUG(D_CACHE,
-                       "not enough grant available, switching to sync for this i/o\n");
+                       "not enough grant or dirty pages available, switching to sync for this i/o\n");
                }
                spin_unlock(&cli->cl_loi_list_lock);
                osc_update_next_shrink(cli);