#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include <linux/lustre_compat25.h>
#endif
-
#include "llite_internal.h"
+#include <linux/obd_lov.h>
-static int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode,
- struct file *file)
+int ll_mdc_close(struct obd_export *mdc_exp, struct inode *inode,
+ struct file *file)
{
struct ll_file_data *fd = file->private_data;
struct ptlrpc_request *req = NULL;
struct obd_client_handle *och = &fd->fd_mds_och;
struct obdo obdo;
- int rc, valid;
+ int rc;
ENTRY;
- valid = OBD_MD_FLID;
+ /* clear group lock, if present */
+ if (fd->fd_flags & LL_FILE_GROUP_LOCKED) {
+ struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
+ fd->fd_flags &= ~(LL_FILE_GROUP_LOCKED|LL_FILE_IGNORE_LOCK);
+ rc = ll_extent_unlock(fd, inode, lsm, LCK_GROUP,
+ &fd->fd_cwlockh);
+ }
- memset(&obdo, 0, sizeof(obdo));
obdo.o_id = inode->i_ino;
- obdo.o_mode = inode->i_mode;
- obdo.o_size = inode->i_size;
- obdo.o_blocks = inode->i_blocks;
+ obdo.o_valid = OBD_MD_FLID;
+ obdo_from_inode(&obdo, inode, OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME |
+ OBD_MD_FLCTIME);
if (0 /* ll_is_inode_dirty(inode) */) {
obdo.o_flags = MDS_BFLAG_UNCOMMITTED_WRITES;
- valid |= OBD_MD_FLFLAGS;
+ obdo.o_valid |= OBD_MD_FLFLAGS;
}
- obdo.o_valid = valid;
- rc = mdc_close(mdc_exp, &obdo, och, &req);
+ obdo.o_mds = ll_i2info(inode)->lli_mds;
+ rc = md_close(mdc_exp, &obdo, och, &req);
+
if (rc == EAGAIN) {
/* We are the last writer, so the MDS has instructed us to get
* the file size and any write cookies, then close again. */
inode->i_ino, rc);
}
if (rc == 0) {
- rc = ll_objects_destroy(req, file->f_dentry->d_inode);
+ rc = ll_objects_destroy(req, file->f_dentry->d_inode, 1);
if (rc)
CERROR("inode %lu ll_objects destroy: rc = %d\n",
inode->i_ino, rc);
}
- mdc_clear_open_replay_data(och);
+ mdc_clear_open_replay_data(mdc_exp, och);
ptlrpc_req_finished(req);
och->och_fh.cookie = DEAD_HANDLE_MAGIC;
file->private_data = NULL;
int rc;
ENTRY;
- CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
+ CDEBUG(D_VFSTRACE, "VFS Op:inode=%u/%lu/%u(%p)\n",
+ ll_i2info(inode)->lli_mds, inode->i_ino,
inode->i_generation, inode);
/* don't do anything for / */
ll_prepare_mdc_op_data(&data, parent->d_inode, NULL, name, len, O_RDWR);
- rc = mdc_enqueue(sbi->ll_mdc_exp, LDLM_PLAIN, itp, LCK_PR, &data,
- &lockh, lmm, lmmsize, ldlm_completion_ast,
- ll_mdc_blocking_ast, parent->d_inode);
- if (rc < 0)
+ rc = md_enqueue(sbi->ll_mdc_exp, LDLM_IBITS, itp, LCK_PR, &data,
+ &lockh, lmm, lmmsize, ldlm_completion_ast,
+ ll_mdc_blocking_ast, NULL);
+ if (rc == 0) {
+ if (itp->d.lustre.it_lock_mode)
+ memcpy(&itp->d.lustre.it_lock_handle,
+ &lockh, sizeof(lockh));
+ } else if (rc < 0) {
CERROR("lock enqueue: err: %d\n", rc);
+ }
+
RETURN(rc);
}
-static int ll_local_open(struct file *file, struct lookup_intent *it)
+int ll_local_open(struct file *file, struct lookup_intent *it)
{
struct ptlrpc_request *req = it->d.lustre.it_data;
struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode);
+ struct obd_export *mdc_exp = ll_i2mdcexp(file->f_dentry->d_inode);
struct ll_file_data *fd;
struct mds_body *body;
ENTRY;
lli->lli_io_epoch = body->io_epoch;
- mdc_set_open_replay_data(&fd->fd_mds_och, it->d.lustre.it_data);
+ mdc_set_open_replay_data(mdc_exp, &fd->fd_mds_och, it->d.lustre.it_data);
RETURN(0);
}
int ll_file_open(struct inode *inode, struct file *file)
{
struct ll_inode_info *lli = ll_i2info(inode);
- struct lookup_intent *it;
+ struct lookup_intent *it, oit = { .it_op = IT_OPEN,
+ .it_flags = file->f_flags };
struct lov_stripe_md *lsm;
struct ptlrpc_request *req;
int rc = 0;
it = file->f_it;
- if (!it->d.lustre.it_disposition) {
- struct lookup_intent oit = { .it_op = IT_OPEN,
- .it_flags = file->f_flags };
+ if (!it || !it->d.lustre.it_disposition) {
it = &oit;
rc = ll_intent_file_open(file, NULL, 0, it);
if (rc)
memset(oa, 0, sizeof *oa);
oa->o_id = lsm->lsm_object_id;
+ oa->o_gr = lsm->lsm_object_gr;
oa->o_mode = S_IFREG;
oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLSIZE |
OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ | OBD_MD_FLMTIME |
- OBD_MD_FLCTIME;
+ OBD_MD_FLCTIME | OBD_MD_FLGROUP;
set = ptlrpc_prep_set();
if (set == NULL) {
if (rc)
RETURN(rc);
- oa->o_valid &= (OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ | OBD_MD_FLMTIME |
+ oa->o_valid &= (OBD_MD_FLBLOCKS | OBD_MD_FLBLKSZ | OBD_MD_FLMTIME |
OBD_MD_FLCTIME | OBD_MD_FLSIZE);
RETURN(0);
}
ENTRY;
if (lsm->lsm_stripe_count == 1)
- RETURN(0);
+ GOTO(check, stripe = 0);
/* get our offset in the lov */
rc = obd_get_info(exp, sizeof(key), &key, &vallen, &stripe);
if (rc != 0) {
CERROR("obd_get_info: rc = %d\n", rc);
- LBUG();
+ RETURN(rc);
}
LASSERT(stripe < lsm->lsm_stripe_count);
+
+check:
+ if (lsm->lsm_oinfo[stripe].loi_id != lock->l_resource->lr_name.name[0]||
+ lsm->lsm_oinfo[stripe].loi_gr != lock->l_resource->lr_name.name[2]){
+ LDLM_ERROR(lock, "resource doesn't match object "LPU64"/"LPU64
+ " inode=%lu/%u (%p)\n",
+ lsm->lsm_oinfo[stripe].loi_id,
+ lsm->lsm_oinfo[stripe].loi_gr,
+ inode->i_ino, inode->i_generation, inode);
+ RETURN(-ELDLM_NO_LOCK_DATA);
+ }
+
RETURN(stripe);
}
tmpex.l_extent.start, lock->l_policy_data.l_extent.end,
start, i, end);
- ll_pgcache_lock(inode->i_mapping);
- if (list_empty(&inode->i_mapping->dirty_pages) &&
- list_empty(&inode->i_mapping->clean_pages) &&
- list_empty(&inode->i_mapping->locked_pages)) {
+ if (!mapping_has_pages(inode->i_mapping)) {
CDEBUG(D_INODE|D_PAGE, "nothing left\n");
- ll_pgcache_unlock(inode->i_mapping);
break;
}
- ll_pgcache_unlock(inode->i_mapping);
- conditional_schedule();
+ cond_resched();
page = find_get_page(inode->i_mapping, i);
if (page == NULL)
lock_page(page);
/* page->mapping to check with racing against teardown */
- if (page->mapping && PageDirty(page) && !discard) {
- ClearPageDirty(page);
- LL_CDEBUG_PAGE(D_PAGE, page, "found dirty\n");
- ll_pgcache_lock(inode->i_mapping);
- list_del(&page->list);
- list_add(&page->list, &inode->i_mapping->locked_pages);
- ll_pgcache_unlock(inode->i_mapping);
-
+ if (!discard && clear_page_dirty_for_io(page)) {
rc = ll_call_writepage(inode, page);
if (rc != 0)
CERROR("writepage of page %p failed: %d\n",
tmpex.l_extent.end = tmpex.l_extent.start + PAGE_CACHE_SIZE - 1;
/* check to see if another DLM lock covers this page */
- ldlm_lock2handle(lock, &lockh);
- rc2 = ldlm_lock_match(NULL,
+ rc2 = ldlm_lock_match(lock->l_resource->lr_namespace,
LDLM_FL_BLOCK_GRANTED|LDLM_FL_CBPENDING |
LDLM_FL_TEST_LOCK,
- NULL, 0, &tmpex, 0, &lockh);
+ &lock->l_resource->lr_name, LDLM_EXTENT,
+ &tmpex, LCK_PR | LCK_PW, &lockh);
if (rc2 == 0 && page->mapping != NULL) {
// checking again to account for writeback's lock_page()
LL_CDEBUG_PAGE(D_PAGE, page, "truncating\n");
lsm = lli->lli_smd;
stripe = ll_lock_to_stripe_offset(inode, lock);
+ if (stripe < 0)
+ goto iput;
ll_pgcache_remove_extent(inode, lsm, lock, stripe);
down(&inode->i_sem);
kms = ldlm_extent_shift_kms(lock,
lsm->lsm_oinfo[stripe].loi_kms);
+
if (lsm->lsm_oinfo[stripe].loi_kms != kms)
LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64,
lsm->lsm_oinfo[stripe].loi_kms, kms);
LDLM_DEBUG(lock, "client-side async enqueue: granted/glimpsed");
stripe = ll_lock_to_stripe_offset(inode, lock);
+ if (stripe < 0)
+ goto iput;
if (lock->l_lvb_len) {
struct lov_stripe_md *lsm = lli->lli_smd;
up(&inode->i_sem);
}
+iput:
iput(inode);
wake_up(&lock->l_waitq);
struct inode *inode = ll_inode_from_lock(lock);
struct ll_inode_info *lli;
struct ost_lvb *lvb;
- int rc, size = sizeof(*lvb), stripe = 0;
+ int rc, size = sizeof(*lvb), stripe;
ENTRY;
if (inode == NULL)
GOTO(iput, rc = -ELDLM_NO_LOCK_DATA);
/* First, find out which stripe index this lock corresponds to. */
- if (lli->lli_smd->lsm_stripe_count > 1)
- stripe = ll_lock_to_stripe_offset(inode, lock);
+ stripe = ll_lock_to_stripe_offset(inode, lock);
+ if (stripe < 0)
+ GOTO(iput, rc = -ELDLM_NO_LOCK_DATA);
rc = lustre_pack_reply(req, 1, &size, NULL);
if (rc) {
}
__u64 lov_merge_size(struct lov_stripe_md *lsm, int kms);
+__u64 lov_merge_blocks(struct lov_stripe_md *lsm);
__u64 lov_merge_mtime(struct lov_stripe_md *lsm, __u64 current_time);
/* NB: lov_merge_size will prefer locally cached writes if they extend the
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_sb_info *sbi = ll_i2sbi(inode);
ldlm_policy_data_t policy = { .l_extent = { 0, OBD_OBJECT_EOF } };
- struct lustre_handle lockh;
+ struct lustre_handle lockh = { 0 };
int rc, flags = LDLM_FL_HAS_INTENT;
ENTRY;
}
lvb->lvb_size = lov_merge_size(lli->lli_smd, 0);
+ inode->i_blocks = lov_merge_blocks(lli->lli_smd);
//inode->i_mtime = lov_merge_mtime(lli->lli_smd, inode->i_mtime);
- CDEBUG(D_DLMTRACE, "glimpse: size: "LPU64"\n", lvb->lvb_size);
+ CDEBUG(D_DLMTRACE, "glimpse: size: "LPU64", blocks: "LPU64"\n",
+ lvb->lvb_size, lvb->lvb_blocks);
obd_cancel(sbi->ll_osc_exp, lli->lli_smd, LCK_PR, &lockh);
struct lov_stripe_md *lsm = lli->lli_smd;
struct lustre_handle lockh = { 0 };
ldlm_policy_data_t policy;
- ldlm_error_t err;
+ int rc;
ssize_t retval;
__u64 kms;
ENTRY;
policy.l_extent.start = *ppos;
policy.l_extent.end = *ppos + count - 1;
- err = ll_extent_lock(fd, inode, lsm, LCK_PR, &policy, &lockh, 0);
- if (err != ELDLM_OK)
- RETURN(err);
+ rc = ll_extent_lock(fd, inode, lsm, LCK_PR, &policy, &lockh,
+ (filp->f_flags & O_NONBLOCK) ?
+ LDLM_FL_BLOCK_NOWAIT: 0);
+ if (rc != 0)
+ RETURN(rc);
kms = lov_merge_size(lsm, 1);
- if (policy.l_extent.end > kms) {
+ if (*ppos + count - 1 > kms) {
/* A glimpse is necessary to determine whether we return a short
* read or some zeroes at the end of the buffer */
struct ost_lvb lvb;
struct lustre_handle lockh = { 0 };
ldlm_policy_data_t policy;
loff_t maxbytes = ll_file_maxbytes(inode);
- ldlm_error_t err;
ssize_t retval;
+ int nonblock = 0, rc;
ENTRY;
+ if (file->f_flags & O_NONBLOCK)
+ nonblock = LDLM_FL_BLOCK_NOWAIT;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
inode->i_ino, inode->i_generation, inode, count, *ppos);
policy.l_extent.end = *ppos + count - 1;
}
- err = ll_extent_lock(fd, inode, lsm, LCK_PW, &policy, &lockh, 0);
- if (err != ELDLM_OK)
- RETURN(err);
+ rc = ll_extent_lock(fd, inode, lsm, LCK_PW, &policy, &lockh, nonblock);
+ if (rc != 0)
+ RETURN(rc);
/* this is ok, g_f_w will overwrite this under i_sem if it races
* with a local truncate, it just makes our maxbyte checking easier */
if (!capable (CAP_SYS_ADMIN))
RETURN(-EPERM);
- rc = copy_from_user(&ucreatp, (struct ll_recreate_obj *)arg,
+ rc = copy_from_user(&ucreatp, (struct ll_recreate_obj *)arg,
sizeof(struct ll_recreate_obj));
if (rc) {
RETURN(-EFAULT);
RETURN(-ENOMEM);
}
- oa->o_id = ucreatp.lrc_id;
+ oa->o_id = ucreatp.lrc_id;
oa->o_nlink = ucreatp.lrc_ost_idx;
- oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS;
+ oa->o_gr = ucreatp.lrc_group;
+ oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLFLAGS;
oa->o_flags |= OBD_FL_RECREATE_OBJS;
obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
OBD_MD_FLMTIME | OBD_MD_FLCTIME);
if (rc < 0)
GOTO(out, rc);
- rc = mdc_req2lustre_md(req, 1, exp, &md);
+ rc = mdc_req2lustre_md(ll_i2mdcexp(inode), req, 1, exp, &md);
if (rc)
GOTO(out, rc);
- ll_update_inode(f->f_dentry->d_inode, md.body, md.lsm);
+ ll_update_inode(f->f_dentry->d_inode, &md);
rc = ll_local_open(f, &oit);
if (rc)
{
int flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE;
struct lov_user_md *lump;
- int lum_size = sizeof(struct lov_user_md) +
+ int lum_size = sizeof(struct lov_user_md) +
sizeof(struct lov_user_ost_data);
int rc;
ENTRY;
if (lump == NULL) {
RETURN(-ENOMEM);
}
- rc = copy_from_user(lump, (struct lov_user_md *)arg,
- lum_size);
+ rc = copy_from_user(lump, (struct lov_user_md *)arg, lum_size);
if (rc) {
OBD_FREE(lump, lum_size);
RETURN(-EFAULT);
(void *)arg);
}
+static int ll_get_grouplock(struct inode *inode, struct file *file,
+ unsigned long arg)
+{
+ struct ll_file_data *fd = file->private_data;
+ ldlm_policy_data_t policy = { .l_extent = { .start = 0,
+ .end = OBD_OBJECT_EOF}};
+ struct lustre_handle lockh = { 0 };
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *lsm = lli->lli_smd;
+ int flags = 0, rc;
+ ENTRY;
+
+ if (fd->fd_flags & LL_FILE_GROUP_LOCKED) {
+ RETURN(-EINVAL);
+ }
+
+ policy.l_extent.gid = arg;
+ if (file->f_flags & O_NONBLOCK)
+ flags = LDLM_FL_BLOCK_NOWAIT;
+
+ rc = ll_extent_lock(fd, inode, lsm, LCK_GROUP, &policy, &lockh, flags);
+ if (rc != 0)
+ RETURN(rc);
+
+ 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 ll_put_grouplock(struct inode *inode, struct file *file,
+ unsigned long arg)
+{
+ struct ll_file_data *fd = file->private_data;
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *lsm = lli->lli_smd;
+ int rc;
+ ENTRY;
+
+ if (!(fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
+ /* Ugh, it's already unlocked. */
+ RETURN(-EINVAL);
+ }
+
+ if (fd->fd_gid != arg) /* Ugh? Unlocking with different gid? */
+ RETURN(-EINVAL);
+
+ fd->fd_flags &= ~(LL_FILE_GROUP_LOCKED|LL_FILE_IGNORE_LOCK);
+
+ rc = ll_extent_unlock(fd, inode, lsm, LCK_GROUP, &fd->fd_cwlockh);
+ if (rc)
+ RETURN(rc);
+
+ fd->fd_gid = 0;
+ memset(&fd->fd_cwlockh, 0, sizeof(fd->fd_cwlockh));
+
+ RETURN(0);
+}
+
int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg)
{
case LL_IOC_LOV_SETSTRIPE:
RETURN(ll_lov_setstripe(inode, file, arg));
case LL_IOC_LOV_SETEA:
- RETURN( ll_lov_setea(inode, file, arg) );
+ RETURN(ll_lov_setea(inode, file, arg));
case LL_IOC_LOV_GETSTRIPE:
RETURN(ll_lov_getstripe(inode, arg));
case LL_IOC_RECREATE_OBJ:
case EXT3_IOC_GETFLAGS:
case EXT3_IOC_SETFLAGS:
RETURN( ll_iocontrol(inode, file, cmd, arg) );
+ case LL_IOC_GROUP_LOCK:
+ RETURN(ll_get_grouplock(inode, file, arg));
+ case LL_IOC_GROUP_UNLOCK:
+ RETURN(ll_put_grouplock(inode, file, arg));
/* We need to special case any other ioctls we want to handle,
* to send them to the MDS/OST as appropriate and to properly
* network encode the arg field.
lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_LLSEEK);
if (origin == 2) { /* SEEK_END */
- ldlm_error_t err;
+ int nonblock = 0, rc;
ldlm_policy_data_t policy = { .l_extent = {0, OBD_OBJECT_EOF }};
- err = ll_extent_lock(fd, inode, lsm, LCK_PR, &policy, &lockh,0);
- if (err != ELDLM_OK)
- RETURN(err);
+
+ if (file->f_flags & O_NONBLOCK)
+ nonblock = LDLM_FL_BLOCK_NOWAIT;
+
+ rc = ll_extent_lock(fd, inode, lsm, LCK_PR, &policy, &lockh,
+ nonblock);
+ if (rc != 0)
+ RETURN(rc);
offset += inode->i_size;
} else if (origin == 1) { /* SEEK_CUR */
rc = filemap_fdatawait(inode->i_mapping);
ll_inode2fid(&fid, inode);
- err = mdc_sync(ll_i2sbi(inode)->ll_mdc_exp, &fid, &req);
+ err = md_sync(ll_i2sbi(inode)->ll_mdc_exp, &fid, &req);
if (!rc)
rc = err;
if (!err)
RETURN(rc ? rc : -ENOMEM);
oa->o_id = lsm->lsm_object_id;
+ oa->o_gr = lsm->lsm_object_gr;
oa->o_valid = OBD_MD_FLID;
obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
- OBD_MD_FLMTIME | OBD_MD_FLCTIME);
+ OBD_MD_FLMTIME | OBD_MD_FLCTIME |
+ OBD_MD_FLGROUP);
err = obd_sync(ll_i2sbi(inode)->ll_osc_exp, oa, lsm,
0, OBD_OBJECT_EOF);
switch (cmd) {
case F_SETLKW:
+#ifdef F_SETLKW64
+ case F_SETLKW64:
+#endif
flags = 0;
break;
case F_SETLK:
+#ifdef F_SETLK64
+ case F_SETLK64:
+#endif
flags = LDLM_FL_BLOCK_NOWAIT;
break;
case F_GETLK:
+#ifdef F_GETLK64
+ case F_GETLK64:
+#endif
flags = LDLM_FL_TEST_LOCK;
/* Save the old mode so that if the mode in the lock changes we
* can decrement the appropriate reader or writer refcount. */
LBUG();
}
- CDEBUG(D_DLMTRACE, "inode=%lu, pid=%u, flags=%#x, mode=%u, "
+ CDEBUG(D_DLMTRACE, "inode=%lu, pid="LPU64", flags=%#x, mode=%u, "
"start="LPU64", end="LPU64"\n", inode->i_ino, flock.l_flock.pid,
flags, mode, flock.l_flock.start, flock.l_flock.end);
- obddev = sbi->ll_mdc_exp->exp_obd;
- rc = ldlm_cli_enqueue(sbi->ll_mdc_exp, NULL, obddev->obd_namespace,
+ obddev = md_get_real_obd(sbi->ll_mdc_exp, NULL, 0);
+ rc = ldlm_cli_enqueue(obddev->obd_self_export, NULL,
+ obddev->obd_namespace,
res_id, LDLM_FLOCK, &flock, mode, &flags,
NULL, ldlm_flock_completion_ast, NULL, file_lock,
NULL, 0, NULL, &lockh);
RETURN(rc);
}
-static int ll_have_md_lock(struct dentry *de)
-{
- struct ll_sb_info *sbi = ll_s2sbi(de->d_sb);
- struct lustre_handle lockh;
- struct ldlm_res_id res_id = { .name = {0} };
- struct obd_device *obddev;
- int flags;
- ENTRY;
-
- if (!de->d_inode)
- RETURN(0);
-
- obddev = sbi->ll_mdc_exp->exp_obd;
- res_id.name[0] = de->d_inode->i_ino;
- res_id.name[1] = de->d_inode->i_generation;
-
- 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, LCK_PR, &lockh)) {
- ldlm_lock_decref(&lockh, LCK_PR);
- RETURN(1);
- }
-
- if (ldlm_lock_match(obddev->obd_namespace, flags, &res_id, LDLM_PLAIN,
- NULL, LCK_PW, &lockh)) {
- ldlm_lock_decref(&lockh, LCK_PW);
- RETURN(1);
- }
- RETURN(0);
-}
-
int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it)
{
struct inode *inode = dentry->d_inode;
struct ll_inode_info *lli;
struct lov_stripe_md *lsm;
+ struct ll_fid fid;
int rc;
ENTRY;
CERROR("REPORT THIS LINE TO PETER\n");
RETURN(0);
}
+ ll_inode2fid(&fid, 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);
+ CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s,intent=%s\n",
+ inode->i_ino, inode->i_generation, inode, dentry->d_name.name,
+ LL_IT2STR(it));
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0))
lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_REVALIDATE);
#endif
- if (!ll_have_md_lock(dentry)) {
+ if (!md_valid_attrs(ll_i2mdcexp(inode), &fid)) {
struct ptlrpc_request *req = NULL;
struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode);
struct ll_fid fid;
valid |= OBD_MD_FLEASIZE;
}
ll_inode2fid(&fid, inode);
- rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, ealen, &req);
+ rc = md_getattr(sbi->ll_mdc_exp, &fid, valid, ealen, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, inode->i_ino);
RETURN(-abs(rc));
}
- rc = ll_prep_inode(sbi->ll_osc_exp, &inode, req, 0, NULL);
+ rc = ll_prep_inode(sbi->ll_osc_exp, sbi->ll_mdc_exp,
+ &inode, req, 0, NULL);
if (rc) {
ptlrpc_req_finished(req);
RETURN(rc);
#endif
struct file_operations ll_file_operations = {
- read: ll_file_read,
- write: ll_file_write,
- ioctl: ll_file_ioctl,
- open: ll_file_open,
- release: ll_file_release,
- mmap: generic_file_mmap,
- llseek: ll_file_seek,
- fsync: ll_fsync,
- //lock: ll_file_flock
+ .read = ll_file_read,
+ .write = ll_file_write,
+ .ioctl = ll_file_ioctl,
+ .open = ll_file_open,
+ .release = ll_file_release,
+ .mmap = generic_file_mmap,
+ .llseek = ll_file_seek,
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+ .sendfile = generic_file_sendfile,
+#endif
+ .fsync = ll_fsync,
+ .lock = ll_file_flock
};
struct inode_operations ll_file_inode_operations = {
- setattr_raw: ll_setattr_raw,
- setattr: ll_setattr,
- truncate: ll_truncate,
+ .setattr_raw = ll_setattr_raw,
+ .setattr = ll_setattr,
+ .truncate = ll_truncate,
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
- getattr_it: ll_getattr,
+ .getattr_it = ll_getattr,
#else
- revalidate_it: ll_inode_revalidate_it,
+ .revalidate_it = ll_inode_revalidate_it,
#endif
};
-struct inode_operations ll_special_inode_operations = {
- setattr_raw: ll_setattr_raw,
- setattr: ll_setattr,
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
- getattr_it: ll_getattr,
-#else
- revalidate_it: ll_inode_revalidate_it,
-#endif
-};