struct lustre_handle *handle;
ENTRY;
+ /* XXX the check for RENAME2 is a workaround for old kernels
+ which call intent_release twice in rename
+ */
if (it == NULL || it->it_op == IT_RENAME2) {
EXIT;
return;
handle = (struct lustre_handle *)it->it_lock_handle;
if (it->it_op == IT_SETATTR) {
int rc;
- struct inode *inode = de->d_inode;
ldlm_lock_decref(handle, it->it_lock_mode);
rc = ldlm_cli_cancel(handle);
if (rc < 0)
CERROR("ldlm_cli_cancel: %d\n", rc);
- /* XXX should we only do this when the last lock goes? */
- LASSERT(igrab(inode) == inode);
- d_delete_aliases(inode);
- iput(inode);
} else
ldlm_lock_decref(handle, it->it_lock_mode);
}
- if (it->it_op != IT_RELEASED_MAGIC) {
+ if (it->it_op == IT_RELEASED_MAGIC) {
+ EXIT;
+ return;
+ }
+
+ if (de->d_it && de->d_it == it) {
+ de->d_it = NULL;
up(&ll_d2d(de)->lld_it_sem);
it->it_op = IT_RELEASED_MAGIC;
}
+
EXIT;
}
spin_unlock(&dcache_lock);
d_rehash(de);
- if (it != NULL) {
- LL_SAVE_INTENT(de, it);
- } else {
+ if (!it)
de->d_it = NULL;
- }
RETURN(1);
}
memcpy(it->it_lock_handle, &lockh, sizeof(lockh));
request = (struct ptlrpc_request *)it->it_data;
+ /* it_disposition == 1 indicates that the server performed the
+ * intent on our behalf. */
if (it->it_disposition) {
struct mds_body *mds_body;
int mode, symlen = 0;
obd_flag valid;
- /* it_disposition == 1 indicates that the server performed the
- * intent on our behalf. This long block is all about fixing up
- * the local state so that it is correct as of the moment
- * _before_ the operation was applied; that way, the VFS will
- * think that everything is normal and call Lustre's regular
- * FS function.
+ /* This long block is all about fixing up the local
+ * state so that it is correct as of the moment
+ * _before_ the operation was applied; that way, the
+ * VFS will think that everything is normal and call
+ * Lustre's regular FS function.
*
* If we're performing a creation, that means that unless the
* creation failed with EEXIST, we should fake up a negative
*
* For everything else, we want to lookup to succeed. */
- /* One additional note: we add an extra reference to the request
- * because we need to keep it around until ll_create gets
- * called. For anything else which results in
- * LL_LOOKUP_POSITIVE, we can do the iget() immediately with the
- * contents of the reply (in the intent_finish callback). In
- * the create case, however, we need to wait until
- * ll_create_node to do the iget() or the VFS will abort with
- * -EEXISTS. */
+ /* One additional note: we add an extra reference to
+ * the request because we need to keep it around until
+ * ll_create gets called. For anything else which
+ * results in LL_LOOKUP_POSITIVE, we can do the iget()
+ * immediately with the contents of the reply (in the
+ * intent_finish callback). In the create case,
+ * however, we need to wait until ll_create_node to do
+ * the iget() or the VFS will abort with -EEXISTS.
+ */
offset = 1;
mds_body = lustre_msg_buf(request->rq_repmsg, offset);
ino = mds_body->fid1.id;
mode = mds_body->mode;
+
if (it->it_op & (IT_CREAT | IT_MKDIR | IT_SYMLINK | IT_MKNOD)) {
mdc_store_inode_generation(request, 2, 1);
/* For create ops, we want the lookup to be negative,
atomic_inc(&request->rq_refcount);
GOTO(out, flag = LL_LOOKUP_NEGATIVE);
}
- /* Fall through to update attibutes. */
+ /*
+ * Fall through to update attibutes: it may already
+ * have appeared in the namespace of another client
+ */
} else if (it->it_op & (IT_GETATTR | IT_SETATTR | IT_LOOKUP |
IT_READLINK)) {
/* For check ops, we want the lookup to succeed */
ptlrpc_req_finished(request);
}
- if (it->it_op == IT_LOOKUP || rc < 0)
+ /* this places the intent in the dentry so that the vfs_xxx
+ * operation can lay its hands on it; but that is not
+ * always needed...
+ */
+ if (it->it_status == 0 &&
+ it->it_op != IT_RENAME2 &&
+ it->it_op != IT_SETATTR &&
+ it->it_op != IT_GETATTR &&
+ it->it_op != IT_READDIR &&
+ it->it_op != IT_LOOKUP) {
+ LL_SAVE_INTENT(dentry, it);
+ } else {
+ dentry->d_it = NULL;
+ CDEBUG(D_DENTRY,
+ "D_IT dentry %p fsdata %p intent: %s status %d\n",
+ dentry, ll_d2d(dentry), ldlm_it2str(it->it_op),
+ it->it_status);
+ }
+
+ if (rc < 0 ||
+ it->it_op == IT_LOOKUP
+ )
ll_intent_release(dentry, it);
return rc;
if (dentry == saved)
d_add(dentry, inode);
- if (it->it_status == 0 && it->it_op != IT_RENAME2) {
- LL_SAVE_INTENT(dentry, it);
- } else {
- dentry->d_it = NULL;
- CDEBUG(D_DENTRY,
- "D_IT dentry %p fsdata %p intent: %s status %d\n",
- dentry, ll_d2d(dentry), ldlm_it2str(it->it_op),
- it->it_status);
- }
-
RETURN(0);
}
{
struct ll_inode_info *lli = ll_i2info(inode);
struct lov_stripe_md *lsm = lli->lli_smd;
- struct brw_cb_data *cbd = ll_init_brw_cb_data();
+ struct brw_cb_data *brw_cbd = ll_init_brw_cb_data();
struct brw_page pg;
int err;
ENTRY;
- if (!cbd)
+ if (!brw_cbd)
RETURN(-ENOMEM);
pg.pg = page;
pg.flag = create ? OBD_BRW_CREATE : 0;
- err = obd_brw(cmd, ll_i2obdconn(inode),lsm, 1, &pg, ll_sync_brw_cb, cbd);
+ err = obd_brw(cmd, ll_i2obdconn(inode),lsm, 1, &pg, ll_sync_brw_cb,
+ brw_cbd);
RETURN(err);
} /* ll_brw */
ptlrpc_req_finished(request);
request = NULL;
-
/* Register this mount instance with LProcFS */
-
snprintf(mnt_name, 100, "mount_%s", sbi->ll_sb_uuid);
- sbi->ll_mnt_root=lprocfs_reg_mnt(mnt_name);
- if(!sbi->ll_mnt_root)
+ sbi->ll_mnt_root = lprocfs_reg_mnt(mnt_name);
+ if (!sbi->ll_mnt_root)
goto out_dev;
/* Add the static configuration info */
- lprocfs_add_vars(sbi->ll_mnt_root,
- (struct lprocfs_vars*)status_var_nm_1,
- (void*)sb);
-
- /* Add the dynamic configuration stuff */
+ err = lprocfs_add_vars(sbi->ll_mnt_root,
+ (struct lprocfs_vars *)status_var_nm_1, sb);
+ if (err)
+ CDEBUG(D_OTHER, "Unable to add procfs variables\n");
/* MDC */
obd = class_uuid2obd(mdc);
/* Reuse mnt_name */
-
sprintf(mnt_name, "status/%s/common_name", obd->obd_type->typ_name);
memset(d_vars, 0, sizeof(d_vars));
- d_vars[0].read_fptr=rd_dev_name;
- d_vars[0].write_fptr=0;
- d_vars[0].name=(char*)mnt_name;
-
+ d_vars[0].read_fptr = rd_dev_name;
+ d_vars[0].write_fptr = NULL;
+ d_vars[0].name = mnt_name;
snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
obd->obd_type->typ_name);
- d_vars[1].read_fptr=rd_dev_uuid;
- d_vars[1].write_fptr=0;
- d_vars[1].name=(char*)uuid_name;
-
- err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
- (void*)obd);
- if (err) {
- CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
- }
+ d_vars[1].read_fptr = rd_dev_uuid;
+ d_vars[1].write_fptr = NULL;
+ d_vars[1].name = uuid_name;
+ err = lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars *)d_vars,
+ obd);
+ if (err)
+ CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables\n");
/* OSC or LOV*/
obd = class_uuid2obd(osc);
- /* Reuse mnt_name */
+ /* Reuse mnt_name */
snprintf(mnt_name, strlen(mnt_name), "status/%s/common_name",
obd->obd_type->typ_name);
memset(d_vars, 0, sizeof(d_vars));
- d_vars[0].read_fptr=rd_dev_name;
- d_vars[0].write_fptr=0;
- d_vars[0].name=(char*)mnt_name;
-
+ d_vars[0].read_fptr = rd_dev_name;
+ d_vars[0].write_fptr = NULL;
+ d_vars[0].name = mnt_name;
snprintf(uuid_name, strlen(uuid_name), "status/%s/uuid",
obd->obd_type->typ_name);
- d_vars[1].read_fptr=rd_dev_uuid;
- d_vars[1].write_fptr=0;
- d_vars[1].name=(char*)uuid_name;
+ d_vars[1].read_fptr = rd_dev_uuid;
+ d_vars[1].write_fptr = NULL;
+ d_vars[1].name = uuid_name;
+
+ err = lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars *)d_vars,
+ obd);
+ if (err)
+ CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables\n");
- err=lprocfs_add_vars(sbi->ll_mnt_root, (struct lprocfs_vars* )d_vars,
- (void*)obd);
- if (err) {
- CDEBUG(D_OTHER, "Unable to add fs proc dynamic variables");
- }
out_dev:
if (mdc)
OBD_FREE(mdc, strlen(mdc) + 1);