Skip to content

Commit

Permalink
orangefs: do not allow client readahead cache without feature bit
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
  • Loading branch information
Martin Brandenburg committed Aug 12, 2016
1 parent 482664d commit c51e012
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
13 changes: 8 additions & 5 deletions fs/orangefs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,11 +624,14 @@ static int orangefs_file_release(struct inode *inode, struct file *file)
if (file->f_path.dentry->d_inode &&
file->f_path.dentry->d_inode->i_mapping &&
mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) {
gossip_debug(GOSSIP_INODE_DEBUG,
"calling flush_racache on %pU\n",
get_khandle_from_ino(inode));
flush_racache(inode);
gossip_debug(GOSSIP_INODE_DEBUG, "flush_racache finished\n");
if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
gossip_debug(GOSSIP_INODE_DEBUG,
"calling flush_racache on %pU\n",
get_khandle_from_ino(inode));
flush_racache(inode);
gossip_debug(GOSSIP_INODE_DEBUG,
"flush_racache finished\n");
}
truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping,
0);
}
Expand Down
19 changes: 19 additions & 0 deletions fs/orangefs/orangefs-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,16 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr)
if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) {
orangefs_attr = (struct orangefs_attribute *)attr;

/* Drop unsupported requests first. */
if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
(!strcmp(orangefs_attr->attr.name, "readahead_count") ||
!strcmp(orangefs_attr->attr.name, "readahead_size") ||
!strcmp(orangefs_attr->attr.name,
"readahead_count_size"))) {
rc = -EINVAL;
goto out;
}

if (!strcmp(orangefs_attr->attr.name, "perf_history_size"))
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE;
Expand Down Expand Up @@ -1133,6 +1143,15 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr)

if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) {
orangefs_attr = (struct orangefs_attribute *)attr;
/* Drop unsupported requests first. */
if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
(!strcmp(orangefs_attr->attr.name, "readahead_count") ||
!strcmp(orangefs_attr->attr.name, "readahead_size") ||
!strcmp(orangefs_attr->attr.name,
"readahead_count_size"))) {
rc = -EINVAL;
goto out;
}

if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) {
if (val > 0) {
Expand Down

0 comments on commit c51e012

Please sign in to comment.