Whamcloud - gitweb
LU-10776 osc: Do not request more than 2GiB grant
[fs/lustre-release.git] / lustre / target / tgt_grant.c
index 659afb3..8465052 100644 (file)
@@ -894,9 +894,10 @@ static long tgt_grant_alloc(struct obd_export *exp, u64 curgrant,
             tgd->tgd_grant_compat_disable) || left == 0 || exp->exp_failed)
                RETURN(0);
 
-       if (want > 0x7fffffff) {
-               CERROR("%s: client %s/%p requesting > 2GB grant %llu\n",
-                      obd->obd_name, exp->exp_client_uuid.uuid, exp, want);
+       if (want > OBD_MAX_GRANT) {
+               CERROR("%s: client %s/%p requesting > max (%lu), %llu\n",
+                      obd->obd_name, exp->exp_client_uuid.uuid, exp,
+                      OBD_MAX_GRANT, want);
                RETURN(0);
        }
 
@@ -1629,17 +1630,14 @@ ssize_t tgt_grant_compat_disable_seq_write(struct file *file,
        struct seq_file *m = file->private_data;
        struct obd_device *obd = m->private;
        struct tg_grants_data *tgd = &obd->u.obt.obt_lut->lut_tgd;
-       __s64 val;
+       bool val;
        int rc;
 
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = kstrtobool_from_user(buffer, count, &val);
        if (rc)
                return rc;
 
-       if (val < 0)
-               return -EINVAL;
-
-       tgd->tgd_grant_compat_disable = !!val;
+       tgd->tgd_grant_compat_disable = val;
 
        return count;
 }