Whamcloud - gitweb
LU-11115 lod: skip max_create_count=0 OST in QoS and RR algorithms 59/32859/2
authorJian Yu <yujian@whamcloud.com>
Mon, 23 Jul 2018 22:00:46 +0000 (15:00 -0700)
committerJohn L. Hammond <jhammond@whamcloud.com>
Thu, 2 Aug 2018 19:25:15 +0000 (19:25 +0000)
While choosing OST to create object, both lod_alloc_qos() and
lod_alloc_rr() functions use lod_statfs_and_check() function
to check whether the OST is available for new OST objects or not.
However, OST with max_create_count=0 is not checked in that
function and just returned as an available OST.

This patch fixes the above issue by detecting OST with
max_create_count=0 in lod_statfs_and_check() and skip it.

Change-Id: Ic2129b483ead16f8971a062e326d5ecd537b7e6c
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/32859
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
lustre/include/lustre/lustre_user.h
lustre/lod/lod_qos.c
lustre/osp/osp_precreate.c

index 1a6b301..c014ed7 100644 (file)
@@ -111,6 +111,7 @@ typedef struct stat64       lstat_t;
 enum obd_statfs_state {
         OS_STATE_DEGRADED       = 0x00000001, /**< RAID degraded/rebuilding */
         OS_STATE_READONLY       = 0x00000002, /**< filesystem is read-only */
+       OS_STATE_NOPRECREATE    = 0x00000004, /**< no object precreation */
        OS_STATE_ENOSPC         = 0x00000020, /**< not enough free space */
        OS_STATE_ENOINO         = 0x00000040, /**< not enough inodes */
 };
index 4a8f9e2..23865c0 100644 (file)
@@ -211,6 +211,10 @@ static int lod_statfs_and_check(const struct lu_env *env, struct lod_device *d,
        if (sfs->os_state & OS_STATE_READONLY)
                rc = -EROFS;
 
+       /* object precreation is skipped on the OST with max_create_count=0 */
+       if (sfs->os_state & OS_STATE_NOPRECREATE)
+               rc = -ENOBUFS;
+
        /* check whether device has changed state (active, inactive) */
        if (rc != 0 && ost->ltd_active) {
                /* turned inactive? */
index cc40e98..3b0460b 100644 (file)
@@ -1033,6 +1033,13 @@ void osp_pre_update_status(struct osp_device *d, int rc)
                               available, d->opd_reserved_mb_low,
                               d->opd_pre_status, rc);
                }
+
+               /* Object precreation is skipped on the OST with
+                * max_create_count=0. */
+               if (d->opd_pre_max_create_count == 0)
+                       msfs->os_state |= OS_STATE_NOPRECREATE;
+               else
+                       msfs->os_state &= ~OS_STATE_NOPRECREATE;
        }
 out:
        wake_up(&d->opd_pre_user_waitq);