orangefs: cleanups, a protocol fix and an added configuration button.

Cleanups:
 
   1. silence harmless integer overflow warning (from dan.carpenter@oracle.com)
 
   2. Dan Carpenter influenced debugfs cleanups.
 
   3. Remove orangefs_backing_dev_info (from jack@suse.cz)
 
 Protocol fix:
 
   fix buffer size mis-match between kernel space and user space.
 
 New configuration button:
 
   Support readahead_readcnt parameter.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJYsa1qAAoJEM9EDqnrzg2+xi0QAJ5iWgkostWk2lK+7qz/4pVr
 WduQt5UQabC4pb0ArgN891zAJmea2tYO9cf9D+Hx0tpH3vllaOYJ1W0KWgpCwVq4
 t0MEiWGGlc3ZPb/bqV/qtS/9rU3NLa8GwWFOcE6qaynNTXKt642EM0Eh1Z2NoAQl
 /lYWk7VU5ltYztz6tOIJYQu4TQ3eDRShT7PKsBuxwce70hG/dIMJN+gsKLzAiWYp
 SaWmz72NNdDnWMD4xMoQJ4TsSio3BhlZV31EJFdsS+hpxOzNT3iV+11+ZrUKJ0g+
 XiSZDgMg+Qewl9MO/fwvXUZ6DkLrG7e9jGKynlSNNcyilXKo+6YCyat50uSyuOYi
 wGYmUsqIDELucWfS3r/unsc0ar8QdyYblNMUSQc7fGjpJBD47cjJwj+2wMWh8jVA
 d+f0w/JkNx102W+25HLcY5eMnHT14uwzY6zjLHzrmUYQI7dzG9paAVT9w9J5bCMB
 Fz6XfIZepDXQUbivre9ndCH1Voi6zJsDLVGyqK+0NFB8AMs2AhsKCZJDo7bVF8n4
 W/KGkcR/SCz8NG051/6t+O/W2g8+i/j7dKnP5Ll1SfcKelUvgLsiQmInDmHadrE5
 lCKC2ZtzMCg6csKmcYMP+h53p5V6Z56GUjuHQOgY1j3coHKX5Vmjm1YjU9apvtSw
 JlkxJsXUNAXCysMDAj+5
 =61WT
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-4.11-ofs2' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux

Pull orangefs updates from Mike Marshall:
 "Orangefs: cleanups, a protocol fix and an added configuration button.

  Cleanups:

   - silence harmless integer overflow warning (from
     dan.carpenter@oracle.com)

   - Dan Carpenter influenced debugfs cleanups.

   - remove orangefs_backing_dev_info (from jack@suse.cz)

  Protocol fix:

   - fix buffer size mis-match between kernel space and user space

  New configuration button:

   - support readahead_readcnt parameter"

* tag 'for-linus-4.11-ofs2' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
  orangefs: fix buffer size mis-match between kernel space and user space.
  orangefs: Dan Carpenter influenced cleanups...
  orangefs: Remove orangefs_backing_dev_info
  orangefs: Support readahead_readcnt parameter.
  orangefs: silence harmless integer overflow warning
This commit is contained in:
Linus Torvalds 2017-02-25 15:02:10 -08:00
commit cb4195535f
9 changed files with 49 additions and 31 deletions

View File

@ -400,8 +400,9 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
/* remove the op from the in progress hash table */
op = orangefs_devreq_remove_op(head.tag);
if (!op) {
gossip_err("WARNING: No one's waiting for tag %llu\n",
llu(head.tag));
gossip_debug(GOSSIP_DEV_DEBUG,
"%s: No one's waiting for tag %llu\n",
__func__, llu(head.tag));
return ret;
}

View File

@ -136,12 +136,6 @@ static ssize_t orangefs_direct_IO(struct kiocb *iocb,
return -EINVAL;
}
struct backing_dev_info orangefs_backing_dev_info = {
.name = "orangefs",
.ra_pages = 0,
.capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
};
/** ORANGEFS2 implementation of address space operations */
const struct address_space_operations orangefs_address_operations = {
.readpage = orangefs_readpage,

View File

@ -344,6 +344,11 @@ int orangefs_bufmap_initialize(struct ORANGEFS_dev_map_desc *user_desc)
user_desc->size,
user_desc->count);
if (user_desc->total_size < 0 ||
user_desc->size < 0 ||
user_desc->count < 0)
goto out;
/*
* sanity check alignment and size of buffer that caller wants to
* work with

View File

@ -973,7 +973,7 @@ int orangefs_debugfs_new_client_string(void __user *arg)
if (ret != 0) {
pr_info("%s: CLIENT_STRING: copy_from_user failed\n",
__func__);
return -EIO;
return -EFAULT;
}
/*
@ -995,10 +995,11 @@ int orangefs_debugfs_new_client_string(void __user *arg)
if (!help_string_initialized) {
/* Build a proper debug help string. */
if (orangefs_prepare_debugfs_help_string(0)) {
ret = orangefs_prepare_debugfs_help_string(0);
if (ret) {
gossip_err("%s: no debug help string \n",
__func__);
return -EIO;
return ret;
}
}
@ -1011,7 +1012,7 @@ int orangefs_debugfs_new_client_string(void __user *arg)
help_string_initialized++;
return ret;
return 0;
}
int orangefs_debugfs_new_debug(void __user *arg)

View File

@ -50,8 +50,7 @@
* Misc constants. Please retain them as multiples of 8!
* Otherwise 32-64 bit interactions will be messed up :)
*/
#define ORANGEFS_MAX_DEBUG_STRING_LEN 0x00000400
#define ORANGEFS_MAX_DEBUG_ARRAY_LEN 0x00000800
#define ORANGEFS_MAX_DEBUG_STRING_LEN 0x00000800
/*
* The maximum number of directory entries in a single request is 96.

View File

@ -529,7 +529,6 @@ extern spinlock_t orangefs_htable_ops_in_progress_lock;
extern int hash_table_size;
extern const struct address_space_operations orangefs_address_operations;
extern struct backing_dev_info orangefs_backing_dev_info;
extern const struct inode_operations orangefs_file_inode_operations;
extern const struct file_operations orangefs_file_operations;
extern const struct inode_operations orangefs_symlink_inode_operations;

View File

@ -80,11 +80,6 @@ static int __init orangefs_init(void)
int ret = -1;
__u32 i = 0;
ret = bdi_init(&orangefs_backing_dev_info);
if (ret)
return ret;
if (op_timeout_secs < 0)
op_timeout_secs = 0;
@ -94,7 +89,7 @@ static int __init orangefs_init(void)
/* initialize global book keeping data structures */
ret = op_cache_initialize();
if (ret < 0)
goto err;
goto out;
ret = orangefs_inode_cache_initialize();
if (ret < 0)
@ -181,9 +176,6 @@ static int __init orangefs_init(void)
cleanup_op:
op_cache_finalize();
err:
bdi_destroy(&orangefs_backing_dev_info);
out:
return ret;
}
@ -207,8 +199,6 @@ static void __exit orangefs_exit(void)
kfree(orangefs_htable_ops_in_progress);
bdi_destroy(&orangefs_backing_dev_info);
pr_info("orangefs: module version %s unloaded\n", ORANGEFS_VERSION);
}

View File

@ -91,6 +91,13 @@
* Description:
* Readahead cache buffer count and size.
*
* What: /sys/fs/orangefs/readahead_readcnt
* Date: Jan 2017
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Number of buffers (in multiples of readahead_size)
* which can be read ahead for a single file at once.
*
* What: /sys/fs/orangefs/acache/...
* Date: Jun 2015
* Contact: Martin Brandenburg <martin@omnibond.com>
@ -329,7 +336,8 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj,
if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
(!strcmp(attr->attr.name, "readahead_count") ||
!strcmp(attr->attr.name, "readahead_size") ||
!strcmp(attr->attr.name, "readahead_count_size"))) {
!strcmp(attr->attr.name, "readahead_count_size") ||
!strcmp(attr->attr.name, "readahead_readcnt"))) {
rc = -EINVAL;
goto out;
}
@ -360,6 +368,11 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj,
"readahead_count_size"))
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
else if (!strcmp(attr->attr.name,
"readahead_readcnt"))
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_READCNT;
} else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) {
if (!strcmp(attr->attr.name, "timeout_msecs"))
new_op->upcall.req.param.op =
@ -542,7 +555,8 @@ static ssize_t sysfs_service_op_store(struct kobject *kobj,
if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
(!strcmp(attr->attr.name, "readahead_count") ||
!strcmp(attr->attr.name, "readahead_size") ||
!strcmp(attr->attr.name, "readahead_count_size"))) {
!strcmp(attr->attr.name, "readahead_count_size") ||
!strcmp(attr->attr.name, "readahead_readcnt"))) {
rc = -EINVAL;
goto out;
}
@ -609,6 +623,15 @@ static ssize_t sysfs_service_op_store(struct kobject *kobj,
new_op->upcall.req.param.u.value32[0] = val1;
new_op->upcall.req.param.u.value32[1] = val2;
goto value_set;
} else if (!strcmp(attr->attr.name,
"readahead_readcnt")) {
if ((val >= 0)) {
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_READCNT;
} else {
rc = 0;
goto out;
}
}
} else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) {
@ -812,6 +835,10 @@ static struct orangefs_attribute readahead_count_size_attribute =
__ATTR(readahead_count_size, 0664, sysfs_service_op_show,
sysfs_service_op_store);
static struct orangefs_attribute readahead_readcnt_attribute =
__ATTR(readahead_readcnt, 0664, sysfs_service_op_show,
sysfs_service_op_store);
static struct orangefs_attribute perf_counter_reset_attribute =
__ATTR(perf_counter_reset,
0664,
@ -838,6 +865,7 @@ static struct attribute *orangefs_default_attrs[] = {
&readahead_count_attribute.attr,
&readahead_size_attribute.attr,
&readahead_count_size_attribute.attr,
&readahead_readcnt_attribute.attr,
&perf_counter_reset_attribute.attr,
&perf_history_size_attribute.attr,
&perf_time_interval_secs_attribute.attr,

View File

@ -182,6 +182,7 @@ enum orangefs_param_request_op {
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE = 26,
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT = 27,
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE = 28,
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_READCNT = 29,
};
struct orangefs_param_request_s {