1 // SPDX-License-Identifier: GPL-2.0
5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 only,
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License version 2 for more details (a copy is included
15 * in the LICENSE file that accompanied this code).
17 * You should have received a copy of the GNU General Public License
18 * version 2 along with this program; If not, see
19 * http://www.gnu.org/licenses/gpl-2.0.html
23 #include <lustre_acl.h>
25 #include "mdc_internal.h"
27 int mdc_unpack_acl(struct req_capsule *pill, struct lustre_md *md)
29 struct mdt_body *body = md->body;
30 struct posix_acl *acl;
34 /* for ACL, it's possible that FLACL is set but aclsize is zero.
35 * only when aclsize != 0 there's an actual segment for ACL
38 if (!body->mbo_aclsize) {
43 buf = req_capsule_server_sized_get(pill, &RMF_ACL, body->mbo_aclsize);
47 acl = posix_acl_from_xattr(&init_user_ns, buf, body->mbo_aclsize);
48 if (IS_ERR_OR_NULL(acl)) {
49 rc = acl ? PTR_ERR(acl) : 0;
50 CERROR("convert xattr to acl: %d\n", rc);
54 rc = posix_acl_valid(&init_user_ns, acl);
56 CERROR("validate acl: %d\n", rc);
57 posix_acl_release(acl);