diff options
author | Martin Brandenburg <martin@omnibond.com> | 2016-08-12 16:12:09 -0400 |
---|---|---|
committer | Martin Brandenburg <martin@omnibond.com> | 2016-08-12 16:12:09 -0400 |
commit | c51e012942a7594f59db5611db14fa4a29624a10 (patch) | |
tree | 04387368dd9e27b999c14c8e292235ac40b106a4 /fs/orangefs | |
parent | 482664ddba81b3a5404fd083bb9697dfffc0b6a4 (diff) |
orangefs: do not allow client readahead cache without feature bit
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r-- | fs/orangefs/file.c | 13 | ||||
-rw-r--r-- | fs/orangefs/orangefs-sysfs.c | 19 |
2 files changed, 27 insertions, 5 deletions
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 43c08b5c7168..fe5e1eac9561 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c | |||
@@ -624,11 +624,14 @@ static int orangefs_file_release(struct inode *inode, struct file *file) | |||
624 | if (file->f_path.dentry->d_inode && | 624 | if (file->f_path.dentry->d_inode && |
625 | file->f_path.dentry->d_inode->i_mapping && | 625 | file->f_path.dentry->d_inode->i_mapping && |
626 | mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) { | 626 | mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) { |
627 | gossip_debug(GOSSIP_INODE_DEBUG, | 627 | if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) { |
628 | "calling flush_racache on %pU\n", | 628 | gossip_debug(GOSSIP_INODE_DEBUG, |
629 | get_khandle_from_ino(inode)); | 629 | "calling flush_racache on %pU\n", |
630 | flush_racache(inode); | 630 | get_khandle_from_ino(inode)); |
631 | gossip_debug(GOSSIP_INODE_DEBUG, "flush_racache finished\n"); | 631 | flush_racache(inode); |
632 | gossip_debug(GOSSIP_INODE_DEBUG, | ||
633 | "flush_racache finished\n"); | ||
634 | } | ||
632 | truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping, | 635 | truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping, |
633 | 0); | 636 | 0); |
634 | } | 637 | } |
diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c index 2fe9a3a2117b..ed5ee33d0f7e 100644 --- a/fs/orangefs/orangefs-sysfs.c +++ b/fs/orangefs/orangefs-sysfs.c | |||
@@ -842,6 +842,16 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) | |||
842 | if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { | 842 | if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { |
843 | orangefs_attr = (struct orangefs_attribute *)attr; | 843 | orangefs_attr = (struct orangefs_attribute *)attr; |
844 | 844 | ||
845 | /* Drop unsupported requests first. */ | ||
846 | if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) && | ||
847 | (!strcmp(orangefs_attr->attr.name, "readahead_count") || | ||
848 | !strcmp(orangefs_attr->attr.name, "readahead_size") || | ||
849 | !strcmp(orangefs_attr->attr.name, | ||
850 | "readahead_count_size"))) { | ||
851 | rc = -EINVAL; | ||
852 | goto out; | ||
853 | } | ||
854 | |||
845 | if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) | 855 | if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) |
846 | new_op->upcall.req.param.op = | 856 | new_op->upcall.req.param.op = |
847 | ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE; | 857 | ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE; |
@@ -1133,6 +1143,15 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
1133 | 1143 | ||
1134 | if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { | 1144 | if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { |
1135 | orangefs_attr = (struct orangefs_attribute *)attr; | 1145 | orangefs_attr = (struct orangefs_attribute *)attr; |
1146 | /* Drop unsupported requests first. */ | ||
1147 | if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) && | ||
1148 | (!strcmp(orangefs_attr->attr.name, "readahead_count") || | ||
1149 | !strcmp(orangefs_attr->attr.name, "readahead_size") || | ||
1150 | !strcmp(orangefs_attr->attr.name, | ||
1151 | "readahead_count_size"))) { | ||
1152 | rc = -EINVAL; | ||
1153 | goto out; | ||
1154 | } | ||
1136 | 1155 | ||
1137 | if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) { | 1156 | if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) { |
1138 | if (val > 0) { | 1157 | if (val > 0) { |