fid_seq_is_sane(fid_seq(fid)) && fid_oid(fid) != 0;
}
-#define DFID3 "["LPU64"/%u:%u]"
+#define DFID3 "[%16.16"LPF64"x/%8.8x:%8.8x]"
#define PFID3(fid) \
fid_seq(fid), \
Index: iam/fs/ext3/Makefile
===================================================================
--- iam.orig/fs/ext3/Makefile 2006-05-31 20:24:32.000000000 +0400
-+++ iam/fs/ext3/Makefile 2006-07-28 01:53:16.000000000 +0400
++++ iam/fs/ext3/Makefile 2006-07-28 20:55:09.000000000 +0400
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
Index: iam/include/linux/lustre_iam.h
===================================================================
--- iam.orig/include/linux/lustre_iam.h 2006-05-31 20:24:32.000000000 +0400
-+++ iam/include/linux/lustre_iam.h 2006-07-28 01:53:16.000000000 +0400
++++ iam/include/linux/lustre_iam.h 2006-07-28 20:55:09.000000000 +0400
@@ -1,9 +1,68 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
Index: iam/fs/ext3/Makefile
===================================================================
---- iam.orig/fs/ext3/Makefile 2006-07-28 01:53:16.000000000 +0400
-+++ iam/fs/ext3/Makefile 2006-07-28 01:53:16.000000000 +0400
+--- iam.orig/fs/ext3/Makefile 2006-07-28 20:55:09.000000000 +0400
++++ iam/fs/ext3/Makefile 2006-07-28 20:55:10.000000000 +0400
@@ -6,7 +6,7 @@ obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o iopen.o \
ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
Index: iam/fs/ext3/dir.c
===================================================================
---- iam.orig/fs/ext3/dir.c 2006-07-28 01:53:16.000000000 +0400
-+++ iam/fs/ext3/dir.c 2006-07-28 01:53:16.000000000 +0400
+--- iam.orig/fs/ext3/dir.c 2006-07-28 20:55:09.000000000 +0400
++++ iam/fs/ext3/dir.c 2006-07-28 20:55:10.000000000 +0400
@@ -28,6 +28,7 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
(filp->f_version != inode->i_version)) {
Index: iam/fs/ext3/file.c
===================================================================
---- iam.orig/fs/ext3/file.c 2006-07-28 01:53:16.000000000 +0400
-+++ iam/fs/ext3/file.c 2006-07-28 01:53:16.000000000 +0400
+--- iam.orig/fs/ext3/file.c 2006-07-28 20:55:09.000000000 +0400
++++ iam/fs/ext3/file.c 2006-07-28 20:55:10.000000000 +0400
@@ -23,6 +23,7 @@
#include <linux/jbd.h>
#include <linux/ext3_fs.h>
Index: iam/fs/ext3/iam-uapi.c
===================================================================
--- iam.orig/fs/ext3/iam-uapi.c 2004-04-06 17:27:52.000000000 +0400
-+++ iam/fs/ext3/iam-uapi.c 2006-07-28 01:53:16.000000000 +0400
++++ iam/fs/ext3/iam-uapi.c 2006-07-28 20:55:10.000000000 +0400
@@ -0,0 +1,361 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+}
Index: iam/fs/ext3/ioctl.c
===================================================================
---- iam.orig/fs/ext3/ioctl.c 2006-07-28 01:53:16.000000000 +0400
-+++ iam/fs/ext3/ioctl.c 2006-07-28 01:53:16.000000000 +0400
+--- iam.orig/fs/ext3/ioctl.c 2006-07-28 20:55:09.000000000 +0400
++++ iam/fs/ext3/ioctl.c 2006-07-28 20:55:10.000000000 +0400
@@ -250,6 +250,6 @@ flags_err:
}
Index: iam/include/linux/lustre_iam.h
===================================================================
---- iam.orig/include/linux/lustre_iam.h 2006-07-28 01:53:16.000000000 +0400
-+++ iam/include/linux/lustre_iam.h 2006-07-28 01:53:16.000000000 +0400
+--- iam.orig/include/linux/lustre_iam.h 2006-07-28 20:55:09.000000000 +0400
++++ iam/include/linux/lustre_iam.h 2006-07-28 20:55:10.000000000 +0400
@@ -30,9 +30,6 @@
#ifndef __LINUX_LUSTRE_IAM_H__
#define __LINUX_LUSTRE_IAM_H__
op_data.flags = MDS_BFLAG_UNCOMMITTED_WRITES;
op_data.valid |= OBD_MD_FLFLAGS;
}
-
+
rc = md_close(md_exp, &op_data, och, &req);
if (rc == EAGAIN) {
/* We are the last writer, so the MDS has instructed us to get
och->och_mod->mod_open_req->rq_type,
och->och_mod->mod_open_req->rq_transno,
och->och_fh.cookie);
-
+
rc = ll_close_inode_openhandle(md_exp, inode, och);
och->och_fh.cookie = DEAD_HANDLE_MAGIC;
LUSTRE_FPRIVATE(file) = NULL;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
inode->i_generation, inode);
- /* don't do anything for / */
- if (inode->i_sb->s_root == file->f_dentry)
- RETURN(0);
-
lprocfs_counter_incr(sbi->ll_stats, LPROC_LL_RELEASE);
fd = LUSTRE_FPRIVATE(file);
LASSERT(fd != NULL);
+ /* don't do anything for / */
+ if (inode->i_sb->s_root == file->f_dentry) {
+ LUSTRE_FPRIVATE(file) = NULL;
+ ll_file_data_put(fd);
+ RETURN(0);
+ }
+
if (lsm)
lov_test_and_clear_async_rc(lsm);
lli->lli_async_rc = 0;
if (!parent)
RETURN(-ENOENT);
- ll_prepare_md_op_data(&op_data, parent->d_inode, NULL,
+ ll_prepare_md_op_data(&op_data, parent->d_inode, NULL,
name, len, O_RDWR);
rc = md_enqueue(sbi->ll_md_exp, LDLM_IBITS, itp, LCK_PW, &op_data,
RETURN(rc);
}
-static void ll_och_fill(struct obd_export *md_exp, struct ll_inode_info *lli,
+static void ll_och_fill(struct obd_export *md_exp, struct ll_inode_info *lli,
struct lookup_intent *it, struct obd_client_handle *och)
{
struct ptlrpc_request *req = it->d.lustre.it_data;
ll_och_fill(ll_i2sbi(inode)->ll_md_exp,
ll_i2info(inode), it, &fd->fd_mds_och);
-
+
LUSTRE_FPRIVATE(file) = fd;
ll_readahead_init(inode, &fd->fd_ras);
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), flags %o\n", inode->i_ino,
inode->i_generation, inode, file->f_flags);
- /* don't do anything for / */
- if (inode->i_sb->s_root == file->f_dentry)
- RETURN(0);
-
it = file->f_it;
fd = ll_file_data_get();
if (fd == NULL)
RETURN(-ENOMEM);
+ /* don't do anything for / */
+ if (inode->i_sb->s_root == file->f_dentry) {
+ LUSTRE_FPRIVATE(file) = fd;
+ RETURN(0);
+ }
+
if (!it || !it->d.lustre.it_disposition) {
struct ll_sb_info *sbi = ll_i2sbi(inode);
-
+
/* Convert f_flags into access mode. We cannot use file->f_mode,
* because everything but O_ACCMODE mask was stripped from
* there */
ll_file_data_put(fd);
GOTO(out, rc);
}
-
+
md_set_lock_data(sbi->ll_md_exp, &it->d.lustre.it_lock_handle,
file->f_dentry->d_inode);
}
LASSERTF(rc == 0, "rc = %d\n", rc);
CDEBUG(D_INFO, "opening ino = %lu file = %p has open req = %p, type = %x, "
"transno = "LPU64", handle = "LPX64"\n",
- inode->i_ino, file, req, req->rq_type,
+ inode->i_ino, file, req, req->rq_type,
req->rq_transno, fd->fd_mds_och.och_fh.cookie);
if (!S_ISREG(inode->i_mode))
ll_prepare_md_op_data(op_data, head_inode, tail_parent,
tail_dentry->d_name.name,
tail_dentry->d_name.len, 0);
-
+
rc = md_enqueue(ll_i2mdexp(head_inode), LDLM_IBITS, &oit, LCK_PW,
op_data, &lockh, &tsize, 0, ldlm_completion_ast,
ll_md_blocking_ast, &hsize, 0);
ll_och_fill(ll_i2sbi(inode)->ll_md_exp,
ll_i2info(inode), it, och);
- rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
+ rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
inode, och);
OBD_FREE(och, sizeof(*och));
}
sbi = ll_i2sbi(inode);
lli = ll_i2info(inode);
-
+
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s\n",
inode->i_ino, inode->i_generation, inode, dentry->d_name.name);
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0))
#endif
ll_prepare_md_op_data(&op_data, inode, inode, NULL, 0, 0);
-
+
rc = md_intent_lock(sbi->ll_md_exp, &op_data, NULL, 0, &oit, 0,
&req, ll_md_blocking_ast, 0);
GOTO(out, rc);
ll_lookup_finish_locks(&oit, dentry);
-
+
/* object is allocated, validate size */
if (lli->lli_smd) {
/* ll_glimpse_size will prefer locally cached writes if they
static int mdd_attr_set(const struct lu_context *ctxt,
struct md_object *obj, const struct lu_attr *attr)
{
+ struct mdd_object *mdo = md2mdd_obj(obj);
struct mdd_device *mdd = mdo2mdd(obj);
struct thandle *handle;
int rc;
if (IS_ERR(handle))
RETURN(PTR_ERR(handle));
+ mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
rc = __mdd_attr_set(ctxt, obj, attr, handle);
+ mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
mdd_trans_stop(ctxt, mdd, handle);
int mdd_xattr_set(const struct lu_context *ctxt, struct md_object *obj,
const void *buf, int buf_len, const char *name, int fl)
{
+ struct mdd_object *mdo = md2mdd_obj(obj);
struct mdd_device *mdd = mdo2mdd(obj);
struct thandle *handle;
int rc;
if (IS_ERR(handle))
RETURN(PTR_ERR(handle));
+ mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
rc = __mdd_xattr_set(ctxt, mdd, md2mdd_obj(obj), buf, buf_len, name,
fl, handle);
+ mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
mdd_trans_stop(ctxt, mdd, handle);
int mdd_xattr_del(const struct lu_context *ctxt, struct md_object *obj,
const char *name)
{
+ struct mdd_object *mdo = md2mdd_obj(obj);
struct mdd_device *mdd = mdo2mdd(obj);
struct thandle *handle;
int rc;
if (IS_ERR(handle))
RETURN(PTR_ERR(handle));
+ mdd_lock(ctxt, mdo, DT_WRITE_LOCK);
rc = __mdd_xattr_del(ctxt, mdd, md2mdd_obj(obj), name, handle);
+ mdd_unlock(ctxt, mdo, DT_WRITE_LOCK);
mdd_trans_stop(ctxt, mdd, handle);
if (dt_try_as_dir(ctxt, dt_cobj)) {
if (!S_ISDIR(ma->ma_attr.la_mode))
RETURN(rc = -EISDIR);
- } else {
- if (S_ISDIR(ma->ma_attr.la_mode))
+ } else if (S_ISDIR(ma->ma_attr.la_mode))
RETURN(rc = -ENOTDIR);
- }
if (S_ISREG(ma->ma_attr.la_mode) && ma &&
ma->ma_lmm != 0 && ma->ma_lmm_size > 0) {
static int mdd_lookup(const struct lu_context *ctxt, struct md_object *pobj,
const char *name, struct lu_fid* fid)
{
- struct dt_object *dir = mdd_object_child(md2mdd_obj(pobj));
+ struct mdd_object *mdo = md2mdd_obj(pobj);
+ struct dt_object *dir = mdd_object_child(mdo);
struct dt_rec *rec = (struct dt_rec *)fid;
const struct dt_key *key = (const struct dt_key *)name;
int rc;
ENTRY;
+ mdd_lock(ctxt, mdo, DT_READ_LOCK);
if (dt_try_as_dir(ctxt, dir))
rc = dir->do_index_ops->dio_lookup(ctxt, dir, rec, key);
else
rc = -ENOTDIR;
+ mdd_unlock(ctxt, mdo, DT_READ_LOCK);
RETURN(rc);
}
handle = mdd_trans_start(ctxt, mdd);
if (IS_ERR(handle))
RETURN(-ENOMEM);
+
+ mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
__mdd_ref_add(ctxt, mdd_obj, handle);
+ mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK);
mdd_trans_stop(ctxt, mdd, handle);
handle = mdd_trans_start(ctxt, mdd);
if (IS_ERR(handle))
RETURN(-ENOMEM);
+
+ mdd_lock(ctxt, mdd_obj, DT_WRITE_LOCK);
__mdd_ref_del(ctxt, mdd_obj, handle, ma);
+ mdd_unlock(ctxt, mdd_obj, DT_WRITE_LOCK);
mdd_trans_stop(ctxt, mdd, handle);
const struct lu_rdpg *rdpg)
{
struct dt_object *next;
+ struct mdd_object *mdd = md2mdd_obj(obj);
int rc;
LASSERT(lu_object_exists(ctxt, mdd2lu_obj(md2mdd_obj(obj))));
next = mdd_object_child(md2mdd_obj(obj));
+
+ mdd_lock(ctxt, mdd, DT_READ_LOCK);
+ if (dt_try_as_dir(ctxt, next))
rc = next->do_ops->do_readpage(ctxt, next, rdpg);
+ else
+ rc = -ENOTDIR;
+ mdd_unlock(ctxt, mdd, DT_READ_LOCK);
return rc;
}
/* Common mount */
-int lustre_fill_super(struct super_block *sb, void *data, int silent)
+static int lustre_fill_super(struct super_block *sb, void *data, int silent)
{
struct lustre_mount_data *lmd;
struct lustre_sb_info *lsi;
*/
hash = *(__u32 *)(name - sizeof(__u16) - sizeof(__u32));
*end = hash;
+ CERROR("%p %p %d "DFID3": %#8.8x (%d)\"%*.*s\"\n",
+ area, ent, nob, PFID3(fid), hash, len, len, len, name);
if (nob >= recsize) {
ent->lde_fid = *fid;
ent->lde_hash = hash;
LASSERT(lu_object_exists(ctxt, &dt->do_lu));
LASSERT(osd_invariant(obj));
+ LASSERT(osd_has_index(obj));
LASSERT(rdpg->rp_pages != NULL);
for (i = 0, rc = 0, nob = rdpg->rp_count;
rc == 0 && nob > 0; i++, nob -= CFS_PAGE_SIZE) {
-
LASSERT(i < rdpg->rp_npages);
pg = rdpg->rp_pages[i];
rc = osd_dir_page_build(ctxt, !i, kmap(pg),
min_t(int, nob, CFS_PAGE_SIZE),
iops, it,
&hash_start, &hash_end, &last);
+ if (rc != 0 || i == rdpg->rp_npages - 1)
+ last->lde_reclen = 0;
kunmap(pg);
}
iops->put(ctxt, it);
dp->ldp_hash_start = hash_start;
dp->ldp_hash_end = hash_end;
kunmap(rdpg->rp_pages[0]);
- kmap(pg);
- LASSERT(page_address(pg) <= (void *)last &&
- (void *)last < page_address(pg) + CFS_PAGE_SIZE);
- last->lde_reclen = 0;
- kunmap(pg);
}
} else if (rc == 0)
rc = -EIO;
file->f_dentry = dentry;
file->f_mapping = inode->i_mapping;
+ file->f_op = inode->i_fop;
+ file->f_mode = FMODE_WRITE|FMODE_READ;
dentry->d_inode = inode;
*seg = get_fs();
ssize_t result;
file = osd_rw_init(ctxt, inode, &seg);
- result = inode->i_fop->read(file, buf, count, pos);
+ /*
+ * We'd like to use vfs_read() here, but it messes with
+ * dnotify_parent() and locks.
+ */
+ result = file->f_op->read(file, buf, count, pos);
osd_rw_fini(&seg);
return result;
}
ssize_t result;
file = osd_rw_init(ctxt, inode, &seg);
- result = inode->i_fop->write(file, buf, count, pos);
+ result = file->f_op->write(file, buf, count, pos);
osd_rw_fini(&seg);
return result;
}