ENTRY;
CWARN("Starting a LOV/OST update !\n");
- RETURN(ll_process_config_update(sbi, 0));
+ ll_process_config_update(sbi, 0);
+ RETURN(count);
}
static int ll_rd_max_read_ahead_mb(char *page, char **start, off_t off,
struct ll_sb_info *sbi = ll_s2sbi(sb);
down(&sbi->ll_gns_sem);
- snprintf(sbi->ll_gns_upcall, count, "%s", buffer);
- up(&sbi->ll_gns_sem);
+
+ /*
+ * upcall should not be the same as object name, check for possible
+ * overflow.
+ */
+ if (count < sizeof(sbi->ll_gns_upcall) &&
+ (strlen(sbi->ll_gns_oname) != count ||
+ strncmp(sbi->ll_gns_oname, buffer, count)))
+ snprintf(sbi->ll_gns_upcall, count, "%s", buffer);
+ up(&sbi->ll_gns_sem);
return count;
}
struct super_block *sb = (struct super_block *)data;
struct ll_sb_info *sbi = ll_s2sbi(sb);
+ /* checking for setting "." and ".." as object name */
+ if (buffer[0] == '.') switch (count) {
+ case 2:
+ /* this is "." case with terminating zero */
+ return -EINVAL;
+ case 3:
+ /* this is ".." case with terminating zero */
+ if (buffer[1] == '.')
+ return -EINVAL;
+ }
+
down(&sbi->ll_gns_sem);
- snprintf(sbi->ll_gns_oname, count, "%s", buffer);
+
+ /*
+ * upcall should not be the same as object name, check for possible
+ * overflow.
+ */
+ if (count < sizeof(sbi->ll_gns_oname) &&
+ (strlen(sbi->ll_gns_upcall) != count ||
+ strncmp(sbi->ll_gns_upcall, buffer, count)))
+ snprintf(sbi->ll_gns_oname, count, "%s", buffer);
+
up(&sbi->ll_gns_sem);
-
return count;
}
return rc;
down(&sbi->ll_gns_sem);
- sbi->ll_gns_timeout = val;
+ if (val > sbi->ll_gns_tick)
+ sbi->ll_gns_timeout = val;
up(&sbi->ll_gns_sem);
return count;
return rc;
down(&sbi->ll_gns_sem);
- if (sbi->ll_gns_tick < sbi->ll_gns_timeout)
+ if (val < sbi->ll_gns_timeout)
sbi->ll_gns_tick = val;
up(&sbi->ll_gns_sem);
return count;
}
+
+static int ll_rd_gns_enabled(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct super_block *sb = (struct super_block *)data;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+ return snprintf(page, count, "%d\n",
+ atomic_read(&sbi->ll_gns_enabled));
+}
+
+static int ll_wr_gns_enabled(struct file *file, const char *buffer,
+ unsigned long count, void *data)
+{
+ struct super_block *sb = (struct super_block *)data;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ int val, rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ atomic_set(&sbi->ll_gns_enabled, (val != 0 ? 1 : 0));
+ return count;
+}
+
static struct lprocfs_vars lprocfs_obd_vars[] = {
{ "uuid", ll_rd_sb_uuid, 0, 0 },
//{ "mntpt_path", ll_rd_path, 0, 0 },
{ "gns_tick", ll_rd_gns_tick,
ll_wr_gns_tick, 0 },
+ { "gns_enabled", ll_rd_gns_enabled,
+ ll_wr_gns_enabled, 0 },
+
{ "gns_object_name", ll_rd_gns_object_name,
ll_wr_gns_object_name, 0 },