osp_active_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
+ struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
- int val, rc;
+ int rc;
+ __s64 val;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
if (val < 0 || val > 1)
if (dev->u.cli.cl_import->imp_deactive == val)
rc = ptlrpc_set_import_active(dev->u.cli.cl_import, val);
else
- CDEBUG(D_CONFIG, "activate %d: ignoring repeat request\n",
+ CDEBUG(D_CONFIG, "activate "LPD64": ignoring repeat request\n",
val);
LPROCFS_CLIMP_EXIT(dev);
if (osp == NULL)
return -EINVAL;
- seq_printf(m, "%u\n", osp->opd_syn_rpc_in_flight);
+ seq_printf(m, "%u\n", atomic_read(&osp->opd_syn_rpc_in_flight));
return 0;
}
LPROC_SEQ_FOPS_RO(osp_syn_in_flight);
if (osp == NULL)
return -EINVAL;
- seq_printf(m, "%u\n", osp->opd_syn_rpc_in_progress);
+ seq_printf(m, "%u\n", atomic_read(&osp->opd_syn_rpc_in_progress));
return 0;
}
LPROC_SEQ_FOPS_RO(osp_syn_in_prog);
if (osp == NULL)
return -EINVAL;
- seq_printf(m, "%lu\n", osp->opd_syn_changes);
+ seq_printf(m, "%u\n", atomic_read(&osp->opd_syn_changes));
return 0;
}
osp_max_rpcs_in_flight_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *dev = m->private;
- struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
- int val, rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *dev = m->private;
+ struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
+ int rc;
+ __s64 val;
if (osp == NULL)
return -EINVAL;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
- if (val < 1)
+ if (val < 1 || val > INT_MAX)
return -ERANGE;
osp->opd_syn_max_rpc_in_flight = val;
osp_max_rpcs_in_prog_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *dev = m->private;
- struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
- int val, rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *dev = m->private;
+ struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
+ int rc;
+ __s64 val;
if (osp == NULL)
return -EINVAL;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
- if (val < 1)
+ if (val < 1 || val > INT_MAX)
return -ERANGE;
osp->opd_syn_max_rpc_in_progress = val;
osp_create_count_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
- int val, rc, i;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
+ int rc, i;
+ __s64 val;
if (osp == NULL || osp->opd_pre == NULL)
return 0;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
osp_max_create_count_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *obd = m->private;
- struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
- int val, rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct osp_device *osp = lu2osp_dev(obd->obd_lu_dev);
+ int rc;
+ __s64 val;
if (osp == NULL || osp->opd_pre == NULL)
return 0;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
- if (val < 0)
+ if (val < 0 || val > INT_MAX)
return -ERANGE;
if (val > OST_MAX_PRECREATE)
return -ERANGE;
osp_maxage_seq_write(struct file *file, const char __user *buffer,
size_t count, loff_t *off)
{
- struct seq_file *m = file->private_data;
- struct obd_device *dev = m->private;
- struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
- int val, rc;
+ struct seq_file *m = file->private_data;
+ struct obd_device *dev = m->private;
+ struct osp_device *osp = lu2osp_dev(dev->obd_lu_dev);
+ int rc;
+ __s64 val;
if (osp == NULL)
return -EINVAL;
- rc = lprocfs_write_helper(buffer, count, &val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
if (rc)
return rc;
- if (val < 1)
+ if (val < 1 || val > INT_MAX)
return -ERANGE;
osp->opd_statfs_maxage = val;
if (osp == NULL)
return -EINVAL;
- seq_printf(m, "%lu\n",
- osp->opd_syn_rpc_in_progress + osp->opd_syn_changes);
+ seq_printf(m, "%u\n",
+ atomic_read(&osp->opd_syn_rpc_in_progress) +
+ atomic_read(&osp->opd_syn_changes));
return 0;
}
LPROC_SEQ_FOPS_RO(osp_destroys_in_flight);
{
struct seq_file *m = file->private_data;
struct obd_device *dev = m->private;
- int val;
+ __s64 val;
int rc;
- rc = lprocfs_write_helper(buffer, count, &val);
- if (rc == 0)
- rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
+ rc = lprocfs_str_to_s64(buffer, count, &val);
+ if (rc == 0) {
+ if (val < 0)
+ return -ERANGE;
- if (rc != 0)
+ rc = obd_set_max_rpcs_in_flight(&dev->u.cli, val);
+ } else {
count = rc;
+ }
return count;
}