From d2a191d6f14c875a918cc8836cb7e3fd12bbfdbc Mon Sep 17 00:00:00 2001 From: shadow Date: Wed, 24 Dec 2008 21:41:57 +0000 Subject: [PATCH] checking maximal acl size before set. Branch HEAD b=17636 i=umka i=deen --- lustre/ChangeLog | 7 +++++++ lustre/include/linux/lustre_acl.h | 2 ++ lustre/mdt/mdt_xattr.c | 22 ++++++++++------------ lustre/tests/conf-sanity.sh | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 12 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 48d2398..6c0b31b 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -13,6 +13,13 @@ tbd Sun Microsystems, Inc. removed cwd "./" (refer to Bugzilla 14399). * File join has been disabled in this release, refer to Bugzilla 16929. +Severity : normal +Frequency : always with long access acl +Bugzilla : 17636 +Descriptoin: mds can't pack reply with long acl. +Details : mds don't control size of acl but they limited by reint/getattr + reply buffer. + Severity : enhancement Bugzilla : 18061 Description: Update to SLES10 kernel-2.6.16.60-0.33. diff --git a/lustre/include/linux/lustre_acl.h b/lustre/include/linux/lustre_acl.h index cfdc247..c407e50 100644 --- a/lustre/include/linux/lustre_acl.h +++ b/lustre/include/linux/lustre_acl.h @@ -60,6 +60,8 @@ # ifndef HAVE_VFS_INTENT_PATCHES # include # endif +/* XATTR_{REPLACE,CREATE} */ +#include #endif /* __KERNEL__ */ /* ACL */ diff --git a/lustre/mdt/mdt_xattr.c b/lustre/mdt/mdt_xattr.c index 561a395..8e646b2 100644 --- a/lustre/mdt/mdt_xattr.c +++ b/lustre/mdt/mdt_xattr.c @@ -48,13 +48,7 @@ #endif #define DEBUG_SUBSYSTEM S_MDS -/* prerequisite for linux/xattr.h */ -#include -/* prerequisite for linux/xattr.h */ -#include -/* XATTR_{REPLACE,CREATE} */ -#include - +#include #include "mdt_internal.h" @@ -330,18 +324,22 @@ int mdt_reint_setxattr(struct mdt_thread_info *info, if (strncmp(xattr_name, XATTR_USER_PREFIX, sizeof(XATTR_USER_PREFIX) - 1) == 0) { + if (!(req->rq_export->exp_connect_flags & OBD_CONNECT_XATTR)) + GOTO(out, rc = -EOPNOTSUPP); if (strcmp(xattr_name, XATTR_NAME_LOV) == 0) GOTO(out, rc = -EACCES); if (strcmp(xattr_name, XATTR_NAME_LMA) == 0) GOTO(out, rc = 0); if (strcmp(xattr_name, XATTR_NAME_LINK) == 0) GOTO(out, rc = 0); - } + } else if ((valid & OBD_MD_FLXATTR) && + (strncmp(xattr_name, XATTR_NAME_ACL_ACCESS, + sizeof(XATTR_NAME_ACL_ACCESS) - 1) == 0)) { + /* currently lustre limit acl access size */ + xattr_len = req_capsule_get_size(pill, &RMF_EADATA, RCL_CLIENT); - if (!(req->rq_export->exp_connect_flags & OBD_CONNECT_XATTR) && - (strncmp(xattr_name, XATTR_USER_PREFIX, - sizeof(XATTR_USER_PREFIX) - 1) == 0)) { - GOTO(out, rc = -EOPNOTSUPP); + if (xattr_len > LUSTRE_POSIX_ACL_MAX_SIZE) + GOTO(out, -ERANGE); } lockpart = MDS_INODELOCK_UPDATE; diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index b1137e0..f6b319d 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -143,6 +143,12 @@ setup() { mount_client $MOUNT } +setup_noconfig() { + start_mds + start_ost + mount_client $MOUNT +} + cleanup_nocli() { stop_mds || return 201 stop_ost || return 202 @@ -1570,6 +1576,35 @@ test_47() { #17674 } run_test 47 "server restart does not make client loss lru_resize settings" +# reformat after this test must need - if test will failed +# we will have unkillable file at FS +test_48() { # bug 17636 + reformat + setup_noconfig + check_mount || return 2 + + $LFS setstripe $MOUNT -c -1 || return 9 + $LFS getstripe $MOUNT || return 10 + + echo "ok" > $MOUNT/widestripe + $LFS getstripe $MOUNT/widestripe || return 11 + # fill acl buffer for avoid expand lsm to them + awk -F : '{ print "u:"$1":rwx" }' /etc/passwd | while read acl; do + setfacl -m $acl $MOUNT/widestripe + done + awk -F : '{ print "g:"$1":rwx" }' /etc/groups | while read acl; do + setfacl -m $acl $MOUNT/widestripe + done + + + stat $MOUNT/widestripe || return 12 + + cleanup || error "can't cleanup" + return 0 +} +run_test 48 "too many acls on file" + + cleanup_gss equals_msg `basename $0`: test complete [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true -- 1.8.3.1