2 * What: /sys/kernel/debug/orangefs/debug-help
4 * Contact: Mike Marshall <hubcap@omnibond.com>
6 * List of client and kernel debug keywords.
9 * What: /sys/kernel/debug/orangefs/client-debug
11 * Contact: Mike Marshall <hubcap@omnibond.com>
13 * Debug setting for "the client", the userspace
14 * helper for the kernel module.
17 * What: /sys/kernel/debug/orangefs/kernel-debug
19 * Contact: Mike Marshall <hubcap@omnibond.com>
21 * Debug setting for the orangefs kernel module.
23 * Any of the keywords, or comma-separated lists
24 * of keywords, from debug-help can be catted to
25 * client-debug or kernel-debug.
27 * "none", "all" and "verbose" are special keywords
28 * for client-debug. Setting client-debug to "all"
29 * is kind of like trying to drink water from a
30 * fire hose, "verbose" triggers most of the same
31 * output except for the constant flow of output
32 * from the main wait loop.
34 * "none" and "all" are similar settings for kernel-debug
35 * no need for a "verbose".
37 #include <linux/debugfs.h>
38 #include <linux/slab.h>
40 #include <linux/uaccess.h>
42 #include "orangefs-debugfs.h"
44 #include "orangefs-kernel.h"
46 #define DEBUG_HELP_STRING_SIZE 4096
47 #define HELP_STRING_UNINITIALIZED \
48 "Client Debug Keywords are unknown until the first time\n" \
49 "the client is started after boot.\n"
50 #define ORANGEFS_KMOD_DEBUG_HELP_FILE "debug-help"
51 #define ORANGEFS_KMOD_DEBUG_FILE "kernel-debug"
52 #define ORANGEFS_CLIENT_DEBUG_FILE "client-debug"
53 #define ORANGEFS_VERBOSE "verbose"
54 #define ORANGEFS_ALL "all"
57 * An array of client_debug_mask will be built to hold debug keyword/mask
58 * values fetched from userspace.
60 struct client_debug_mask {
66 static int orangefs_kernel_debug_init(void);
68 static int orangefs_debug_help_open(struct inode *, struct file *);
69 static void *help_start(struct seq_file *, loff_t *);
70 static void *help_next(struct seq_file *, void *, loff_t *);
71 static void help_stop(struct seq_file *, void *);
72 static int help_show(struct seq_file *, void *);
74 static int orangefs_debug_open(struct inode *, struct file *);
76 static ssize_t orangefs_debug_read(struct file *,
81 static ssize_t orangefs_debug_write(struct file *,
86 static int orangefs_prepare_cdm_array(char *);
87 static void debug_mask_to_string(void *, int);
88 static void do_k_string(void *, int);
89 static void do_c_string(void *, int);
90 static int keyword_is_amalgam(char *);
91 static int check_amalgam_keyword(void *, int);
92 static void debug_string_to_mask(char *, void *, int);
93 static void do_c_mask(int, char *, struct client_debug_mask **);
94 static void do_k_mask(int, char *, __u64 **);
96 static char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN] = "none";
97 static char *debug_help_string;
98 static char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
99 static char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
101 static struct dentry *help_file_dentry;
102 static struct dentry *client_debug_dentry;
103 static struct dentry *debug_dir;
105 static unsigned int kernel_mask_set_mod_init;
106 static int orangefs_debug_disabled = 1;
107 static int help_string_initialized;
109 static const struct seq_operations help_debug_ops = {
116 const struct file_operations debug_help_fops = {
117 .open = orangefs_debug_help_open,
119 .release = seq_release,
123 static const struct file_operations kernel_debug_fops = {
124 .open = orangefs_debug_open,
125 .read = orangefs_debug_read,
126 .write = orangefs_debug_write,
127 .llseek = generic_file_llseek,
130 static int client_all_index;
131 static int client_verbose_index;
133 static struct client_debug_mask *cdm_array;
134 static int cdm_element_count;
136 static struct client_debug_mask client_debug_mask;
139 * Used to protect data in ORANGEFS_KMOD_DEBUG_FILE and
140 * ORANGEFS_KMOD_DEBUG_FILE.
142 static DEFINE_MUTEX(orangefs_debug_lock);
145 * initialize kmod debug operations, create orangefs debugfs dir and
146 * ORANGEFS_KMOD_DEBUG_HELP_FILE.
148 int orangefs_debugfs_init(int debug_mask)
152 /* convert input debug mask to a 64-bit unsigned integer */
153 orangefs_gossip_debug_mask = (unsigned long long)debug_mask;
156 * set the kernel's gossip debug string; invalid mask values will
159 debug_mask_to_string(&orangefs_gossip_debug_mask, 0);
161 /* remove any invalid values from the mask */
162 debug_string_to_mask(kernel_debug_string, &orangefs_gossip_debug_mask,
166 * if the mask has a non-zero value, then indicate that the mask
167 * was set when the kernel module was loaded. The orangefs dev ioctl
168 * command will look at this boolean to determine if the kernel's
169 * debug mask should be overwritten when the client-core is started.
171 if (orangefs_gossip_debug_mask != 0)
172 kernel_mask_set_mod_init = true;
174 pr_info("%s: called with debug mask: :%s: :%llx:\n",
177 (unsigned long long)orangefs_gossip_debug_mask);
179 debug_dir = debugfs_create_dir("orangefs", NULL);
181 pr_info("%s: debugfs_create_dir failed.\n", __func__);
185 help_file_dentry = debugfs_create_file(ORANGEFS_KMOD_DEBUG_HELP_FILE,
190 if (!help_file_dentry) {
191 pr_info("%s: debugfs_create_file failed.\n", __func__);
195 orangefs_debug_disabled = 0;
197 rc = orangefs_kernel_debug_init();
205 * initialize the kernel-debug file.
207 static int orangefs_kernel_debug_init(void)
211 char *k_buffer = NULL;
213 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__);
215 k_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
219 if (strlen(kernel_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) {
220 strcpy(k_buffer, kernel_debug_string);
221 strcat(k_buffer, "\n");
223 strcpy(k_buffer, "none\n");
224 pr_info("%s: overflow 1!\n", __func__);
227 ret = debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE,
233 pr_info("%s: failed to create %s.\n",
235 ORANGEFS_KMOD_DEBUG_FILE);
243 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc);
248 void orangefs_debugfs_cleanup(void)
250 debugfs_remove_recursive(debug_dir);
253 /* open ORANGEFS_KMOD_DEBUG_HELP_FILE */
254 static int orangefs_debug_help_open(struct inode *inode, struct file *file)
259 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
260 "orangefs_debug_help_open: start\n");
262 if (orangefs_debug_disabled)
265 ret = seq_open(file, &help_debug_ops);
269 ((struct seq_file *)(file->private_data))->private = inode->i_private;
274 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
275 "orangefs_debug_help_open: rc:%d:\n",
281 * I think start always gets called again after stop. Start
282 * needs to return NULL when it is done. The whole "payload"
283 * in this case is a single (long) string, so by the second
284 * time we get to start (pos = 1), we're done.
286 static void *help_start(struct seq_file *m, loff_t *pos)
288 void *payload = NULL;
290 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_start: start\n");
293 payload = m->private;
298 static void *help_next(struct seq_file *m, void *v, loff_t *pos)
300 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_next: start\n");
305 static void help_stop(struct seq_file *m, void *p)
307 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_stop: start\n");
310 static int help_show(struct seq_file *m, void *v)
312 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_show: start\n");
320 * initialize the client-debug file.
322 int orangefs_client_debug_init(void)
326 char *c_buffer = NULL;
328 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__);
330 c_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
334 if (strlen(client_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) {
335 strcpy(c_buffer, client_debug_string);
336 strcat(c_buffer, "\n");
338 strcpy(c_buffer, "none\n");
339 pr_info("%s: overflow! 2\n", __func__);
342 client_debug_dentry = debugfs_create_file(ORANGEFS_CLIENT_DEBUG_FILE,
347 if (!client_debug_dentry) {
348 pr_info("%s: failed to create updated %s.\n",
350 ORANGEFS_CLIENT_DEBUG_FILE);
358 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc);
362 /* open ORANGEFS_KMOD_DEBUG_FILE or ORANGEFS_CLIENT_DEBUG_FILE.*/
363 static int orangefs_debug_open(struct inode *inode, struct file *file)
367 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
368 "%s: orangefs_debug_disabled: %d\n",
370 orangefs_debug_disabled);
372 if (orangefs_debug_disabled)
376 mutex_lock(&orangefs_debug_lock);
377 file->private_data = inode->i_private;
378 mutex_unlock(&orangefs_debug_lock);
381 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
382 "orangefs_debug_open: rc: %d\n",
387 static ssize_t orangefs_debug_read(struct file *file,
394 ssize_t read_ret = -ENOMEM;
396 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "orangefs_debug_read: start\n");
398 buf = kmalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
402 mutex_lock(&orangefs_debug_lock);
403 sprintf_ret = sprintf(buf, "%s", (char *)file->private_data);
404 mutex_unlock(&orangefs_debug_lock);
406 read_ret = simple_read_from_buffer(ubuf, count, ppos, buf, sprintf_ret);
411 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
412 "orangefs_debug_read: ret: %zu\n",
418 static ssize_t orangefs_debug_write(struct file *file,
419 const char __user *ubuf,
427 struct orangefs_kernel_op_s *new_op = NULL;
428 struct client_debug_mask c_mask = { NULL, 0, 0 };
430 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
431 "orangefs_debug_write: %pD\n",
435 * Thwart users who try to jamb a ridiculous number
436 * of bytes into the debug file...
438 if (count > ORANGEFS_MAX_DEBUG_STRING_LEN + 1) {
440 count = ORANGEFS_MAX_DEBUG_STRING_LEN + 1;
443 buf = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
447 if (copy_from_user(buf, ubuf, count - 1)) {
448 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
449 "%s: copy_from_user failed!\n",
455 * Map the keyword string from userspace into a valid debug mask.
456 * The mapping process involves mapping the human-inputted string
457 * into a valid mask, and then rebuilding the string from the
458 * verified valid mask.
460 * A service operation is required to set a new client-side
463 if (!strcmp(file->f_path.dentry->d_name.name,
464 ORANGEFS_KMOD_DEBUG_FILE)) {
465 debug_string_to_mask(buf, &orangefs_gossip_debug_mask, 0);
466 debug_mask_to_string(&orangefs_gossip_debug_mask, 0);
467 debug_string = kernel_debug_string;
468 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
469 "New kernel debug string is %s\n",
470 kernel_debug_string);
472 /* Can't reset client debug mask if client is not running. */
473 if (is_daemon_in_service()) {
474 pr_info("%s: Client not running :%d:\n",
476 is_daemon_in_service());
480 debug_string_to_mask(buf, &c_mask, 1);
481 debug_mask_to_string(&c_mask, 1);
482 debug_string = client_debug_string;
484 new_op = op_alloc(ORANGEFS_VFS_OP_PARAM);
486 pr_info("%s: op_alloc failed!\n", __func__);
490 new_op->upcall.req.param.op =
491 ORANGEFS_PARAM_REQUEST_OP_TWO_MASK_VALUES;
492 new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
493 memset(new_op->upcall.req.param.s_value,
495 ORANGEFS_MAX_DEBUG_STRING_LEN);
496 sprintf(new_op->upcall.req.param.s_value,
501 /* service_operation returns 0 on success... */
502 rc = service_operation(new_op,
504 ORANGEFS_OP_INTERRUPTIBLE);
507 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
508 "%s: service_operation failed! rc:%d:\n",
515 mutex_lock(&orangefs_debug_lock);
516 memset(file->f_inode->i_private, 0, ORANGEFS_MAX_DEBUG_STRING_LEN);
517 sprintf((char *)file->f_inode->i_private, "%s\n", debug_string);
518 mutex_unlock(&orangefs_debug_lock);
527 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
528 "orangefs_debug_write: rc: %d\n",
535 * After obtaining a string representation of the client's debug
536 * keywords and their associated masks, this function is called to build an
537 * array of these values.
539 static int orangefs_prepare_cdm_array(char *debug_array_string)
543 char *cds_head = NULL;
544 char *cds_delimiter = NULL;
547 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
550 * figure out how many elements the cdm_array needs.
552 for (i = 0; i < strlen(debug_array_string); i++)
553 if (debug_array_string[i] == '\n')
556 if (!cdm_element_count) {
557 pr_info("No elements in client debug array string!\n");
562 kzalloc(cdm_element_count * sizeof(struct client_debug_mask),
565 pr_info("malloc failed for cdm_array!\n");
570 cds_head = debug_array_string;
572 for (i = 0; i < cdm_element_count; i++) {
573 cds_delimiter = strchr(cds_head, '\n');
574 *cds_delimiter = '\0';
576 keyword_len = strcspn(cds_head, " ");
578 cdm_array[i].keyword = kzalloc(keyword_len + 1, GFP_KERNEL);
579 if (!cdm_array[i].keyword) {
586 cdm_array[i].keyword,
587 (unsigned long long *)&(cdm_array[i].mask1),
588 (unsigned long long *)&(cdm_array[i].mask2));
590 if (!strcmp(cdm_array[i].keyword, ORANGEFS_VERBOSE))
591 client_verbose_index = i;
593 if (!strcmp(cdm_array[i].keyword, ORANGEFS_ALL))
594 client_all_index = i;
596 cds_head = cds_delimiter + 1;
599 rc = cdm_element_count;
601 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: rc:%d:\n", __func__, rc);
610 * /sys/kernel/debug/orangefs/debug-help can be catted to
611 * see all the available kernel and client debug keywords.
613 * When the kernel boots, we have no idea what keywords the
614 * client supports, nor their associated masks.
616 * We pass through this function once at boot and stamp a
617 * boilerplate "we don't know" message for the client in the
618 * debug-help file. We pass through here again when the client
619 * starts and then we can fill out the debug-help file fully.
621 * The client might be restarted any number of times between
622 * reboots, we only build the debug-help file the first time.
624 int orangefs_prepare_debugfs_help_string(int at_boot)
629 char *client_title = "Client Debug Keywords:\n";
630 char *kernel_title = "Kernel Debug Keywords:\n";
632 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
635 byte_count += strlen(HELP_STRING_UNINITIALIZED);
636 client_title = HELP_STRING_UNINITIALIZED;
639 * fill the client keyword/mask array and remember
640 * how many elements there were.
643 orangefs_prepare_cdm_array(client_debug_array_string);
644 if (cdm_element_count <= 0)
647 /* Count the bytes destined for debug_help_string. */
648 byte_count += strlen(client_title);
650 for (i = 0; i < cdm_element_count; i++) {
651 byte_count += strlen(cdm_array[i].keyword + 2);
652 if (byte_count >= DEBUG_HELP_STRING_SIZE) {
653 pr_info("%s: overflow 1!\n", __func__);
658 gossip_debug(GOSSIP_UTILS_DEBUG,
659 "%s: cdm_element_count:%d:\n",
664 byte_count += strlen(kernel_title);
665 for (i = 0; i < num_kmod_keyword_mask_map; i++) {
667 strlen(s_kmod_keyword_mask_map[i].keyword + 2);
668 if (byte_count >= DEBUG_HELP_STRING_SIZE) {
669 pr_info("%s: overflow 2!\n", __func__);
674 /* build debug_help_string. */
675 debug_help_string = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL);
676 if (!debug_help_string) {
681 strcat(debug_help_string, client_title);
684 for (i = 0; i < cdm_element_count; i++) {
685 strcat(debug_help_string, "\t");
686 strcat(debug_help_string, cdm_array[i].keyword);
687 strcat(debug_help_string, "\n");
691 strcat(debug_help_string, "\n");
692 strcat(debug_help_string, kernel_title);
694 for (i = 0; i < num_kmod_keyword_mask_map; i++) {
695 strcat(debug_help_string, "\t");
696 strcat(debug_help_string, s_kmod_keyword_mask_map[i].keyword);
697 strcat(debug_help_string, "\n");
712 static void debug_mask_to_string(void *mask, int type)
717 int element_count = 0;
719 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
722 debug_string = client_debug_string;
723 element_count = cdm_element_count;
725 debug_string = kernel_debug_string;
726 element_count = num_kmod_keyword_mask_map;
729 memset(debug_string, 0, ORANGEFS_MAX_DEBUG_STRING_LEN);
732 * Some keywords, like "all" or "verbose", are amalgams of
733 * numerous other keywords. Make a special check for those
734 * before grinding through the whole mask only to find out
737 if (check_amalgam_keyword(mask, type))
740 /* Build the debug string. */
741 for (i = 0; i < element_count; i++)
743 do_c_string(mask, i);
745 do_k_string(mask, i);
747 len = strlen(debug_string);
750 client_debug_string[len - 1] = '\0';
752 kernel_debug_string[len - 1] = '\0';
754 strcpy(client_debug_string, "none");
756 strcpy(kernel_debug_string, "none");
759 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: string:%s:\n", __func__, debug_string);
765 static void do_k_string(void *k_mask, int index)
767 __u64 *mask = (__u64 *) k_mask;
769 if (keyword_is_amalgam((char *) s_kmod_keyword_mask_map[index].keyword))
772 if (*mask & s_kmod_keyword_mask_map[index].mask_val) {
773 if ((strlen(kernel_debug_string) +
774 strlen(s_kmod_keyword_mask_map[index].keyword))
775 < ORANGEFS_MAX_DEBUG_STRING_LEN - 1) {
776 strcat(kernel_debug_string,
777 s_kmod_keyword_mask_map[index].keyword);
778 strcat(kernel_debug_string, ",");
780 gossip_err("%s: overflow!\n", __func__);
781 strcpy(kernel_debug_string, ORANGEFS_ALL);
791 static void do_c_string(void *c_mask, int index)
793 struct client_debug_mask *mask = (struct client_debug_mask *) c_mask;
795 if (keyword_is_amalgam(cdm_array[index].keyword))
798 if ((mask->mask1 & cdm_array[index].mask1) ||
799 (mask->mask2 & cdm_array[index].mask2)) {
800 if ((strlen(client_debug_string) +
801 strlen(cdm_array[index].keyword) + 1)
802 < ORANGEFS_MAX_DEBUG_STRING_LEN - 2) {
803 strcat(client_debug_string,
804 cdm_array[index].keyword);
805 strcat(client_debug_string, ",");
807 gossip_err("%s: overflow!\n", __func__);
808 strcpy(client_debug_string, ORANGEFS_ALL);
816 static int keyword_is_amalgam(char *keyword)
820 if ((!strcmp(keyword, ORANGEFS_ALL)) || (!strcmp(keyword, ORANGEFS_VERBOSE)))
830 * return 1 if we found an amalgam.
832 static int check_amalgam_keyword(void *mask, int type)
835 struct client_debug_mask *c_mask;
836 int k_all_index = num_kmod_keyword_mask_map - 1;
840 c_mask = (struct client_debug_mask *) mask;
842 if ((c_mask->mask1 == cdm_array[client_all_index].mask1) &&
843 (c_mask->mask2 == cdm_array[client_all_index].mask2)) {
844 strcpy(client_debug_string, ORANGEFS_ALL);
849 if ((c_mask->mask1 == cdm_array[client_verbose_index].mask1) &&
850 (c_mask->mask2 == cdm_array[client_verbose_index].mask2)) {
851 strcpy(client_debug_string, ORANGEFS_VERBOSE);
857 k_mask = (__u64 *) mask;
859 if (*k_mask >= s_kmod_keyword_mask_map[k_all_index].mask_val) {
860 strcpy(kernel_debug_string, ORANGEFS_ALL);
875 static void debug_string_to_mask(char *debug_string, void *mask, int type)
877 char *unchecked_keyword;
879 char *strsep_fodder = kstrdup(debug_string, GFP_KERNEL);
880 char *original_pointer;
881 int element_count = 0;
882 struct client_debug_mask *c_mask = NULL;
883 __u64 *k_mask = NULL;
885 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
888 c_mask = (struct client_debug_mask *)mask;
889 element_count = cdm_element_count;
891 k_mask = (__u64 *)mask;
893 element_count = num_kmod_keyword_mask_map;
896 original_pointer = strsep_fodder;
897 while ((unchecked_keyword = strsep(&strsep_fodder, ",")))
898 if (strlen(unchecked_keyword)) {
899 for (i = 0; i < element_count; i++)
910 kfree(original_pointer);
913 static void do_c_mask(int i, char *unchecked_keyword,
914 struct client_debug_mask **sane_mask)
917 if (!strcmp(cdm_array[i].keyword, unchecked_keyword)) {
918 (**sane_mask).mask1 = (**sane_mask).mask1 | cdm_array[i].mask1;
919 (**sane_mask).mask2 = (**sane_mask).mask2 | cdm_array[i].mask2;
923 static void do_k_mask(int i, char *unchecked_keyword, __u64 **sane_mask)
926 if (!strcmp(s_kmod_keyword_mask_map[i].keyword, unchecked_keyword))
927 **sane_mask = (**sane_mask) |
928 s_kmod_keyword_mask_map[i].mask_val;
931 int orangefs_debugfs_new_client_mask(void __user *arg)
933 struct dev_mask2_info_s mask2_info = {0};
936 ret = copy_from_user(&mask2_info,
938 sizeof(struct dev_mask2_info_s));
943 client_debug_mask.mask1 = mask2_info.mask1_value;
944 client_debug_mask.mask2 = mask2_info.mask2_value;
946 pr_info("%s: client debug mask has been been received "
949 (unsigned long long)client_debug_mask.mask1,
950 (unsigned long long)client_debug_mask.mask2);
955 int orangefs_debugfs_new_client_string(void __user *arg)
959 ret = copy_from_user(&client_debug_array_string,
961 ORANGEFS_MAX_DEBUG_STRING_LEN);
966 * The real client-core makes an effort to ensure
967 * that actual strings that aren't too long to fit in
968 * this buffer is what we get here. We're going to use
969 * string functions on the stuff we got, so we'll make
970 * this extra effort to try and keep from
971 * flowing out of this buffer when we use the string
972 * functions, even if somehow the stuff we end up
973 * with here is garbage.
975 client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] =
979 pr_info("%s: CLIENT_STRING: copy_from_user failed\n",
984 pr_info("%s: client debug array string has been received.\n",
987 if (!help_string_initialized) {
989 /* Free the "we don't know yet" default string... */
990 kfree(debug_help_string);
992 /* build a proper debug help string */
993 if (orangefs_prepare_debugfs_help_string(0)) {
994 gossip_err("%s: no debug help string \n",
999 /* Replace the boilerplate boot-time debug-help file. */
1000 debugfs_remove(help_file_dentry);
1003 debugfs_create_file(
1004 ORANGEFS_KMOD_DEBUG_HELP_FILE,
1010 if (!help_file_dentry) {
1011 gossip_err("%s: debugfs_create_file failed for"
1014 ORANGEFS_KMOD_DEBUG_HELP_FILE);
1019 debug_mask_to_string(&client_debug_mask, 1);
1021 debugfs_remove(client_debug_dentry);
1023 orangefs_client_debug_init();
1025 help_string_initialized++;
1030 int orangefs_debugfs_new_debug(void __user *arg)
1032 struct dev_mask_info_s mask_info = {0};
1035 ret = copy_from_user(&mask_info,
1042 if (mask_info.mask_type == KERNEL_MASK) {
1043 if ((mask_info.mask_value == 0)
1044 && (kernel_mask_set_mod_init)) {
1046 * the kernel debug mask was set when the
1047 * kernel module was loaded; don't override
1048 * it if the client-core was started without
1049 * a value for ORANGEFS_KMODMASK.
1053 debug_mask_to_string(&mask_info.mask_value,
1054 mask_info.mask_type);
1055 orangefs_gossip_debug_mask = mask_info.mask_value;
1056 pr_info("%s: kernel debug mask has been modified to "
1059 kernel_debug_string,
1060 (unsigned long long)orangefs_gossip_debug_mask);
1061 } else if (mask_info.mask_type == CLIENT_MASK) {
1062 debug_mask_to_string(&mask_info.mask_value,
1063 mask_info.mask_type);
1064 pr_info("%s: client debug mask has been modified to"
1067 client_debug_string,
1068 llu(mask_info.mask_value));
1070 gossip_lerr("Invalid mask type....\n");