From d8e7ad15acd81ea9be8d2a00041e6d9f4032d066 Mon Sep 17 00:00:00 2001 From: shadow Date: Wed, 24 Dec 2008 21:28:31 +0000 Subject: [PATCH] checking maximal acl size before set. Branch b1_6 b=17636 i=johann i=deen --- lustre/ChangeLog | 7 +++++++ lustre/mds/mds_xattr.c | 16 +++++++++++++--- lustre/tests/conf-sanity.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 0c26c85..c3373c3 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -117,6 +117,13 @@ Details : Clients drop lock reference and release openhandle when they find Lustre filesystem with 4K stack may cause a stack overflow. For more information, please refer to bugzilla 17630. +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 : major Frequency : on remount Bugzilla : 18018 diff --git a/lustre/mds/mds_xattr.c b/lustre/mds/mds_xattr.c index 19f8956..de43c1f 100644 --- a/lustre/mds/mds_xattr.c +++ b/lustre/mds/mds_xattr.c @@ -265,6 +265,16 @@ int mds_setxattr_internal(struct ptlrpc_request *req, struct mds_body *body) GOTO(out, rc = -EOPNOTSUPP); } + /* currently lustre limit xattr size */ + if (body->valid & OBD_MD_FLXATTR && !strcmp(xattr_name, XATTR_NAME_ACL_ACCESS)) { + xattrlen = lustre_msg_buflen(req->rq_reqmsg, + REQ_REC_OFF + 2); + + if (xattrlen > LUSTRE_POSIX_ACL_MAX_SIZE) + GOTO(out, -ERANGE); + } + + if (!strcmp(xattr_name, XATTR_NAME_ACL_ACCESS)) lockpart |= MDS_INODELOCK_LOOKUP; @@ -292,9 +302,9 @@ int mds_setxattr_internal(struct ptlrpc_request *req, struct mds_body *body) xattrlen = lustre_msg_buflen(req->rq_reqmsg, REQ_REC_OFF + 2); - if (xattrlen) - xattr = lustre_msg_buf(req->rq_reqmsg, - REQ_REC_OFF+2, xattrlen); + + xattr = lustre_msg_buf(req->rq_reqmsg, + REQ_REC_OFF+2, xattrlen); LOCK_INODE_MUTEX(inode); rc = inode->i_op->setxattr(de, xattr_name, xattr, diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 60e6b28..64ad13c 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -145,6 +145,12 @@ setup() { mount_client $MOUNT } +setup_noconfig() { + start_mds + start_ost + mount_client $MOUNT +} + cleanup_nocli() { stop_mds || return 201 stop_ost || return 202 @@ -1559,5 +1565,30 @@ 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 + + stat $MOUNT/widestripe || return 12 + + cleanup || error "can't cleanup" + return 0 +} +run_test 48 "too many acls on file" + + equals_msg `basename $0`: test complete [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true -- 1.8.3.1