summaryrefslogtreecommitdiff
path: root/fs/orangefs
diff options
context:
space:
mode:
authorMartin Brandenburg <martin@omnibond.com>2016-08-12 23:12:09 +0300
committerMartin Brandenburg <martin@omnibond.com>2016-08-12 23:12:09 +0300
commitc51e012942a7594f59db5611db14fa4a29624a10 (patch)
tree04387368dd9e27b999c14c8e292235ac40b106a4 /fs/orangefs
parent482664ddba81b3a5404fd083bb9697dfffc0b6a4 (diff)
downloadlinux-c51e012942a7594f59db5611db14fa4a29624a10.tar.xz
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.c13
-rw-r--r--fs/orangefs/orangefs-sysfs.c19
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)
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);
}
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)
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;
@@ -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) {