X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdt%2Fmdt_xattr.c;h=df4fb541408fd321058956ab5cea7ad8345f6e08;hb=65701b4a30efdb695776bcf690a2b3cabc928da1;hp=5fd6ffc1eef919b7735d03961a9ed112bc150d7c;hpb=f95393b0d0a59cf3dc2f29cffc35dcc4cc9d7728;p=fs%2Flustre-release.git diff --git a/lustre/mdt/mdt_xattr.c b/lustre/mdt/mdt_xattr.c index 5fd6ffc..df4fb54 100644 --- a/lustre/mdt/mdt_xattr.c +++ b/lustre/mdt/mdt_xattr.c @@ -28,6 +28,8 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, 2012, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -215,6 +217,7 @@ int mdt_getxattr(struct mdt_thread_info *info) EXIT; out: if (rc >= 0) { + mdt_counter_incr(req->rq_export, LPROC_MDT_GETXATTR); repbody->eadatasize = rc; rc = 0; } @@ -238,7 +241,7 @@ static int mdt_rmtlsetfacl(struct mdt_thread_info *info, rc = lustre_ext_acl_xattr_id2server(uc, med->med_idmap, header); if (rc) RETURN(rc); - + rc = mo_xattr_get(info->mti_env, next, &LU_BUF_NULL, xattr_name); if (rc == -ENODATA) rc = 0; @@ -247,7 +250,7 @@ static int mdt_rmtlsetfacl(struct mdt_thread_info *info, buf->lb_len = rc; if (buf->lb_len > 0) { - OBD_ALLOC(buf->lb_buf, buf->lb_len); + OBD_ALLOC_LARGE(buf->lb_buf, buf->lb_len); if (unlikely(buf->lb_buf == NULL)) RETURN(-ENOMEM); @@ -265,7 +268,7 @@ static int mdt_rmtlsetfacl(struct mdt_thread_info *info, _out: if (rc <= 0 && buf->lb_buf != NULL) - OBD_FREE(buf->lb_buf, buf->lb_len); + OBD_FREE_LARGE(buf->lb_buf, buf->lb_len); return rc; } @@ -281,7 +284,7 @@ int mdt_reint_setxattr(struct mdt_thread_info *info, struct mdt_reint_record *rr = &info->mti_rr; struct md_attr *ma = &info->mti_attr; struct lu_attr *attr = &info->mti_attr.ma_attr; - struct mdt_object *obj; + struct mdt_object *obj; struct md_object *child; __u64 valid = attr->la_valid; const char *xattr_name; @@ -334,7 +337,9 @@ int mdt_reint_setxattr(struct mdt_thread_info *info, GOTO(out, rc = 0); } else if ((valid & OBD_MD_FLXATTR) && (strncmp(xattr_name, XATTR_NAME_ACL_ACCESS, - sizeof(XATTR_NAME_ACL_ACCESS) - 1) == 0)) { + sizeof(XATTR_NAME_ACL_ACCESS) - 1) == 0 || + strncmp(xattr_name, XATTR_NAME_ACL_DEFAULT, + sizeof(XATTR_NAME_ACL_DEFAULT) - 1) == 0)) { /* currently lustre limit acl access size */ xattr_len = req_capsule_get_size(pill, &RMF_EADATA, RCL_CLIENT); @@ -343,11 +348,19 @@ int mdt_reint_setxattr(struct mdt_thread_info *info, } lockpart = MDS_INODELOCK_UPDATE; + /* Revoke all clients' lookup lock, since the access + * permissions for this inode is changed when ACL_ACCESS is + * set. This isn't needed for ACL_DEFAULT, since that does + * not change the access permissions of this inode, nor any + * other existing inodes. It is setting the ACLs inherited + * by new directories/files at create time. */ if (!strcmp(xattr_name, XATTR_NAME_ACL_ACCESS)) lockpart |= MDS_INODELOCK_LOOKUP; lh = &info->mti_lh[MDT_LH_PARENT]; - mdt_lock_reg_init(lh, LCK_PW); + /* ACLs were sent to clients under LCK_CR locks, so taking LCK_EX + * to cancel them. */ + mdt_lock_reg_init(lh, LCK_EX); obj = mdt_object_find_lock(info, rr->rr_fid1, lh, lockpart); if (IS_ERR(obj)) GOTO(out, rc = PTR_ERR(obj)); @@ -358,8 +371,11 @@ int mdt_reint_setxattr(struct mdt_thread_info *info, GOTO(out_unlock, rc); if (unlikely(!(valid & OBD_MD_FLCTIME))) { - CWARN("client miss to set OBD_MD_FLCTIME when " - "setxattr: [object "DFID"] [valid "LPU64"]\n", + /* This isn't strictly an error, but all current clients + * should set OBD_MD_FLCTIME when setting attributes. */ + CWARN("%s: client miss to set OBD_MD_FLCTIME when " + "setxattr %s: [object "DFID"] [valid "LPU64"]\n", + info->mti_exp->exp_obd->obd_name, xattr_name, PFID(rr->rr_fid1), valid); attr->la_ctime = cfs_time_current_sec(); } @@ -422,6 +438,9 @@ int mdt_reint_setxattr(struct mdt_thread_info *info, CDEBUG(D_INFO, "valid bits: "LPX64"\n", valid); rc = -EINVAL; } + if (rc == 0) + mdt_counter_incr(req->rq_export, LPROC_MDT_SETXATTR); + EXIT; out_unlock: mdt_object_unlock_put(info, obj, lh, rc);