From: Sebastien Buisson Date: Thu, 1 Jul 2021 15:20:39 +0000 (+0900) Subject: LU-14804 nodemap: do not return error for improper ACL X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=c75e68e5ec733decf60c31301445a2c951ebb49e;p=fs%2Flustre-release.git LU-14804 nodemap: do not return error for improper ACL In nodemap_map_acl(), in case the ACL is incorrect, do nothing and just return initial size to caller. Lustre-change: https://review.whamcloud.com/44127 Lustre-commit: 601c48f3ecaefcb644f236344e139088f76a2a07 Signed-off-by: Sebastien Buisson Change-Id: I26aba9ce43e4a8878bfa47e145b1b44cfff89403 Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Reviewed-on: https://review.whamcloud.com/44398 Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/ptlrpc/nodemap_handler.c b/lustre/ptlrpc/nodemap_handler.c index 44fc2f2..f71e536 100644 --- a/lustre/ptlrpc/nodemap_handler.c +++ b/lustre/ptlrpc/nodemap_handler.c @@ -745,7 +745,8 @@ ssize_t nodemap_map_acl(struct lu_nodemap *nodemap, void *buf, size_t size, if (count < 0) RETURN(-EINVAL); if (count == 0) - RETURN(0); + /* if not proper ACL, do nothing and return initial size */ + RETURN(size); for (end = entry + count; entry != end; entry++) { __u16 tag = le16_to_cpu(entry->e_tag); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 6e39450..eeaae76 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -24619,6 +24619,38 @@ test_431() { # LU-14187 } run_test 431 "Restart transaction for IO" +cleanup_test_432() { + do_facet mgs $LCTL nodemap_activate 0 + wait_nm_sync active +} + +test_432() { + local tmpdir=$TMP/dir432 + + (( $MDS1_VERSION >= $(version_code 2.14.52) )) || + skip "Need MDS version at least 2.14.52" + + stack_trap cleanup_test_432 EXIT + mkdir $DIR/$tdir + mkdir $tmpdir + + do_facet mgs $LCTL nodemap_activate 1 + wait_nm_sync active + do_facet mgs $LCTL nodemap_modify --name default \ + --property admin --value 1 + do_facet mgs $LCTL nodemap_modify --name default \ + --property trusted --value 1 + cancel_lru_locks mdc + wait_nm_sync default admin_nodemap + wait_nm_sync default trusted_nodemap + + if [ $(mv $tmpdir $DIR/$tdir/ 2>&1 | + grep -ci "Operation not permitted") -ne 0 ]; then + error "mv $tmpdir $DIR/$tdir/ hits 'Operation not permitted'" + fi +} +run_test 432 "mv dir from outside Lustre" + test_450() { remote_ost_nodsh && skip "remote OST with nodsh" && return local mntdev