From 34556ca18a18a957a63b53877901896539a53d24 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Tue, 25 Oct 2022 18:34:45 +0300 Subject: [PATCH] LU-16268 mdd: set effective changelog mask correctly When changelog mask is changed from MINMASK to a particular value then recalculation is missed, so effective mask could stay unchanged against expectations. Patch adds additional check that old mask is MINMASK or not to decide if mask recalculation is needed. Test 160o is extended for that issue. Fixes: ffe259f81cda ("LU-13055 changelog: use default mask if server has no mask") Signed-off-by: Mikhail Pershin Change-Id: Ia3c93e19daeb71ff1042ebdb555e918faf89f844 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48961 Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Reviewed-by: Emoly Liu Tested-by: jenkins Tested-by: Maloo --- lustre/mdd/mdd_lproc.c | 8 ++++---- lustre/tests/sanity.sh | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c index 49216ec..703c72c 100644 --- a/lustre/mdd/mdd_lproc.c +++ b/lustre/mdd/mdd_lproc.c @@ -155,11 +155,11 @@ mdd_changelog_mask_seq_write(struct file *file, const char __user *buffer, mdd->mdd_cl.mc_proc_mask = newmask; - /* if mask keeps all bits from oldmask then just extend the current - * mask, otherwise the current mask should be recalculated through - * all user masks. + /* if oldmask is not MINMASK and newmask keeps all bits from oldmask + * then just extend the current mask, otherwise the current mask + * should be recalculated through all user masks. */ - if ((newmask & oldmask) == oldmask) { + if (oldmask != CHANGELOG_MINMASK && (newmask & oldmask) == oldmask) { spin_lock(&mdd->mdd_cl.mc_user_lock); mdd->mdd_cl.mc_current_mask |= newmask; spin_unlock(&mdd->mdd_cl.mc_user_lock); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index bb7a89a..0f41d98 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -17160,6 +17160,15 @@ test_160o() { mdd.$mdt.changelog_current_mask -n) [[ $mask == *"HLINK"* ]] || error "mask is not DEFMASK as expected" + if (( $MDS1_VERSION >= $(version_code 2.15.52) )) ; then + # set server mask back to some value + changelog_chmask "CLOSE,UNLNK" + # check effective mask again, should not remain as DEFMASK + mask=$(do_facet $SINGLEMDS $LCTL get_param \ + mdd.$mdt.changelog_current_mask -n) + [[ $mask != *"HLINK"* ]] || error "mask is still DEFMASK" + fi + do_facet $SINGLEMDS $LCTL --device $mdt \ changelog_deregister -u test_160o || error "cannot deregister by name" -- 1.8.3.1