From c11c61a82d668b54a41127a759b2e99cb077ac14 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Mon, 12 Mar 2018 19:51:23 +0800 Subject: [PATCH] LU-10803 ptlrpc: fix req_buffers_max and req_history_max setting We hit LU-9372 OOM problems, and after applying LU-9372 ptlrpc: allow to limit number of service's rqbds we found two problems: 1)Since 0 is a reserved value for @srv_nrqbds_max which means unlimited value, procfs write interface should support this value, otherwise, there is no way to change default behavior back. 2)the check in ptlrpc_lprocfs_req_history_max_seq_write() was broken after this patch, the following check will always succeed if @srv_nrqbds_max is kept as default value 0: val > svc->srv_nrqbds_max/2 Change-Id: Ida0796fa500fe595e003accc11d20fdad5e60c03 Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/31622 Tested-by: Jenkins Reviewed-by: Faccini Bruno Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/ptlrpc/lproc_ptlrpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index ee4e78e..f46f3d5 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -324,8 +324,8 @@ ptlrpc_lprocfs_req_history_max_seq_write(struct file *file, bufpages = (roundup_pow_of_two(svc->srv_buf_size) + PAGE_SIZE - 1) >> PAGE_SHIFT; /* do not allow history to consume more than half max number of rqbds */ - if ((svc->srv_nrqbds_max == 0 && val > totalram_pages/(2 * bufpages)) || - val > svc->srv_nrqbds_max/2) + if ((svc->srv_nrqbds_max == 0 && val > totalram_pages / (2 * bufpages)) || + (svc->srv_nrqbds_max != 0 && val > svc->srv_nrqbds_max / 2)) return -ERANGE; spin_lock(&svc->srv_lock); @@ -365,7 +365,7 @@ ptlrpc_lprocfs_req_buffers_max_seq_write(struct file *file, if (rc < 0) return rc; - if (val < svc->srv_nbuf_per_group) + if (val < svc->srv_nbuf_per_group && val != 0) return -ERANGE; spin_lock(&svc->srv_lock); -- 1.8.3.1