"clear", lprocfs_nid_stats_clear_read,
lprocfs_nid_stats_clear_write, obd, NULL);
rc = lprocfs_alloc_md_stats(obd, LPROC_MDT_LAST);
+ if (rc == 0)
+ mdt_stats_counter_init(obd->md_stats);
RETURN(rc);
}
struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
*eof = 1;
- return snprintf(page, count, "%lu\n",
- mdt->mdt_identity_cache->uc_entry_expire / CFS_HZ);
+ return snprintf(page, count, "%u\n",
+ mdt->mdt_identity_cache->uc_entry_expire);
}
static int lprocfs_wr_identity_expire(struct file *file, const char *buffer,
if (rc)
return rc;
- mdt->mdt_identity_cache->uc_entry_expire = val * CFS_HZ;
+ mdt->mdt_identity_cache->uc_entry_expire = val;
return count;
}
struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
*eof = 1;
- return snprintf(page, count, "%lu\n",
- mdt->mdt_identity_cache->uc_acquire_expire / CFS_HZ);
+ return snprintf(page, count, "%u\n",
+ mdt->mdt_identity_cache->uc_acquire_expire);
}
static int lprocfs_wr_identity_acquire_expire(struct file *file,
if (rc)
return rc;
- mdt->mdt_identity_cache->uc_acquire_expire = val * CFS_HZ;
+ mdt->mdt_identity_cache->uc_acquire_expire = val;
return count;
}
struct obd_device *obd = data;
struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
struct upcall_cache *hash = mdt->mdt_identity_cache;
- char kernbuf[UC_CACHE_UPCALL_MAXPATH] = { '\0' };
+ int rc;
+ char *kernbuf;
if (count >= UC_CACHE_UPCALL_MAXPATH) {
CERROR("%s: identity upcall too long\n", obd->obd_name);
return -EINVAL;
}
-
- if (cfs_copy_from_user(kernbuf, buffer,
- min_t(unsigned long, count,
- UC_CACHE_UPCALL_MAXPATH - 1)))
- return -EFAULT;
+ OBD_ALLOC(kernbuf, count + 1);
+ if (kernbuf == NULL)
+ GOTO(failed, rc = -ENOMEM);
+ if (cfs_copy_from_user(kernbuf, buffer, count))
+ GOTO(failed, rc = -EFAULT);
/* Remove any extraneous bits from the upcall (e.g. linefeeds) */
cfs_write_lock(&hash->uc_upcall_rwlock);
"cause unexpected \"EACCESS\"\n", obd->obd_name);
CWARN("%s: identity upcall set to %s\n", obd->obd_name, hash->uc_upcall);
- return count;
+ OBD_FREE(kernbuf, count + 1);
+ RETURN(count);
+
+ failed:
+ if (kernbuf)
+ OBD_FREE(kernbuf, count + 1);
+ RETURN(rc);
}
static int lprocfs_wr_identity_flush(struct file *file, const char *buffer,
void mdt_counter_incr(struct obd_export *exp, int opcode)
{
- if (exp->exp_obd && exp->exp_obd->obd_stats)
- lprocfs_counter_incr(exp->exp_obd->obd_stats, opcode);
+ if (exp->exp_obd && exp->exp_obd->md_stats)
+ lprocfs_counter_incr(exp->exp_obd->md_stats, opcode);
if (exp->exp_nid_stats && exp->exp_nid_stats->nid_stats != NULL)
lprocfs_counter_incr(exp->exp_nid_stats->nid_stats, opcode);