From e8f81877a33017a6bfd7d6e75c5a8b1fc336f347 Mon Sep 17 00:00:00 2001 From: Wu Libin Date: Mon, 21 Jul 2014 18:04:19 +0800 Subject: [PATCH] LU-5379 ptlprc: return 0 if buf in struct seq_file is overflow Former version would get error if the length of content in nrs_tbf_rul is larger than one page. This patch fix this problem, now nrs policy tbf could make rules as many as possible. Ptlrpc_nrs_policy_control return -ENOSPC means the buf in parameter struct seq_file is overflow, we return 0 in this situation to make upper layer function seq_read to alloc a more larger memory area and do this process again. Signed-off-by: Wu Libin Change-Id: I436a6b5b58e33e46fb896b6f4d56f64a8ff5a732 Reviewed-on: http://review.whamcloud.com/11154 Tested-by: Jenkins Reviewed-by: Nathaniel Clark Tested-by: Maloo Reviewed-by: Li Xi Reviewed-by: Oleg Drokin --- lustre/ptlrpc/nrs_tbf.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index 50ddbf4..63c7b38 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -1579,6 +1579,14 @@ ptlrpc_lprocfs_nrs_tbf_rule_seq_show(struct seq_file *m, void *data) false, m); if (rc == 0) { /** + * -ENOSPC means buf in the parameter m is overflow, return 0 + * here to let upper layer function seq_read alloc a larger + * memory area and do this process again. + */ + } else if (rc == -ENOSPC) { + return 0; + + /** * Ignore -ENODEV as the regular NRS head's policy may be in the * ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state. */ @@ -1596,11 +1604,12 @@ ptlrpc_lprocfs_nrs_tbf_rule_seq_show(struct seq_file *m, void *data) false, m); if (rc == 0) { /** - * Ignore -ENODEV as the high priority NRS head's policy may be - * in the ptlrpc_nrs_pol_state::NRS_POL_STATE_STOPPED state. + * -ENOSPC means buf in the parameter m is overflow, return 0 + * here to let upper layer function seq_read alloc a larger + * memory area and do this process again. */ - } else if (rc != -ENODEV) { - return rc; + } else if (rc == -ENOSPC) { + return 0; } no_hp: -- 1.8.3.1