(unsigned long)mds->mds_num);
}
+static int lprocfs_rd_capa(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ LASSERT(obd != NULL);
+
+ return snprintf(page, count, "%d\n",
+ obd->u.mds.mds_capa_stat);
+}
+
+static int lprocfs_wr_capa(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ mds_update_capa_stat(obd, val);
+ return count;
+}
+
+static int lprocfs_rd_capa_timeout(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ LASSERT(obd != NULL);
+
+ return snprintf(page, count, "%lu\n",
+ obd->u.mds.mds_capa_timeout);
+}
+
+static int lprocfs_wr_capa_timeout(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ mds_update_capa_timeout(obd, val);
+ return count;
+}
+
+static int lprocfs_rd_capa_key_timeout(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+ LASSERT(obd != NULL);
+
+ return snprintf(page, count, "%lu\n",
+ obd->u.mds.mds_capa_key_timeout);
+}
+
+static int lprocfs_wr_capa_key_timeout(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct obd_device *obd = data;
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ rc = mds_update_capa_key_timeout(obd, val);
+ return rc ?: count;
+}
+
struct lprocfs_vars lprocfs_mds_obd_vars[] = {
{ "uuid", lprocfs_rd_uuid, 0, 0 },
{ "blocksize", lprocfs_rd_blksize, 0, 0 },
{ "mntdev", lprocfs_mds_rd_mntdev, 0, 0 },
{ "last_fid", lprocfs_rd_last_fid, 0, 0 },
{ "group", lprocfs_rd_group, 0, 0 },
- { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 },
- { "evict_client", 0, lprocfs_mds_wr_evict_client, 0 },
+ { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 },
+ { "evict_client", 0, lprocfs_mds_wr_evict_client, 0 },
{ "config_update", 0, lprocfs_mds_wr_config_update, 0 },
- { "num_exports", lprocfs_rd_num_exports, 0, 0 },
+ { "num_exports", lprocfs_rd_num_exports, 0, 0 },
+ { "capa", lprocfs_rd_capa,
+ lprocfs_wr_capa, 0 },
+ { "capa_timeout", lprocfs_rd_capa_timeout,
+ lprocfs_wr_capa_timeout, 0 },
+ { "capa_key_timeout", lprocfs_rd_capa_key_timeout,
+ lprocfs_wr_capa_key_timeout, 0 },
{ 0 }
};
if (count != sizeof(param)) {
CERROR("invalid data size %lu\n", count);
- return count;
+ goto do_err_downcall;
}
if (copy_from_user(¶m, buffer, count)) {
CERROR("broken downcall\n");
- return count;
+ goto do_err_downcall;
}
if (param.err) {
}
if (param.ngroups > NGROUPS_MAX) {
- CERROR("%d groups?\n", param.ngroups);
- param.err = -EINVAL;
- goto do_downcall;
+ CERROR("%d groups too big\n", param.ngroups);
+ goto do_err_downcall;
}
if (param.ngroups <= NGROUPS_SMALL)
if (!gids) {
CERROR("fail to alloc memory for %d gids\n",
param.ngroups);
- param.err = -ENOMEM;
- goto do_downcall;
+ goto do_err_downcall;
}
}
if (copy_from_user(gids, param.groups,
param.ngroups * sizeof(gid_t))) {
CERROR("broken downcall\n");
- param.err = -EFAULT;
- goto do_downcall;
+ goto do_err_downcall;
}
param.groups = gids;
do_downcall:
- upcall_cache_downcall(cache, (__u64) param.uid, param.err, ¶m);
+ upcall_cache_downcall(cache, (__u64) param.uid, ¶m);
if (gids && gids != gids_local)
OBD_FREE(gids, param.ngroups * sizeof(gid_t));
return count;
+
+do_err_downcall:
+ param.err = -EINVAL;
+ goto do_downcall;
}
static int lprocfs_rd_lsd_expire(char *page, char **start, off_t off, int count,
return count;
}
+/*
+ * remote acl proc handling
+ */
+static int lprocfs_rd_lacl_upcall(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct upcall_cache *cache = __mds_get_global_rmtacl_upcall_cache();
+
+ *eof = 1;
+ return snprintf(page, count, "%s\n", cache->uc_upcall);
+}
+
+static int lprocfs_wr_lacl_upcall(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct upcall_cache *cache = __mds_get_global_rmtacl_upcall_cache();
+
+ if (count < UC_CACHE_UPCALL_MAXPATH) {
+ sscanf(buffer, "%1024s", cache->uc_upcall);
+ cache->uc_upcall[UC_CACHE_UPCALL_MAXPATH - 1] = 0;
+ }
+ return count;
+}
+
+static int lprocfs_wr_lacl_downcall(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct upcall_cache *cache = __mds_get_global_rmtacl_upcall_cache();
+ struct rmtacl_downcall_args param;
+
+ if (count != sizeof(param)) {
+ CERROR("invalid data size %lu\n", count);
+ goto do_err_downcall;
+ }
+ if (copy_from_user(¶m, buffer, count)) {
+ CERROR("broken downcall\n");
+ goto do_err_downcall;
+ }
+
+do_downcall:
+ upcall_cache_downcall(cache, param.key, ¶m);
+ return count;
+
+do_err_downcall:
+ memset(¶m, 0, sizeof(param));
+ param.status = -EINVAL;
+ goto do_downcall;
+}
+
struct lprocfs_vars lprocfs_mds_module_vars[] = {
{ "num_refs", lprocfs_rd_numrefs, 0, 0 },
/* LSD stuff */
lprocfs_wr_lsd_upcall, 0},
{ "lsd_flush", 0, lprocfs_wr_lsd_flush, 0},
{ "lsd_downcall", 0, lprocfs_wr_lsd_downcall, 0},
+ /* remote acl */
+ { "lacl_upcall", lprocfs_rd_lacl_upcall,
+ lprocfs_wr_lacl_upcall, 0},
+ { "lacl_downcall", 0, lprocfs_wr_lacl_downcall, 0},
{ 0 }
};