From 378cb9355e3d8e90f3da96e535eb343c7ab1b26b Mon Sep 17 00:00:00 2001 From: Liang Zhen Date: Sun, 28 Apr 2013 16:51:52 +0800 Subject: [PATCH] LU-3238 ptlrpc: expression expansion bug in macro slab flag passed into __OBD_SLAB_ALLOC_VERBOSE is not bracketed, so __OBD_SLAB_ALLOC_VERBOSE will get wrong value from unexpected expression expansion and hit assertion. Signed-off-by: Liang Zhen Change-Id: I4f09ccf743d6bda765bab64c60801a87d9a6b9b5 Reviewed-on: http://review.whamcloud.com/6190 Tested-by: Hudson Reviewed-by: Nikitas Angelinas Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Tested-by: Maloo --- lustre/include/obd_support.h | 2 +- lustre/ptlrpc/nrs_orr.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 5c44cfb..8c7e4ac 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -782,7 +782,7 @@ do { \ #define __OBD_SLAB_ALLOC_VERBOSE(ptr, slab, cptab, cpt, size, type) \ do { \ - LASSERT(ergo(type != CFS_ALLOC_ATOMIC, !cfs_in_interrupt())); \ + LASSERT(ergo((type) != CFS_ALLOC_ATOMIC, !cfs_in_interrupt())); \ (ptr) = (cptab) == NULL ? \ cfs_mem_cache_alloc(slab, type) : \ cfs_mem_cache_cpt_alloc(slab, cptab, cpt, type); \ diff --git a/lustre/ptlrpc/nrs_orr.c b/lustre/ptlrpc/nrs_orr.c index c660916..9af1564 100644 --- a/lustre/ptlrpc/nrs_orr.c +++ b/lustre/ptlrpc/nrs_orr.c @@ -884,8 +884,8 @@ int nrs_orr_res_get(struct ptlrpc_nrs_policy *policy, OBD_SLAB_CPT_ALLOC_PTR_GFP(orro, orrd->od_cache, nrs_pol2cptab(policy), nrs_pol2cptid(policy), - moving_req ? CFS_ALLOC_ATOMIC : - CFS_ALLOC_IO); + (moving_req ? CFS_ALLOC_ATOMIC : + CFS_ALLOC_IO)); if (orro == NULL) RETURN(-ENOMEM); -- 1.8.3.1