From 47d66a0112ff8bffba6c99f5fab61ddf50703c29 Mon Sep 17 00:00:00 2001 From: fanyong Date: Thu, 19 Oct 2006 08:16:12 +0000 Subject: [PATCH] Pack ACL back when file open, fix some bug about permission. --- lustre/mdt/mdt_open.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index cc20816..6003b45 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -344,6 +344,36 @@ static int mdt_mfd_open(struct mdt_thread_info *info, repbody->aclsize = sizeof(struct mdt_remote_perm); } } +#ifdef CONFIG_FS_POSIX_ACL + else if (req->rq_export->exp_connect_flags & OBD_CONNECT_ACL) { + const struct lu_env *env = info->mti_env; + struct md_object *next = mdt_object_child(o); + struct lu_buf *buf = &info->mti_buf; + + buf->lb_buf = req_capsule_server_get(&info->mti_pill, &RMF_ACL); + buf->lb_len = req_capsule_get_size(&info->mti_pill, &RMF_ACL, + RCL_SERVER); + if (buf->lb_len > 0) { + rc = mo_xattr_get(env, next, buf, + XATTR_NAME_ACL_ACCESS); + if (rc < 0) { + if (rc == -ENODATA) { + repbody->aclsize = 0; + repbody->valid |= OBD_MD_FLACL; + rc = 0; + } else if (rc == -EOPNOTSUPP) { + rc = 0; + } else { + CERROR("got acl size: %d\n", rc); + } + } else { + repbody->aclsize = rc; + repbody->valid |= OBD_MD_FLACL; + rc = 0; + } + } + } +#endif if (mdt->mdt_opts.mo_mds_capa) { struct lustre_capa *capa; -- 1.8.3.1