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-Tag: 2.14.53~28 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=601c48f3ecaefcb644f236344e139088f76a2a07;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. Signed-off-by: Sebastien Buisson Change-Id: I26aba9ce43e4a8878bfa47e145b1b44cfff89403 Reviewed-on: https://review.whamcloud.com/44127 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/ptlrpc/nodemap_handler.c b/lustre/ptlrpc/nodemap_handler.c index 4e16ea7..aa1e5f2 100644 --- a/lustre/ptlrpc/nodemap_handler.c +++ b/lustre/ptlrpc/nodemap_handler.c @@ -744,7 +744,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 b039673..665bbd7 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -25741,6 +25741,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" + prep_801() { [[ $MDS1_VERSION -lt $(version_code 2.9.55) ]] || [[ $OST1_VERSION -lt $(version_code 2.9.55) ]] &&