*
* Lustre Light Super operations
*
- * Copyright (c) 2002, 2003 Cluster File Systems, Inc.
+ * Copyright (c) 2002-2004 Cluster File Systems, Inc.
*
* This file is part of Lustre, http://www.lustre.org.
*
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <sys/queue.h>
+
#ifndef __CYGWIN__
# include <sys/statvfs.h>
#else
# include <sys/statfs.h>
#endif
+#ifdef HAVE_XTIO_H
+#include <xtio.h>
+#endif
#include <sysio.h>
-#include <fs.h>
#include <mount.h>
#include <inode.h>
+#include <fs.h>
+#ifdef HAVE_FILE_H
#include <file.h>
+#endif
+#undef LIST_HEAD
#include "llite_lib.h"
+#ifndef MAY_EXEC
+# define MAY_EXEC 1
+# define MAY_WRITE 2
+# define MAY_READ 4
+#endif
+
+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
+
+static int ll_permission(struct inode *inode, int mask)
+{
+ struct llu_inode_info *lli = llu_i2info(inode);
+ mode_t mode = lli->lli_st_mode;
+
+ if (current->fsuid == lli->lli_st_uid)
+ mode >>= 6;
+ else if (in_group_p(lli->lli_st_gid))
+ mode >>= 3;
+
+ if ((mode & mask & (MAY_READ|MAY_WRITE|MAY_EXEC)) == mask)
+ return 0;
+
+ if ((mask & (MAY_READ|MAY_WRITE)) ||
+ (lli->lli_st_mode & S_IXUGO))
+ if (capable(CAP_DAC_OVERRIDE))
+ return 0;
+
+ if (mask == MAY_READ ||
+ (S_ISDIR(lli->lli_st_mode) && !(mask & MAY_WRITE))) {
+ if (capable(CAP_DAC_READ_SEARCH))
+ return 0;
+ }
+
+ return -EACCES;
+}
+
static void llu_fsop_gone(struct filesys *fs)
{
- struct llu_sb_info *sbi = (struct llu_sb_info *) fs->fs_private;
- struct obd_device *obd = class_exp2obd(sbi->ll_mdc_exp);
- struct ll_fid rootfid;
+ struct llu_sb_info *sbi = (struct llu_sb_info *)fs->fs_private;
+ struct obd_device *obd = class_exp2obd(sbi->ll_md_exp);
+ struct lustre_cfg_bufs bufs;
+ struct lustre_cfg *lcfg;
+ int next = 0;
ENTRY;
list_del(&sbi->ll_conn_chain);
- obd_disconnect(sbi->ll_osc_exp, 0);
-
- /* NULL request to force sync on the MDS, and get the last_committed
- * value to flush remaining RPCs from the sending queue on client.
- *
- * XXX This should be an mdc_sync() call to sync the whole MDS fs,
- * which we can call for other reasons as well.
- */
- if (!obd->obd_no_recov)
- mdc_getstatus(sbi->ll_mdc_exp, &rootfid);
+ obd_disconnect(sbi->ll_dt_exp, 0);
+ obd_disconnect(sbi->ll_md_exp, 0);
- obd_disconnect(sbi->ll_mdc_exp, 0);
+ while ((obd = class_devices_in_group(&sbi->ll_sb_uuid, &next)) != NULL)
+ {
+ int err;
+
+ lustre_cfg_bufs_reset(&bufs, obd->obd_name);
+ lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs);
+ err = class_process_config(&lcfg);
+ if (err) {
+ CERROR("cleanup failed: %s\n", obd->obd_name);
+ }
+
+ lcfg->lcfg_command = LCFG_DETACH;
+ err = class_process_config(&lcfg);
+ lustre_cfg_free(lcfg);
+ if (err) {
+ CERROR("detach failed: %s\n", obd->obd_name);
+ }
+ }
+ obd_disconnect(sbi->ll_md_exp, 0);
OBD_FREE(sbi, sizeof(*sbi));
-
EXIT;
}
-static struct inode_ops llu_inode_ops;
+struct inode_ops llu_inode_ops;
void llu_update_inode(struct inode *inode, struct mds_body *body,
struct lov_stripe_md *lsm)
}
}
+ id_assign_fid(&lli->lli_id, &body->id1);
+
+ if ((body->valid & OBD_MD_FLID) || (body->valid & OBD_MD_FLGENER))
+ id_assign_stc(&lli->lli_id, &body->id1);
if (body->valid & OBD_MD_FLID)
- lli->lli_st_ino = body->ino;
+ lli->lli_st_ino = id_ino(&body->id1);
+ if (body->valid & OBD_MD_FLGENER)
+ lli->lli_st_generation = id_gen(&body->id1);
+
if (body->valid & OBD_MD_FLATIME)
LTIME_S(lli->lli_st_atime) = body->atime;
if (body->valid & OBD_MD_FLMTIME)
lli->lli_st_flags = body->flags;
if (body->valid & OBD_MD_FLNLINK)
lli->lli_st_nlink = body->nlink;
- if (body->valid & OBD_MD_FLGENER)
- lli->lli_st_generation = body->generation;
if (body->valid & OBD_MD_FLRDEV)
lli->lli_st_rdev = body->rdev;
if (body->valid & OBD_MD_FLSIZE)
lli->lli_st_size = body->size;
if (body->valid & OBD_MD_FLBLOCKS)
lli->lli_st_blocks = body->blocks;
-
- /* fillin fid */
- if (body->valid & OBD_MD_FLID)
- lli->lli_fid.id = body->ino;
- if (body->valid & OBD_MD_FLGENER)
- lli->lli_fid.generation = body->generation;
- if (body->valid & OBD_MD_FLTYPE)
- lli->lli_fid.f_type = body->mode & S_IFMT;
}
-void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
+void obdo_to_inode(struct inode *dst, struct obdo *src, obd_valid valid)
{
struct llu_inode_info *lli = llu_i2info(dst);
valid &= src->o_valid;
if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
- CDEBUG(D_INODE, "valid %x, cur time %lu/%lu, new %lu/%lu\n",
+ CDEBUG(D_INODE, "valid "LPX64", cur time %lu/%lu, new %lu/%lu\n",
src->o_valid,
LTIME_S(lli->lli_st_mtime), LTIME_S(lli->lli_st_ctime),
(long)src->o_mtime, (long)src->o_ctime);
lli->lli_st_gid = src->o_gid;
if (valid & OBD_MD_FLFLAGS)
lli->lli_st_flags = src->o_flags;
- if (valid & OBD_MD_FLNLINK)
- lli->lli_st_nlink = src->o_nlink;
if (valid & OBD_MD_FLGENER)
lli->lli_st_generation = src->o_generation;
- if (valid & OBD_MD_FLRDEV)
- lli->lli_st_rdev = to_kdev_t(src->o_rdev);
}
#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
-void obdo_from_inode(struct obdo *dst, struct inode *src, obd_flag valid)
+void obdo_from_inode(struct obdo *dst, struct inode *src, obd_valid valid)
{
struct llu_inode_info *lli = llu_i2info(src);
- obd_flag newvalid = 0;
+ obd_valid newvalid = 0;
if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
- CDEBUG(D_INODE, "valid %x, new time %lu/%lu\n",
+ CDEBUG(D_INODE, "valid "LPX64", new time %lu/%lu\n",
valid, LTIME_S(lli->lli_st_mtime),
LTIME_S(lli->lli_st_ctime));
dst->o_flags = lli->lli_st_flags;
newvalid |= OBD_MD_FLFLAGS;
}
- if (valid & OBD_MD_FLNLINK) {
- dst->o_nlink = lli->lli_st_nlink;
- newvalid |= OBD_MD_FLNLINK;
- }
if (valid & OBD_MD_FLGENER) {
dst->o_generation = lli->lli_st_generation;
newvalid |= OBD_MD_FLGENER;
}
- if (valid & OBD_MD_FLRDEV) {
- dst->o_rdev = (__u32)kdev_t_to_nr(lli->lli_st_rdev);
- newvalid |= OBD_MD_FLRDEV;
- }
dst->o_valid |= newvalid;
}
int llu_inode_getattr(struct inode *inode, struct lov_stripe_md *lsm)
{
struct llu_inode_info *lli = llu_i2info(inode);
- struct obd_export *exp = llu_i2obdexp(inode);
+ struct obd_export *exp = llu_i2dtexp(inode);
struct ptlrpc_request_set *set;
struct obdo oa;
- obd_flag refresh_valid;
+ obd_valid refresh_valid;
int rc;
ENTRY;
obdo_refresh_inode(inode, &oa, refresh_valid);
-/*
- if (inode->i_blksize < PAGE_CACHE_SIZE)
- inode->i_blksize = PAGE_CACHE_SIZE;
-
- CDEBUG(D_INODE, "objid "LPX64" size %Lu, blocks %lu, blksize %lu\n",
- lsm->lsm_object_id, inode->i_size, inode->i_blocks,
- inode->i_blksize);
-*/
RETURN(0);
}
static struct inode* llu_new_inode(struct filesys *fs,
- struct ll_fid *fid)
+ struct lustre_id *id)
{
struct inode *inode;
struct llu_inode_info *lli;
lli->lli_maxbytes = (__u64)(~0UL);
lli->lli_file_data = NULL;
- lli->lli_sysio_fid.fid_data = &lli->lli_fid;
- lli->lli_sysio_fid.fid_len = sizeof(lli->lli_fid);
+ lli->lli_sysio_fid.fid_data = &lli->lli_id;
+ lli->lli_sysio_fid.fid_len = sizeof(lli->lli_id);
- memcpy(&lli->lli_fid, fid, sizeof(*fid));
+ memcpy(&lli->lli_id, id, sizeof(*id));
/* file identifier is needed by functions like _sysio_i_find() */
inode = _sysio_i_new(fs, &lli->lli_sysio_fid,
#ifndef AUTOMOUNT_FILE_NAME
- fid->f_type & S_IFMT,
+ id->li_stc.u.e3s.l3s_type & S_IFMT,
#else
- fid->f_type, /* all of the bits! */
+ id->li_stc.u.e3s.l3s_type, /* all of the bits! */
#endif
0, 0,
&llu_inode_ops, lli);
return inode;
}
-#if 0
-static int ll_intent_to_lock_mode(struct lookup_intent *it)
-{
- /* CREAT needs to be tested before open (both could be set) */
- if (it->it_op & IT_CREAT)
- return LCK_PW;
- else if (it->it_op & (IT_READDIR | IT_GETATTR | IT_OPEN | IT_LOOKUP))
- return LCK_PR;
-
- LBUG();
- RETURN(-EINVAL);
-}
-#endif
-
-#if 0
-int ll_it_open_error(int phase, struct lookup_intent *it)
-{
- if (it_disposition(it, DISP_OPEN_OPEN)) {
- if (phase == DISP_OPEN_OPEN)
- return it->d.lustre.it_status;
- else
- return 0;
- }
-
- if (it_disposition(it, DISP_OPEN_CREATE)) {
- if (phase == DISP_OPEN_CREATE)
- return it->d.lustre.it_status;
- else
- return 0;
- }
-
- if (it_disposition(it, DISP_LOOKUP_EXECD)) {
- if (phase == DISP_LOOKUP_EXECD)
- return it->d.lustre.it_status;
- else
- return 0;
- }
- CERROR("it disp: %X, status: %d\n", it->d.lustre.it_disposition, it->d.lustre.it_status);
- LBUG();
- return 0;
-}
-#endif
-
-static int llu_have_md_lock(struct inode *inode)
+static int llu_have_md_lock(struct inode *inode, __u64 lockpart)
{
struct llu_sb_info *sbi = llu_i2sbi(inode);
struct llu_inode_info *lli = llu_i2info(inode);
struct lustre_handle lockh;
struct ldlm_res_id res_id = { .name = {0} };
struct obd_device *obddev;
+ ldlm_policy_data_t policy = { .l_inodebits = { lockpart } };
int flags;
ENTRY;
LASSERT(inode);
- obddev = sbi->ll_mdc_exp->exp_obd;
- res_id.name[0] = lli->lli_st_ino;
- res_id.name[1] = lli->lli_st_generation;
+ obddev = sbi->ll_md_exp->exp_obd;
+ res_id.name[0] = id_fid(&lli->lli_id);
+ res_id.name[1] = id_group(&lli->lli_id);
CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]);
+ /* FIXME use LDLM_FL_TEST_LOCK instead */
flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING;
- if (ldlm_lock_match(obddev->obd_namespace, flags, &res_id, LDLM_PLAIN,
- NULL, 0, LCK_PR, &lockh)) {
+ if (ldlm_lock_match(obddev->obd_namespace, flags, &res_id, LDLM_IBITS,
+ &policy, LCK_PR, &lockh)) {
ldlm_lock_decref(&lockh, LCK_PR);
RETURN(1);
}
- if (ldlm_lock_match(obddev->obd_namespace, flags, &res_id, LDLM_PLAIN,
- NULL, 0, LCK_PW, &lockh)) {
+ if (ldlm_lock_match(obddev->obd_namespace, flags, &res_id, LDLM_IBITS,
+ &policy, LCK_PW, &lockh)) {
ldlm_lock_decref(&lockh, LCK_PW);
RETURN(1);
}
RETURN(0);
}
- if (!llu_have_md_lock(inode)) {
+ if (!llu_have_md_lock(inode, MDS_INODELOCK_UPDATE)) {
struct lustre_md md;
struct ptlrpc_request *req = NULL;
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct ll_fid fid;
- unsigned long valid = 0;
+ struct lustre_id id;
+ __u64 valid = 0;
int rc, ealen = 0;
- /* Why don't we update all valid MDS fields here, if we're
- * doing an RPC anyways? -phil */
+ /* Why don't we update all valid MDS fields here, if we're doing
+ * an RPC anyways? -phil */
if (S_ISREG(lli->lli_st_mode)) {
- ealen = obd_size_diskmd(sbi->ll_osc_exp, NULL);
+ ealen = obd_size_diskmd(sbi->ll_dt_exp, NULL);
valid |= OBD_MD_FLEASIZE;
}
- ll_inode2fid(&fid, inode);
- rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, ealen, &req);
+ ll_inode2id(&id, inode);
+ rc = mdc_getattr(sbi->ll_md_exp, &id, valid, NULL, 0,
+ ealen, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, lli->lli_st_ino);
RETURN(-abs(rc));
}
- rc = mdc_req2lustre_md(req, 0, sbi->ll_osc_exp, &md);
+ rc = mdc_req2lustre_md(sbi->ll_md_exp, req, 0,
+ sbi->ll_dt_exp, &md);
/* XXX Too paranoid? */
if (((md.body->valid ^ valid) & OBD_MD_FLEASIZE) &&
llu_update_inode(inode, md.body, md.lsm);
if (md.lsm != NULL && llu_i2info(inode)->lli_smd != md.lsm)
- obd_free_memmd(sbi->ll_osc_exp, &md.lsm);
+ obd_free_memmd(sbi->ll_dt_exp, &md.lsm);
if (md.body->valid & OBD_MD_FLSIZE)
set_bit(LLI_F_HAVE_MDS_SIZE_LOCK,
if (!lsm) /* object not yet allocated, don't validate size */
RETURN(0);
- /*
- * unfortunately stat comes in through revalidate and we don't
- * differentiate this use from initial instantiation. we're
- * also being wildly conservative and flushing write caches
- * so that stat really returns the proper size.
- */
- {
- struct ldlm_extent extent = {0, OBD_OBJECT_EOF};
- struct lustre_handle lockh = {0};
- ldlm_error_t err;
-
- err = llu_extent_lock(NULL, inode, lsm, LCK_PR, &extent, &lockh);
- if (err != ELDLM_OK)
- RETURN(err);
-
- llu_extent_unlock(NULL, inode, lsm, LCK_PR, &lockh);
- }
- RETURN(0);
+ /* ll_glimpse_size will prefer locally cached writes if they extend
+ * the file */
+ RETURN(llu_glimpse_size(inode));
}
static void copy_stat_buf(struct inode *ino, struct intnl_stat *b)
int rc;
ENTRY;
+ liblustre_wait_event(0);
+
if (!ino) {
LASSERT(pno);
LASSERT(pno->p_base->pb_ino);
rc = llu_inode_revalidate(ino);
if (!rc) {
copy_stat_buf(ino, b);
-
- if (llu_i2info(ino)->lli_it) {
- struct lookup_intent *it;
-
- LL_GET_INTENT(ino, it);
- it->it_op_release(it);
- OBD_FREE(it, sizeof(*it));
- }
+ LASSERT(!llu_i2info(ino)->lli_it);
}
RETURN(rc);
static int null_if_equal(struct ldlm_lock *lock, void *data)
{
- if (data == lock->l_ast_data)
+ if (data == lock->l_ast_data) {
lock->l_ast_data = NULL;
- if (lock->l_req_mode != lock->l_granted_mode)
- return LDLM_ITER_STOP;
+ if (lock->l_req_mode != lock->l_granted_mode)
+ LDLM_ERROR(lock,"clearing inode with ungranted lock\n");
+ }
return LDLM_ITER_CONTINUE;
}
void llu_clear_inode(struct inode *inode)
{
- struct ll_fid fid;
+ struct lustre_id id;
struct llu_inode_info *lli = llu_i2info(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%lu(%p)\n", lli->lli_st_ino,
lli->lli_st_generation, inode);
- ll_inode2fid(&fid, inode);
+ ll_inode2id(&id, inode);
clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(lli->lli_flags));
- mdc_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode);
+ mdc_change_cbdata(sbi->ll_md_exp, &id, null_if_equal, inode);
if (lli->lli_smd)
- obd_change_cbdata(sbi->ll_osc_exp, lli->lli_smd,
+ obd_change_cbdata(sbi->ll_dt_exp, lli->lli_smd,
null_if_equal, inode);
if (lli->lli_smd) {
- obd_free_memmd(sbi->ll_osc_exp, &lli->lli_smd);
+ obd_free_memmd(sbi->ll_dt_exp, &lli->lli_smd);
lli->lli_smd = NULL;
}
struct llu_inode_info *lli = llu_i2info(inode);
ENTRY;
+ liblustre_wait_event(0);
llu_clear_inode(inode);
OBD_FREE(lli, sizeof(*lli));
* I don't believe it is possible to get e.g. ATTR_MTIME_SET and ATTR_SIZE
* at the same time.
*/
-#define OST_ATTR (ATTR_MTIME | ATTR_MTIME_SET | ATTR_CTIME | \
- ATTR_ATIME | ATTR_ATIME_SET | ATTR_SIZE)
int llu_setattr_raw(struct inode *inode, struct iattr *attr)
{
struct lov_stripe_md *lsm = llu_i2info(inode)->lli_smd;
/* If only OST attributes being set on objects, don't do MDS RPC.
* In that case, we need to check permissions and update the local
* inode ourselves so we can call obdo_from_inode() always. */
- if (ia_valid & (lsm ? ~(OST_ATTR | ATTR_FROM_OPEN | ATTR_RAW) : ~0)) {
+ if (ia_valid & (lsm ? ~(ATTR_SIZE | ATTR_FROM_OPEN | ATTR_RAW) : ~0)) {
struct lustre_md md;
- llu_prepare_mdc_op_data(&op_data, inode, NULL, NULL, 0, 0);
-
- rc = mdc_setattr(sbi->ll_mdc_exp, &op_data,
- attr, NULL, 0, NULL, 0, &request);
+ llu_prepare_mdc_data(&op_data, inode, NULL, NULL, 0, 0);
+ rc = mdc_setattr(sbi->ll_md_exp, &op_data,
+ attr, NULL, 0, NULL, 0, &request);
+
if (rc) {
ptlrpc_req_finished(request);
if (rc != -EPERM && rc != -EACCES)
RETURN(rc);
}
- rc = mdc_req2lustre_md(request, 0, sbi->ll_osc_exp, &md);
+ rc = mdc_req2lustre_md(sbi->ll_md_exp, request, 0,
+ sbi->ll_dt_exp, &md);
if (rc) {
ptlrpc_req_finished(request);
RETURN(rc);
}
+
+ /* Won't invoke vmtruncate as we already cleared ATTR_SIZE,
+ * but needed to set timestamps backwards on utime. */
+ inode_setattr(inode, attr);
llu_update_inode(inode, md.body, md.lsm);
ptlrpc_req_finished(request);
/* from sys_utime() */
if (!(ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET))) {
if (current->fsuid != lli->lli_st_uid &&
- (rc = ll_permission(inode, 0/*MAY_WRITE*/, NULL)) != 0)
+ (rc = ll_permission(inode, MAY_WRITE)) != 0)
RETURN(rc);
} else {
/* from inode_change_ok() */
}
if (ia_valid & ATTR_SIZE) {
- struct ldlm_extent extent = { .start = attr->ia_size,
- .end = OBD_OBJECT_EOF };
+ ldlm_policy_data_t policy = { .l_extent = {attr->ia_size,
+ OBD_OBJECT_EOF} };
struct lustre_handle lockh = { 0 };
int err, ast_flags = 0;
/* XXX when we fix the AST intents to pass the discard-range
* XXX extent, make ast_flags always LDLM_AST_DISCARD_DATA
* XXX here. */
-
- /* Writeback uses inode->i_size to determine how far out
- * its cached pages go. ll_truncate gets a PW lock, canceling
- * our lock, _after_ it has updated i_size. this can confuse
- *
- * We really need to get our PW lock before we change
- * inode->i_size. If we don't we can race with other
- * i_size updaters on our node, like ll_file_read. We
- * can also race with i_size propogation to other
- * nodes through dirtying and writeback of final cached
- * pages. This last one is especially bad for racing
- * o_append users on other nodes. */
- if (extent.start == 0)
+ if (attr->ia_size == 0)
ast_flags = LDLM_AST_DISCARD_DATA;
- rc = llu_extent_lock_no_validate(NULL, inode, lsm, LCK_PW,
- &extent, &lockh, ast_flags);
+
+ rc = llu_extent_lock(NULL, inode, lsm, LCK_PW, &policy,
+ &lockh, ast_flags);
if (rc != ELDLM_OK) {
if (rc > 0)
RETURN(-ENOLCK);
}
rc = llu_vmtruncate(inode, attr->ia_size);
- if (rc == 0)
- set_bit(LLI_F_HAVE_OST_SIZE_LOCK,
- &llu_i2info(inode)->lli_flags);
/* unlock now as we don't mind others file lockers racing with
* the mds updates below? */
oa.o_valid = OBD_MD_FLID;
obdo_from_inode(&oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
OBD_MD_FLMTIME | OBD_MD_FLCTIME);
- rc = obd_setattr(sbi->ll_osc_exp, &oa, lsm, NULL);
+ rc = obd_setattr(sbi->ll_dt_exp, &oa, lsm, NULL);
if (rc)
CERROR("obd_setattr fails: rc=%d\n", rc);
}
RETURN(rc);
}
-/* FIXME here we simply act as a thin layer to glue it with
+/* here we simply act as a thin layer to glue it with
* llu_setattr_raw(), which is copy from kernel
*/
static int llu_iop_setattr(struct pnode *pno,
struct iattr iattr;
ENTRY;
+ liblustre_wait_event(0);
+
+ LASSERT(!(mask & ~(SETATTR_MTIME | SETATTR_ATIME |
+ SETATTR_UID | SETATTR_GID |
+ SETATTR_LEN | SETATTR_MODE)));
memset(&iattr, 0, sizeof(iattr));
if (mask & SETATTR_MODE) {
iattr.ia_valid |= ATTR_GID;
}
if (mask & SETATTR_LEN) {
- iattr.ia_size = stbuf->st_size; /* FIXME signed expansion problem */
+ iattr.ia_size = stbuf->st_size; /* XXX signed expansion problem */
iattr.ia_valid |= ATTR_SIZE;
}
if (llu_i2info(dir)->lli_st_nlink >= EXT2_LINK_MAX)
RETURN(err);
- llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- err = mdc_create(sbi->ll_mdc_exp, &op_data,
+ llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ err = mdc_create(sbi->ll_md_exp, &op_data,
tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO,
current->fsuid, current->fsgid, 0, &request);
ptlrpc_req_finished(request);
{
struct llu_inode_info *lli = llu_i2info(inode);
struct llu_sb_info *sbi = llu_i2sbi(inode);
- struct ll_fid fid;
+ struct lustre_id id;
struct mds_body *body;
int rc, symlen = lli->lli_st_size + 1;
ENTRY;
RETURN(0);
}
- ll_inode2fid(&fid, inode);
- rc = mdc_getattr(sbi->ll_mdc_exp, &fid,
- OBD_MD_LINKNAME, symlen, request);
+ ll_inode2id(&id, inode);
+ rc = mdc_getattr(sbi->ll_md_exp, &id,
+ OBD_MD_LINKNAME, NULL, 0, symlen, request);
if (rc) {
CERROR("inode %lu: rc = %d\n", lli->lli_st_ino, rc);
RETURN(rc);
int rc;
ENTRY;
- /* on symlinks lli_open_sem protects lli_symlink_name allocation/data */
-/*
- down(&lli->lli_open_sem);
-*/
rc = llu_readlink_internal(inode, &request, &symname);
if (rc)
GOTO(out, rc);
ptlrpc_req_finished(request);
out:
-/*
- up(&lli->lli_open_sem);
-*/
RETURN(rc);
}
int err = -EMLINK;
ENTRY;
- CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu\n",
- pno->p_base->pb_name.name, llu_i2info(dir)->lli_st_ino);
+ CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu\n",
+ (int)pno->p_base->pb_name.len, pno->p_base->pb_name.name,
+ llu_i2info(dir)->lli_st_ino);
if (llu_i2info(dir)->lli_st_nlink >= EXT2_LINK_MAX)
RETURN(err);
case S_IFBLK:
case S_IFIFO:
case S_IFSOCK:
- llu_prepare_mdc_op_data(&op_data, dir, NULL,
- pno->p_base->pb_name.name,
- pno->p_base->pb_name.len,
- 0);
- err = mdc_create(sbi->ll_mdc_exp, &op_data, NULL, 0, mode,
+ llu_prepare_mdc_data(&op_data, dir, NULL,
+ pno->p_base->pb_name.name,
+ pno->p_base->pb_name.len,
+ 0);
+ err = mdc_create(sbi->ll_md_exp, &op_data, NULL, 0, mode,
current->fsuid, current->fsgid, dev, &request);
ptlrpc_req_finished(request);
break;
RETURN(err);
}
-#if 0
-static int llu_mdc_unlink(struct inode *dir, struct inode *child, __u32 mode,
- const char *name, int len)
-{
- struct ptlrpc_request *request = NULL;
- struct mds_body *body;
- struct lov_mds_md *eadata;
- struct lov_stripe_md *lsm = NULL;
- struct obd_trans_info oti = { 0 };
- struct mdc_op_data op_data;
- struct obdo *oa;
- int rc;
- ENTRY;
-
- llu_prepare_mdc_op_data(&op_data, dir, child, name, len, mode);
- rc = mdc_unlink(&llu_i2sbi(dir)->ll_mdc_conn, &op_data, &request);
- if (rc)
- GOTO(out, rc);
- /* req is swabbed so this is safe */
- body = lustre_msg_buf(request->rq_repmsg, 0, sizeof(*body));
-
- if (!(body->valid & OBD_MD_FLEASIZE))
- GOTO(out, rc = 0);
-
- if (body->eadatasize == 0) {
- CERROR("OBD_MD_FLEASIZE set but eadatasize zero\n");
- GOTO(out, rc = -EPROTO);
- }
-
- /* The MDS sent back the EA because we unlinked the last reference
- * to this file. Use this EA to unlink the objects on the OST.
- * It's opaque so we don't swab here; we leave it to obd_unpackmd() to
- * check it is complete and sensible. */
- eadata = lustre_swab_repbuf(request, 1, body->eadatasize, NULL);
- LASSERT(eadata != NULL);
- if (eadata == NULL) {
- CERROR("Can't unpack MDS EA data\n");
- GOTO(out, rc = -EPROTO);
- }
-
- rc = obd_unpackmd(llu_i2obdconn(dir), &lsm, eadata, body->eadatasize);
- if (rc < 0) {
- CERROR("obd_unpackmd: %d\n", rc);
- GOTO(out, rc);
- }
- LASSERT(rc >= sizeof(*lsm));
-
- oa = obdo_alloc();
- if (oa == NULL)
- GOTO(out_free_memmd, rc = -ENOMEM);
-
- oa->o_id = lsm->lsm_object_id;
- oa->o_mode = body->mode & S_IFMT;
- oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE;
-
- if (body->valid & OBD_MD_FLCOOKIE) {
- oa->o_valid |= OBD_MD_FLCOOKIE;
- oti.oti_logcookies = lustre_msg_buf(request->rq_repmsg, 3,
- body->eadatasize);
- }
-
- rc = obd_destroy(llu_i2obdconn(dir), oa, lsm, &oti);
- 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_i2obdconn(dir), &lsm);
- out:
- ptlrpc_req_finished(request);
- return rc;
-}
-#endif
-
static int llu_iop_link_raw(struct pnode *old, struct pnode *new)
{
struct inode *src = old->p_base->pb_ino;
LASSERT(src);
LASSERT(dir);
- llu_prepare_mdc_op_data(&op_data, src, dir, name, namelen, 0);
- rc = mdc_link(llu_i2sbi(src)->ll_mdc_exp, &op_data, &request);
+ liblustre_wait_event(0);
+ llu_prepare_mdc_data(&op_data, src, dir, name, namelen, 0);
+ rc = mdc_link(llu_i2sbi(src)->ll_md_exp, &op_data, &request);
ptlrpc_req_finished(request);
+ liblustre_wait_event(0);
RETURN(rc);
}
+/*
+ * libsysio will clear the inode immediately after return
+ */
static int llu_iop_unlink_raw(struct pnode *pno)
{
struct inode *dir = pno->p_base->pb_parent->pb_ino;
LASSERT(target);
- llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- rc = mdc_unlink(llu_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
- if (!rc) {
+ liblustre_wait_event(0);
+ llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ rc = mdc_unlink(llu_i2sbi(dir)->ll_md_exp, &op_data, &request);
+ if (!rc)
rc = llu_objects_destroy(request, dir);
-
- llu_i2info(target)->lli_stale_flag = 1;
- unhook_stale_inode(pno);
- }
-
ptlrpc_req_finished(request);
+ liblustre_wait_event(0);
RETURN(rc);
}
-/* FIXME
- * following cases need to be considered later:
- * - rename an opened file/dir
- * - an opened file be removed in rename
- * - rename to remove and hardlink (?opened)
- */
static int llu_iop_rename_raw(struct pnode *old, struct pnode *new)
{
struct inode *src = old->p_parent->p_base->pb_ino;
struct inode *tgt = new->p_parent->p_base->pb_ino;
- struct inode *tgtinode = new->p_base->pb_ino;
const char *oldname = old->p_base->pb_name.name;
int oldnamelen = old->p_base->pb_name.len;
const char *newname = new->p_base->pb_name.name;
LASSERT(src);
LASSERT(tgt);
- llu_prepare_mdc_op_data(&op_data, src, tgt, NULL, 0, 0);
- rc = mdc_rename(llu_i2sbi(src)->ll_mdc_exp, &op_data,
+ llu_prepare_mdc_data(&op_data, src, tgt, NULL, 0, 0);
+ rc = mdc_rename(llu_i2sbi(src)->ll_md_exp, &op_data,
oldname, oldnamelen, newname, newnamelen,
&request);
if (!rc) {
rc = llu_objects_destroy(request, src);
-
- if (tgtinode) {
- llu_i2info(tgtinode)->lli_stale_flag = 1;
- unhook_stale_inode(new);
- }
}
ptlrpc_req_finished(request);
RETURN(rc);
}
-#if 0
+#ifdef _HAVE_STATVFS
static int llu_statfs_internal(struct llu_sb_info *sbi,
struct obd_statfs *osfs,
unsigned long max_age)
int rc;
ENTRY;
- rc = obd_statfs(class_exp2obd(sbi->ll_mdc_exp), osfs, max_age);
+ rc = obd_statfs(class_exp2obd(sbi->ll_md_exp), osfs, max_age);
if (rc) {
CERROR("mdc_statfs fails: rc = %d\n", rc);
RETURN(rc);
CDEBUG(D_SUPER, "MDC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
- rc = obd_statfs(class_exp2obd(sbi->ll_osc_exp), &obd_osfs, max_age);
+ rc = obd_statfs(class_exp2obd(sbi->ll_dt_exp), &obd_osfs, max_age);
if (rc) {
CERROR("obd_statfs fails: rc = %d\n", rc);
RETURN(rc);
RETURN(rc);
}
-static int llu_statfs(struct llu_sb_info *sbi, struct kstatfs *sfs)
+static int llu_statfs(struct llu_sb_info *sbi, struct statfs *sfs)
{
struct obd_statfs osfs;
int rc;
int rc;
ENTRY;
+ liblustre_wait_event(0);
+
#ifndef __CYGWIN__
LASSERT(pno->p_base->pb_ino);
rc = llu_statfs(llu_i2sbi(pno->p_base->pb_ino), &fs);
buf->f_files = fs.f_files; /* Total number serial numbers */
buf->f_ffree = fs.f_ffree; /* Number free serial numbers */
buf->f_favail = fs.f_ffree; /* Number free ser num for non-privileged*/
- buf->f_fsid = fs.f_fsid.__val[1];
+ buf->f_fsid = fs.f_fstc.__val[1];
buf->f_flag = 0; /* No equiv in statfs; maybe use type? */
buf->f_namemax = fs.f_namelen;
#endif
RETURN(0);
}
-#endif
+#endif /* _HAVE_STATVFS */
static int llu_iop_mkdir_raw(struct pnode *pno, mode_t mode)
{
struct mdc_op_data op_data;
int err = -EMLINK;
ENTRY;
- CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%lu(%p)\n",
- name, lli->lli_st_ino, lli->lli_st_generation, dir);
+ CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%lu(%p)\n",
+ len, name, lli->lli_st_ino, lli->lli_st_generation, dir);
if (lli->lli_st_nlink >= EXT2_LINK_MAX)
RETURN(err);
mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR;
- llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0);
- err = mdc_create(llu_i2sbi(dir)->ll_mdc_exp, &op_data, NULL, 0, mode,
+ llu_prepare_mdc_data(&op_data, dir, NULL, name, len, 0);
+ err = mdc_create(llu_i2sbi(dir)->ll_md_exp, &op_data, NULL, 0, mode,
current->fsuid, current->fsgid, 0, &request);
ptlrpc_req_finished(request);
RETURN(err);
struct llu_inode_info *lli = llu_i2info(dir);
int rc;
ENTRY;
- CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%lu(%p)\n",
- name, lli->lli_st_ino, lli->lli_st_generation, dir);
+ CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%lu(%p)\n",
+ len, name, lli->lli_st_ino, lli->lli_st_generation, dir);
- llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, S_IFDIR);
- rc = mdc_unlink(llu_i2sbi(dir)->ll_mdc_exp, &op_data, &request);
+ llu_prepare_mdc_data(&op_data, dir, NULL, name, len, S_IFDIR);
+ rc = mdc_unlink(llu_i2sbi(dir)->ll_md_exp, &op_data, &request);
ptlrpc_req_finished(request);
- /* libsysio: remove the pnode right away */
- if (!rc) {
- llu_i2info(pno->p_base->pb_ino)->lli_stale_flag = 1;
- unhook_stale_inode(pno);
+ RETURN(rc);
+}
+
+#ifdef O_DIRECT
+#define FCNTL_FLMASK (O_APPEND|O_NONBLOCK|O_ASYNC|O_DIRECT)
+#else
+#define FCNTL_FLMASK (O_APPEND|O_NONBLOCK|O_ASYNC)
+#endif
+#define FCNTL_FLMASK_INVALID (O_NONBLOCK|O_ASYNC)
+
+static int llu_iop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn)
+{
+ struct llu_inode_info *lli = llu_i2info(ino);
+ long flags;
+
+ switch (cmd) {
+ case F_GETFL:
+ *rtn = lli->lli_open_flags;
+ return 0;
+ case F_SETFL:
+ flags = va_arg(ap, long);
+ flags &= FCNTL_FLMASK;
+ if (flags & FCNTL_FLMASK_INVALID) {
+ CERROR("liblustre don't support O_NONBLOCK, O_ASYNC, "
+ "and O_DIRECT on file descriptor\n");
+ *rtn = -1;
+ return EINVAL;
+ }
+ lli->lli_open_flags = (int) flags;
+ *rtn = 0;
+ return 0;
}
- RETURN(rc);
+ CERROR("unsupported fcntl cmd %x\n", cmd);
+ *rtn = -1;
+ return ENOSYS;
}
-static int llu_iop_fcntl(struct inode *ino, int cmd, va_list ap)
+static int llu_get_grouplock(struct inode *inode, unsigned long arg)
{
- CERROR("liblustre did not support fcntl\n");
- return -ENOSYS;
+ struct llu_inode_info *lli = llu_i2info(inode);
+ struct ll_file_data *fd = lli->lli_file_data;
+ ldlm_policy_data_t policy = { .l_extent = { .start = 0,
+ .end = OBD_OBJECT_EOF}};
+ struct lustre_handle lockh = { 0 };
+ struct lov_stripe_md *lsm = lli->lli_smd;
+ ldlm_error_t err;
+ int flags = 0;
+ ENTRY;
+
+ if (fd->fd_flags & LL_FILE_GROUP_LOCKED) {
+ RETURN(-EINVAL);
+ }
+
+ policy.l_extent.gid = arg;
+ if (lli->lli_open_flags & O_NONBLOCK)
+ flags = LDLM_FL_BLOCK_NOWAIT;
+
+ err = llu_extent_lock(fd, inode, lsm, LCK_GROUP, &policy, &lockh,
+ flags);
+ if (err)
+ RETURN(err);
+
+ fd->fd_flags |= LL_FILE_GROUP_LOCKED|LL_FILE_IGNORE_LOCK;
+ fd->fd_gid = arg;
+ memcpy(&fd->fd_cwlockh, &lockh, sizeof(lockh));
+
+ RETURN(0);
}
+static int llu_put_grouplock(struct inode *inode, unsigned long arg)
+{
+ struct llu_inode_info *lli = llu_i2info(inode);
+ struct ll_file_data *fd = lli->lli_file_data;
+ struct lov_stripe_md *lsm = lli->lli_smd;
+ ldlm_error_t err;
+ ENTRY;
+
+ if (!(fd->fd_flags & LL_FILE_GROUP_LOCKED))
+ RETURN(-EINVAL);
+
+ if (fd->fd_gid != arg)
+ RETURN(-EINVAL);
+
+ fd->fd_flags &= ~(LL_FILE_GROUP_LOCKED|LL_FILE_IGNORE_LOCK);
+
+ err = llu_extent_unlock(fd, inode, lsm, LCK_GROUP, &fd->fd_cwlockh);
+ if (err)
+ RETURN(err);
+
+ fd->fd_gid = 0;
+ memset(&fd->fd_cwlockh, 0, sizeof(fd->fd_cwlockh));
+
+ RETURN(0);
+}
+
static int llu_iop_ioctl(struct inode *ino, unsigned long int request,
va_list ap)
{
- CERROR("liblustre did not support ioctl\n");
+ unsigned long arg;
+
+ liblustre_wait_event(0);
+
+ switch (request) {
+ case LL_IOC_GROUP_LOCK:
+ arg = va_arg(ap, unsigned long);
+ return llu_get_grouplock(ino, arg);
+ case LL_IOC_GROUP_UNLOCK:
+ arg = va_arg(ap, unsigned long);
+ return llu_put_grouplock(ino, arg);
+ }
+
+ CERROR("did not support ioctl cmd %lx\n", request);
return -ENOSYS;
}
*/
static int llu_iop_sync(struct inode *inode)
{
+ liblustre_wait_event(0);
return 0;
}
static int llu_iop_datasync(struct inode *inode)
{
+ liblustre_wait_event(0);
return 0;
}
struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
{
struct inode *inode;
- struct ll_fid fid;
- struct file_identifier fileid = {&fid, sizeof(fid)};
+ struct lustre_id id;
+ struct file_identifier fileid = {&id, sizeof(id)};
if ((md->body->valid &
(OBD_MD_FLGENER | OBD_MD_FLID | OBD_MD_FLTYPE)) !=
- (OBD_MD_FLGENER | OBD_MD_FLID | OBD_MD_FLTYPE))
- CERROR("invalide fields!\n");
+ (OBD_MD_FLGENER | OBD_MD_FLID | OBD_MD_FLTYPE)) {
+ CERROR("bad md body valid mask 0x"LPX64"\n",
+ md->body->valid);
+ LBUG();
+ return ERR_PTR(-EPERM);
+ }
- /* try to find existing inode */
- fid.id = md->body->ino;
- fid.generation = md->body->generation;
- fid.f_type = md->body->mode & S_IFMT;
+ id = md->body->id1;
+ /* try to find existing inode */
inode = _sysio_i_find(fs, &fileid);
if (inode) {
- if (llu_i2info(inode)->lli_st_generation ==
- md->body->generation) {
+ struct llu_inode_info *lli = llu_i2info(inode);
+
+ if (inode->i_zombie ||
+ lli->lli_st_generation != id_gen(&md->body->id1)) {
+ I_RELE(inode);
+ }
+ else {
llu_update_inode(inode, md->body, md->lsm);
return inode;
- } else
- I_RELE(inode);
+ }
}
- inode = llu_new_inode(fs, &fid);
+ inode = llu_new_inode(fs, &id);
if (inode)
llu_update_inode(inode, md->body, md->lsm);
return inode;
}
-extern struct list_head lustre_profile_list;
-
static int
llu_fsswop_mount(const char *source,
unsigned flags,
struct inode *root;
struct pnode_base *rootpb;
struct obd_device *obd;
- struct ll_fid rootfid;
+ struct lustre_id rootid;
struct llu_sb_info *sbi;
struct obd_statfs osfs;
static struct qstr noname = { NULL, 0, 0 };
struct ptlrpc_request *request = NULL;
- struct lustre_handle mdc_conn = {0, };
- struct lustre_handle osc_conn = {0, };
+ struct lustre_handle lmv_conn = {0, };
+ struct lustre_handle lov_conn = {0, };
struct lustre_md md;
class_uuid_t uuid;
+ struct config_llog_instance cfg;
struct lustre_profile *lprof;
- char *osc = NULL, *mdc = NULL;
- int err = -EINVAL;
+ char *lov = NULL, *lmv = NULL;
+ int async = 1, err = -EINVAL;
ENTRY;
generate_random_uuid(uuid);
class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
- /* zeroconf */
- if (g_zconf) {
- struct config_llog_instance cfg;
- int len;
-
- if (!g_zconf_mdsname) {
- CERROR("no mds name\n");
- GOTO(out_free, err = -EINVAL);
- }
-
- /* XXX */
- /* generate a string unique to this super, let's try
- the address of the super itself.*/
- len = (sizeof(sbi) * 2) + 1;
- OBD_ALLOC(sbi->ll_instance, len);
- if (sbi->ll_instance == NULL)
- GOTO(out_free, err = -ENOMEM);
- sprintf(sbi->ll_instance, "%p", sbi);
-
- cfg.cfg_instance = sbi->ll_instance;
- cfg.cfg_uuid = sbi->ll_sb_uuid;
- err = liblustre_process_log(&cfg);
- if (err < 0) {
- CERROR("Unable to process log: %s\n", g_zconf_profile);
-
- GOTO(out_free, err);
- }
-
- lprof = class_get_profile(g_zconf_profile);
- if (lprof == NULL) {
- CERROR("No profile found: %s\n", g_zconf_profile);
- GOTO(out_free, err = -EINVAL);
- }
- if (osc)
- OBD_FREE(osc, strlen(osc) + 1);
- OBD_ALLOC(osc, strlen(lprof->lp_osc) +
- strlen(sbi->ll_instance) + 2);
- sprintf(osc, "%s-%s", lprof->lp_osc, sbi->ll_instance);
-
- if (mdc)
- OBD_FREE(mdc, strlen(mdc) + 1);
- OBD_ALLOC(mdc, strlen(lprof->lp_mdc) +
- strlen(sbi->ll_instance) + 2);
- sprintf(mdc, "%s-%s", lprof->lp_mdc, sbi->ll_instance);
- } else {
- /* setup from dump_file */
- if (list_empty(&lustre_profile_list)) {
- CERROR("no profile\n");
- GOTO(out_free, err = -EINVAL);
- }
+ /* generate a string unique to this super, let's try
+ the address of the super itself.*/
+ OBD_ALLOC(sbi->ll_instance, sizeof(sbi) * 2 + 1);
+ if (sbi->ll_instance == NULL)
+ GOTO(out_free, err = -ENOMEM);
+ sprintf(sbi->ll_instance, "%p", sbi);
+
+ /* retrive & parse config log */
+ cfg.cfg_instance = sbi->ll_instance;
+ cfg.cfg_uuid = sbi->ll_sb_uuid;
+ err = liblustre_process_log(&cfg, 1);
+ if (err < 0) {
+ CERROR("Unable to process log: %s\n", g_zconf_profile);
+ GOTO(out_free, err);
+ }
- lprof = list_entry(lustre_profile_list.next,
- struct lustre_profile, lp_list);
- osc = lprof->lp_osc;
- mdc = lprof->lp_mdc;
+ lprof = class_get_profile(g_zconf_profile);
+ if (lprof == NULL) {
+ CERROR("No profile found: %s\n", g_zconf_profile);
+ GOTO(out_free, err = -EINVAL);
}
+ if (lov)
+ OBD_FREE(lov, strlen(lov) + 1);
+ OBD_ALLOC(lov, strlen(lprof->lp_lov) +
+ strlen(sbi->ll_instance) + 2);
+ sprintf(lov, "%s-%s", lprof->lp_lov, sbi->ll_instance);
+
+ if (lmv)
+ OBD_FREE(lmv, strlen(lmv) + 1);
+ OBD_ALLOC(lmv, strlen(lprof->lp_lmv) +
+ strlen(sbi->ll_instance) + 2);
+ sprintf(lmv, "%s-%s", lprof->lp_lmv, sbi->ll_instance);
- if (!osc) {
+ if (!lov) {
CERROR("no osc\n");
GOTO(out_free, err = -EINVAL);
}
- if (!mdc) {
+ if (!lmv) {
CERROR("no mdc\n");
GOTO(out_free, err = -EINVAL);
}
goto out_free;
}
- obd = class_name2obd(mdc);
+ obd = class_name2obd(lmv);
if (!obd) {
- CERROR("MDC %s: not setup or attached\n", mdc);
+ CERROR("MDC %s: not setup or attached\n", lmv);
GOTO(out_free, err = -EINVAL);
}
-
+ obd_set_info(obd->obd_self_export, strlen("async"), "async",
+ sizeof(async), &async);
+#if 0
if (mdc_init_ea_size(obd, osc))
GOTO(out_free, err = -EINVAL);
-
+#endif
/* setup mdc */
- err = obd_connect(&mdc_conn, obd, &sbi->ll_sb_uuid);
+ err = obd_connect(&lmv_conn, obd, &sbi->ll_sb_uuid, NULL, 0);
if (err) {
- CERROR("cannot connect to %s: rc = %d\n", mdc, err);
+ CERROR("cannot connect to %s: rc = %d\n", lmv, err);
GOTO(out_free, err);
}
- sbi->ll_mdc_exp = class_conn2export(&mdc_conn);
+ sbi->ll_md_exp = class_conn2export(&lmv_conn);
err = obd_statfs(obd, &osfs, 100000000);
if (err)
- GOTO(out_mdc, err);
+ GOTO(out_lmv, err);
/*
* FIXME fill fs stat data into sbi here!!! FIXME
*/
- /* setup osc */
- obd = class_name2obd(osc);
+ /* setup lov */
+ obd = class_name2obd(lov);
if (!obd) {
- CERROR("OSC %s: not setup or attached\n", osc);
- GOTO(out_mdc, err = -EINVAL);
+ CERROR("OSC %s: not setup or attached\n", lov);
+ GOTO(out_lmv, err = -EINVAL);
}
+ obd_set_info(obd->obd_self_export, strlen("async"), "async",
+ sizeof(async), &async);
- err = obd_connect(&osc_conn, obd, &sbi->ll_sb_uuid);
+ err = obd_connect(&lov_conn, obd, &sbi->ll_sb_uuid, NULL, 0);
if (err) {
- CERROR("cannot connect to %s: rc = %d\n", osc, err);
- GOTO(out_mdc, err);
+ CERROR("cannot connect to %s: rc = %d\n", lov, err);
+ GOTO(out_lmv, err);
}
- sbi->ll_osc_exp = class_conn2export(&osc_conn);
+ sbi->ll_dt_exp = class_conn2export(&lov_conn);
- err = mdc_getstatus(sbi->ll_mdc_exp, &rootfid);
+ err = mdc_getstatus(sbi->ll_md_exp, &rootid);
if (err) {
CERROR("cannot mds_connect: rc = %d\n", err);
- GOTO(out_osc, err);
+ GOTO(out_lov, err);
}
- CDEBUG(D_SUPER, "rootfid "LPU64"\n", rootfid.id);
- sbi->ll_rootino = rootfid.id;
+ CDEBUG(D_SUPER, "rootid "LPU64"\n", rootid.li_stc.u.e3s.l3s_ino);
+ sbi->ll_rootino = rootid.li_stc.u.e3s.l3s_ino;
/* fetch attr of root inode */
- err = mdc_getattr(sbi->ll_mdc_exp, &rootfid,
- OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, 0, &request);
+ err = mdc_getattr(sbi->ll_md_exp, &rootid,
+ OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS, NULL, 0,
+ 0, &request);
if (err) {
CERROR("mdc_getattr failed for root: rc = %d\n", err);
- GOTO(out_osc, err);
+ GOTO(out_lov, err);
}
- err = mdc_req2lustre_md(request, 0, sbi->ll_osc_exp, &md);
+ err = mdc_req2lustre_md(sbi->ll_md_exp, request, 0,
+ sbi->ll_dt_exp, &md);
if (err) {
CERROR("failed to understand root inode md: rc = %d\n",err);
GOTO(out_request, err);
LASSERT(sbi->ll_rootino != 0);
root = llu_iget(fs, &md);
- if (root == NULL) {
+ if (!root || IS_ERR(root)) {
CERROR("fail to generate root inode\n");
GOTO(out_request, err = -EBADF);
}
_sysio_i_gone(root);
out_request:
ptlrpc_req_finished(request);
-out_osc:
- obd_disconnect(sbi->ll_osc_exp, 0);
-out_mdc:
- obd_disconnect(sbi->ll_mdc_exp, 0);
+out_lov:
+ obd_disconnect(sbi->ll_dt_exp, 0);
+out_lmv:
+ obd_disconnect(sbi->ll_md_exp, 0);
out_free:
OBD_FREE(sbi, sizeof(*sbi));
return err;
llu_fsswop_mount
};
-static struct inode_ops llu_inode_ops = {
- inop_lookup: llu_iop_lookup,
- inop_getattr: llu_iop_getattr,
- inop_setattr: llu_iop_setattr,
- inop_getdirentries: NULL,
- inop_mkdir: llu_iop_mkdir_raw,
- inop_rmdir: llu_iop_rmdir_raw,
- inop_symlink: llu_iop_symlink_raw,
- inop_readlink: llu_iop_readlink,
- inop_open: llu_iop_open,
- inop_close: llu_iop_close,
- inop_link: llu_iop_link_raw,
- inop_unlink: llu_iop_unlink_raw,
- inop_rename: llu_iop_rename_raw,
- inop_ipreadv: llu_iop_ipreadv,
- inop_ipwritev: llu_iop_ipwritev,
- inop_iodone: llu_iop_iodone,
- inop_fcntl: llu_iop_fcntl,
- inop_sync: llu_iop_sync,
- inop_datasync: llu_iop_datasync,
- inop_ioctl: llu_iop_ioctl,
- inop_mknod: llu_iop_mknod_raw,
-#if 0
- inop_statvfs: llu_iop_statvfs,
+struct inode_ops llu_inode_ops = {
+ .inop_lookup = llu_iop_lookup,
+ .inop_getattr = llu_iop_getattr,
+ .inop_setattr = llu_iop_setattr,
+ .inop_getdirentries = llu_iop_getdirentries,
+ .inop_mkdir = llu_iop_mkdir_raw,
+ .inop_rmdir = llu_iop_rmdir_raw,
+ .inop_symlink = llu_iop_symlink_raw,
+ .inop_readlink = llu_iop_readlink,
+ .inop_open = llu_iop_open,
+ .inop_close = llu_iop_close,
+ .inop_link = llu_iop_link_raw,
+ .inop_unlink = llu_iop_unlink_raw,
+ .inop_rename = llu_iop_rename_raw,
+ .inop_iodone = llu_iop_iodone,
+ .inop_fcntl = llu_iop_fcntl,
+ .inop_sync = llu_iop_sync,
+ .inop_read = llu_iop_read,
+ .inop_write = llu_iop_write,
+ .inop_datasync = llu_iop_datasync,
+ .inop_ioctl = llu_iop_ioctl,
+ .inop_mknod = llu_iop_mknod_raw,
+#ifdef _HAVE_STATVFS
+ .inop_statvfs = llu_iop_statvfs,
#endif
- inop_gone: llu_iop_gone,
+ .inop_gone = llu_iop_gone,
};
-