Whamcloud - gitweb
LU-13998 tests: sanityn test_104 incorrect MDT times shown
[fs/lustre-release.git] / lustre / osd-zfs / osd_lproc.c
index e84ed46..c91ccf4 100644 (file)
@@ -387,18 +387,24 @@ zfs_osd_readcache_seq_write(struct file *file, const char __user *buffer,
        struct seq_file *m = file->private_data;
        struct dt_device *dt = m->private;
        struct osd_device *osd = osd_dt_dev(dt);
-       s64 val;
+       char kernbuf[22] = "";
+       u64 val;
        int rc;
 
        LASSERT(osd != NULL);
        if (unlikely(osd->od_os == NULL))
                return -EINPROGRESS;
 
-       rc = lprocfs_str_with_units_to_s64(buffer, count, &val, '1');
-       if (rc)
+       if (count >= sizeof(kernbuf))
+               return -EINVAL;
+
+       if (copy_from_user(kernbuf, buffer, count))
+               return -EFAULT;
+       kernbuf[count] = 0;
+
+       rc = sysfs_memparse(kernbuf, count, &val, "B");
+       if (rc < 0)
                return rc;
-       if (val < 0)
-               return -ERANGE;
 
        osd->od_readcache_max_filesize = val > OSD_MAX_CACHE_SIZE ?
                                         OSD_MAX_CACHE_SIZE : val;
@@ -416,7 +422,7 @@ static struct attribute *zfs_attrs[] = {
        NULL,
 };
 
-struct lprocfs_vars lprocfs_osd_obd_vars[] = {
+struct ldebugfs_vars ldebugfs_osd_obd_vars[] = {
        { .name =       "oi_scrub",
          .fops =       &zfs_osd_oi_scrub_fops          },
        { .name =       "readcache_max_filesize",
@@ -439,9 +445,12 @@ int osd_procfs_init(struct osd_device *osd, const char *name)
        LASSERT(type);
        LASSERT(name);
 
+       /* put reference taken by class_search_type */
+       kobject_put(&type->typ_kobj);
+
        osd->od_dt_dev.dd_ktype.default_attrs = zfs_attrs;
        rc = dt_tunables_init(&osd->od_dt_dev, type, name,
-                             lprocfs_osd_obd_vars);
+                             ldebugfs_osd_obd_vars);
        if (rc) {
                CERROR("%s: cannot setup sysfs / debugfs entry: %d\n",
                       name, rc);