From: Wu Libin Date: Wed, 1 Apr 2015 16:54:30 +0000 (+0800) Subject: LU-6421 osc: fix bug when setting max_pages_per_rpc X-Git-Tag: 2.7.53~39 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=59efcfeb109edd2c695ce961fb8c872d9c515116;p=fs%2Flustre-release.git LU-6421 osc: fix bug when setting max_pages_per_rpc After setting like "lctl set_param -P osc.*.max_pages_per_rpc", it is possible that the function osc_obd_max_pages_per_rpc_seq_write will be called before ocd_brw_size has been set when mount. ocd_brw_size is meaningless when it is zero. So it should not be the limit at that time. Signed-off-by: Wu Libin Change-Id: I1abbd1bfc089ca1fea2b7ec71a6d45ee70f1ba20 Reviewed-on: http://review.whamcloud.com/14333 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin --- diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index f452dc1..73ec748 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -523,7 +523,8 @@ static ssize_t osc_obd_max_pages_per_rpc_seq_write(struct file *file, chunk_mask = ~((1 << (cli->cl_chunkbits - PAGE_CACHE_SHIFT)) - 1); /* max_pages_per_rpc must be chunk aligned */ val = (val + ~chunk_mask) & chunk_mask; - if (val == 0 || val > ocd->ocd_brw_size >> PAGE_CACHE_SHIFT) { + if (val == 0 || (ocd->ocd_brw_size != 0 && + val > ocd->ocd_brw_size >> PAGE_CACHE_SHIFT)) { LPROCFS_CLIMP_EXIT(dev); return -ERANGE; }