Whamcloud - gitweb
LU-12616 obclass: fix MDS start/stop race
[fs/lustre-release.git] / lustre / osp / lproc_osp.c
index e1d5509..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;
@@ -835,7 +838,7 @@ osp_reserved_mb_high_seq_write(struct file *file, const char __user *buffer,
        __s64                   val;
        int                     rc;
 
-       if (osp == NULL)
+       if (osp == NULL || osp->opd_pre == NULL)
                return -EINVAL;
 
        rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');
@@ -896,7 +899,7 @@ osp_reserved_mb_low_seq_write(struct file *file, const char __user *buffer,
        __s64                   val;
        int                     rc;
 
-       if (osp == NULL)
+       if (osp == NULL || osp->opd_pre == NULL)
                return -EINVAL;
 
        rc = lprocfs_str_with_units_to_s64(buffer, count, &val, 'M');