* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
struct intnl_stat *st = llu_i2stat(inode);
mode_t mode = st->st_mode;
- if (current->fsuid == st->st_uid)
- mode >>= 6;
- else if (cfs_curproc_is_in_groups(st->st_gid))
- mode >>= 3;
+ if (current->fsuid == st->st_uid)
+ mode >>= 6;
+ else if (in_group_p(st->st_gid))
+ mode >>= 3;
if ((mode & mask & (MAY_READ|MAY_WRITE|MAY_EXEC)) == mask)
return 0;
st->st_mtime = attr->ia_mtime;
if (ia_valid & ATTR_CTIME)
st->st_ctime = attr->ia_ctime;
- if (ia_valid & ATTR_MODE) {
- st->st_mode = attr->ia_mode;
- if (!cfs_curproc_is_in_groups(st->st_gid) &&
- !cfs_capable(CFS_CAP_FSETID))
- st->st_mode &= ~S_ISGID;
- }
+ if (ia_valid & ATTR_MODE) {
+ st->st_mode = attr->ia_mode;
+ if (!in_group_p(st->st_gid) &&
+ !cfs_capable(CFS_CAP_FSETID))
+ st->st_mode &= ~S_ISGID;
+ }
/* mark_inode_dirty(inode); */
return error;
}
int cmd,
struct file_lock *file_lock)
{
- struct llu_inode_info *lli = llu_i2info(ino);
- struct intnl_stat *st = llu_i2stat(ino);
- struct ldlm_res_id res_id =
- { .name = {fid_seq(&lli->lli_fid),
- fid_oid(&lli->lli_fid),
- fid_ver(&lli->lli_fid),
- LDLM_FLOCK} };
- struct ldlm_enqueue_info einfo = { LDLM_FLOCK, 0, NULL,
- ldlm_flock_completion_ast, NULL, NULL, file_lock };
-
- struct lustre_handle lockh = {0};
- ldlm_policy_data_t flock;
+ struct llu_inode_info *lli = llu_i2info(ino);
+ struct ldlm_res_id res_id =
+ { .name = {fid_seq(&lli->lli_fid),
+ fid_oid(&lli->lli_fid),
+ fid_ver(&lli->lli_fid),
+ LDLM_FLOCK} };
+ struct ldlm_enqueue_info einfo = {
+ .ei_type = LDLM_FLOCK,
+ .ei_mode = 0,
+ .ei_cb_cp = ldlm_flock_completion_ast,
+ .ei_cbdata = file_lock,
+ };
+ struct intnl_stat *st = llu_i2stat(ino);
+ struct lustre_handle lockh = {0};
+ ldlm_policy_data_t flock;
__u64 flags = 0;
- int rc;
+ int rc;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%llu file_lock=%p\n",
(unsigned long long)st->st_ino, file_lock);
if (lmv->desc.ld_tgt_count < 1)
RETURN(rc = -ENODEV);
- if (lmv->tgts[0] && lmv->tgts[0]->ltd_exp != NULL)
+ if (lmv->tgts[0] != NULL && lmv->tgts[0]->ltd_exp != NULL)
rc = ldlm_cli_enqueue(lmv->tgts[0]->ltd_exp, NULL,
&einfo, &res_id, &flock, &flags,
NULL, 0, LVB_T_NONE, &lockh, 0);
LASSERT(sizeof(lum) == sizeof(*lump));
LASSERT(sizeof(lum.lmm_objects[0]) ==
sizeof(lump->lmm_objects[0]));
- if (cfs_copy_from_user(&lum, lump, sizeof(lum)))
+ if (copy_from_user(&lum, lump, sizeof(lum)))
return(-EFAULT);
switch (lum.lmm_magic) {
}
static int llu_lov_setstripe_ea_info(struct inode *ino, int flags,
- struct lov_user_md *lum, int lum_size)
+ struct lov_user_md *lum, int lum_size)
{
- struct llu_sb_info *sbi = llu_i2sbi(ino);
- struct llu_inode_info *lli = llu_i2info(ino);
- struct lookup_intent oit = {.it_op = IT_OPEN, .it_flags = flags};
- struct ldlm_enqueue_info einfo = { LDLM_IBITS, LCK_CR,
- llu_md_blocking_ast, ldlm_completion_ast, NULL, NULL, NULL };
- struct ptlrpc_request *req = NULL;
- struct lustre_md md;
- struct md_op_data data = {{ 0 }};
- struct lustre_handle lockh;
- int rc = 0;
- ENTRY;
+ struct llu_sb_info *sbi = llu_i2sbi(ino);
+ struct llu_inode_info *lli = llu_i2info(ino);
+ struct lookup_intent oit = {.it_op = IT_OPEN, .it_flags = flags};
+ struct ldlm_enqueue_info einfo = {
+ .ei_type = LDLM_IBITS,
+ .ei_mode = LCK_CR,
+ .ei_cb_bl = llu_md_blocking_ast,
+ .ei_cb_cp = ldlm_completion_ast,
+ };
+ struct ptlrpc_request *req = NULL;
+ struct lustre_md md;
+ struct md_op_data data = {{ 0 }};
+ struct lustre_handle lockh;
+ int rc = 0;
+ ENTRY;
if (lli->lli_has_smd) {
- CDEBUG(D_IOCTL, "stripe already exists for ino "DFID"\n",
- PFID(&lli->lli_fid));
- return -EEXIST;
- }
+ CDEBUG(D_IOCTL, "stripe already exists for ino "DFID"\n",
+ PFID(&lli->lli_fid));
+ return -EEXIST;
+ }
llu_prep_md_op_data(&data, NULL, ino, NULL, 0, O_RDWR,
LUSTRE_OPC_ANY);
LASSERT(sizeof(lum) == sizeof(*lump));
LASSERT(sizeof(lum.lmm_objects[0]) == sizeof(lump->lmm_objects[0]));
- if (cfs_copy_from_user(&lum, lump, sizeof(lum)))
+ if (copy_from_user(&lum, lump, sizeof(lum)))
RETURN(-EFAULT);
rc = llu_lov_setstripe_ea_info(ino, flags, &lum, sizeof(lum));
OBD_FREE(osc, strlen(lprof->lp_dt) + instlen + 2);
if (mdc)
OBD_FREE(mdc, strlen(lprof->lp_md) + instlen + 2);
- OBD_FREE(sbi, sizeof(*sbi));
+ if (err != 0)
+ OBD_FREE(sbi, sizeof(*sbi));
liblustre_wait_idle();
return err;
}