Whamcloud - gitweb
LU-7624 fld: copy userspace buffer
[fs/lustre-release.git] / lustre / obdclass / lprocfs_jobstats.c
index 6dbf3da..c0ea8f3 100644 (file)
@@ -19,7 +19,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  * Use is subject to license terms.
  *
  * Author: Niu Yawei <niu@whamcloud.com>
@@ -433,7 +433,17 @@ static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v)
                return 0;
        }
 
-       seq_printf(p, "- %-16s %s\n", "job_id:", job->js_jobid);
+       /* Replace the non-printable character in jobid with '?', so
+        * that the output of jobid will be confined in single line. */
+       seq_printf(p, "- %-16s ", "job_id:");
+       for (i = 0; i < strlen(job->js_jobid); i++) {
+               if (isprint(job->js_jobid[i]) != 0)
+                       seq_putc(p, job->js_jobid[i]);
+               else
+                       seq_putc(p, '?');
+       }
+       seq_putc(p, '\n');
+
        seq_printf(p, "  %-16s %ld\n", "snapshot_time:", job->js_timestamp);
 
        s = job->js_stats;
@@ -631,7 +641,7 @@ int lprocfs_job_interval_seq_show(struct seq_file *m, void *data)
 EXPORT_SYMBOL(lprocfs_job_interval_seq_show);
 
 ssize_t
-lprocfs_job_interval_seq_write(struct file *file, const char *buffer,
+lprocfs_job_interval_seq_write(struct file *file, const char __user *buffer,
                                size_t count, loff_t *off)
 {
        struct obd_device *obd;