-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#define DEBUG_SUBSYSTEM S_LLITE
-#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
#include <string.h>
-#include <assert.h>
-#include <time.h>
-#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/queue.h>
-#include <fcntl.h>
-
-#include <sysio.h>
-#ifdef HAVE_XTIO_H
-#include <xtio.h>
-#endif
-#include <fs.h>
-#include <mount.h>
-#include <inode.h>
-#ifdef HAVE_FILE_H
-#include <file.h>
-#endif
-
+#include <sys/types.h>
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
+#include <liblustre.h>
+#include <lclient.h>
+#include <lustre_lib.h>
+#include <lustre_lite.h>
+#include <lustre_mdc.h>
+#include <lustre_net.h>
+#include <lustre_req_layout.h>
+#include <obd.h>
+#include <obd_class.h>
+#include <obd_support.h>
#include "llite_lib.h"
/* Pack the required supplementary groups into the supplied groups array.
* array in case it might be useful. Not needed if doing an MDS-side upcall. */
void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2)
{
- LASSERT(i1 != NULL);
- LASSERT(suppgids != NULL);
-
- if (cfs_curproc_is_in_groups(i1->i_stbuf.st_gid))
- suppgids[0] = i1->i_stbuf.st_gid;
- else
- suppgids[0] = -1;
-
- if (i2) {
- if (cfs_curproc_is_in_groups(i2->i_stbuf.st_gid))
- suppgids[1] = i2->i_stbuf.st_gid;
- else
- suppgids[1] = -1;
- } else {
- suppgids[1] = -1;
- }
+ LASSERT(i1 != NULL);
+ LASSERT(suppgids != NULL);
+
+ if (in_group_p(i1->i_stbuf.st_gid))
+ suppgids[0] = i1->i_stbuf.st_gid;
+ else
+ suppgids[0] = -1;
+
+ if (i2) {
+ if (in_group_p(i2->i_stbuf.st_gid))
+ suppgids[1] = i2->i_stbuf.st_gid;
+ else
+ suppgids[1] = -1;
+ } else {
+ suppgids[1] = -1;
+ }
}
void llu_prep_md_op_data(struct md_op_data *op_data, struct inode *i1,
else
fid_zero(&op_data->op_fid2);
- op_data->op_opc = opc;
op_data->op_name = name;
op_data->op_mode = mode;
op_data->op_namelen = namelen;
op_data->op_data = NULL;
}
-void llu_finish_md_op_data(struct md_op_data *op_data)
-{
- OBD_FREE_PTR(op_data);
-}
-
void obdo_refresh_inode(struct inode *dst,
struct obdo *src,
obd_flag valid)
fd->fd_mds_och.och_fid = lli->lli_fid;
lli->lli_file_data = fd;
llu_ioepoch_open(lli, body->ioepoch);
- md_set_open_replay_data(lli->lli_sbi->ll_md_exp,
- &fd->fd_mds_och, it->d.lustre.it_data);
+ md_set_open_replay_data(lli->lli_sbi->ll_md_exp, &fd->fd_mds_och, it);
RETURN(0);
}
struct inode *inode = pnode->p_base->pb_ino;
struct llu_inode_info *lli = llu_i2info(inode);
struct intnl_stat *st = llu_i2stat(inode);
- struct ll_file_data *fd;
struct ptlrpc_request *request;
struct lookup_intent *it;
- struct lov_stripe_md *lsm;
int rc = 0;
ENTRY;
if (!S_ISREG(st->st_mode))
GOTO(out_release, rc = 0);
- fd = lli->lli_file_data;
+ if (lli->lli_has_smd && cl_is_lov_delay_create(flags)) {
+ /* a bit ugly, but better than changing the open() API */
+ unsigned int tmp_flags = flags;
- lsm = lli->lli_smd;
- if (lsm)
- flags &= ~O_LOV_DELAY_CREATE;
- /*XXX: open_flags are overwritten and the previous ones are lost */
- lli->lli_open_flags = flags & ~(O_CREAT | O_EXCL | O_TRUNC);
+ cl_lov_delay_create_clear(&tmp_flags);
+ flags = tmp_flags;
+ }
+ /*XXX: open_flags are overwritten and the previous ones are lost */
+ lli->lli_open_flags = flags & ~(O_CREAT | O_EXCL | O_TRUNC);
out_release:
request = it->d.lustre.it_data;
if (oa == NULL)
GOTO(out_free_memmd, rc = -ENOMEM);
- oa->o_id = lsm->lsm_object_id;
- oa->o_gr = lsm->lsm_object_gr;
+ oa->o_oi = lsm->lsm_oi;
oa->o_mode = body->mode & S_IFMT;
oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLGROUP;
-
+ obdo_set_parent_fid(oa, &llu_i2info(dir)->lli_fid);
if (body->valid & OBD_MD_FLCOOKIE) {
oa->o_valid |= OBD_MD_FLCOOKIE;
oti.oti_logcookies =
}
}
- rc = obd_destroy(llu_i2obdexp(dir), oa, lsm, &oti, NULL, NULL);
- OBDO_FREE(oa);
- if (rc)
- CERROR("obd destroy objid 0x"LPX64" error %d\n",
- lsm->lsm_object_id, rc);
- out_free_memmd:
- obd_free_memmd(llu_i2obdexp(dir), &lsm);
- out:
- return rc;
+ rc = obd_destroy(NULL, llu_i2obdexp(dir), oa, lsm, &oti, NULL, NULL);
+ OBDO_FREE(oa);
+ if (rc)
+ CERROR("obd destroy objid "DOSTID" error %d\n",
+ POSTID(&lsm->lsm_oi), rc);
+out_free_memmd:
+ obd_free_memmd(llu_i2obdexp(dir), &lsm);
+out:
+ return rc;
}
/** Cliens updates SOM attributes on MDS: obd_getattr and md_setattr. */
old_flags & MF_GETATTR_LOCK);
if (rc) {
oa.o_valid = 0;
- if (rc == -ENOENT)
- CDEBUG(D_INODE, "objid "LPX64" is destroyed\n",
- lli->lli_smd->lsm_object_id);
- else
+ if (rc != -ENOENT)
CERROR("inode_getattr failed (%d): unable to "
"send a Size-on-MDS attribute update "
"for inode %llu/%lu\n", rc,