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,
lprocfs_counter_init(stats, LPROC_MDT_MKDIR, 0, "mkdir", "reqs");
lprocfs_counter_init(stats, LPROC_MDT_RMDIR, 0, "rmdir", "reqs");
lprocfs_counter_init(stats, LPROC_MDT_RENAME, 0, "rename", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_GETATTR, 0, "getattr", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_SETATTR, 0, "setattr", "reqs");
lprocfs_counter_init(stats, LPROC_MDT_GETXATTR, 0, "getxattr", "reqs");
lprocfs_counter_init(stats, LPROC_MDT_SETXATTR, 0, "setxattr", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_STATFS, 0, "statfs", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_SYNC, 0, "sync", "reqs");
}