Whamcloud - gitweb
LU-11605 osp: max_create_count and create_count changes
[fs/lustre-release.git] / lustre / osp / lproc_osp.c
index 59c90e2..75b7f07 100644 (file)
@@ -415,14 +415,17 @@ static ssize_t max_create_count_store(struct kobject *kobj,
        if (rc)
                return rc;
 
-       if (val < 0 || val > INT_MAX)
-               return -ERANGE;
-       if (val > OST_MAX_PRECREATE)
+       if (val && (val < OST_MIN_PRECREATE ||
+                   val > OST_MAX_PRECREATE))
                return -ERANGE;
 
        if (osp->opd_pre_create_count > val)
                osp->opd_pre_create_count = val;
 
+       /* Can be 0 after setting max_create_count to 0 */
+       if (osp->opd_pre_create_count == 0 && val != 0)
+               osp->opd_pre_create_count = OST_MIN_PRECREATE;
+
        osp->opd_pre_max_create_count = val;
 
        return count;