extern struct address_space_operations ll_aops;
-void ll_release(struct dentry *de)
+void ll_release(struct dentry *de)
{
ENTRY;
ldlm_lock_decref(handle, de->d_it->it_lock_mode);
}
// de->d_it = NULL;
- up(&ll_d2d(de)->lld_it_sem);
+ //up(&ll_d2d(de)->lld_it_sem);
EXIT;
}
struct lustre_handle lockh;
__u64 res_id[RES_NAME_SIZE] = {0};
struct obd_device *obddev;
+ int rc = 0;
ENTRY;
- /* right now we're only interested in IT_OPEN and IT_LOOKUP */
if (it) {
CDEBUG(D_INFO, "name: %*s, intent: %s\n", de->d_name.len,
de->d_name.name, ldlm_it2str(it->it_op));
- if (!(it->it_op & IT_OPEN))
- RETURN(0);
+ if (it->it_op == IT_RENAME)
+ it->it_data = de;
}
if (!de->d_inode)
- RETURN(0);
+ GOTO(out, rc = 0);
obddev = class_conn2obd(&sbi->ll_mdc_conn);
res_id[0] = de->d_inode->i_ino;
if (ldlm_lock_match(obddev->obd_namespace, res_id, LDLM_MDSINTENT,
NULL, 0, LCK_PR, &lockh)) {
ldlm_lock_decref(&lockh, LCK_PR);
- RETURN(1);
+ GOTO(out, rc = 1);
}
if (ldlm_lock_match(obddev->obd_namespace, res_id, LDLM_MDSINTENT,
NULL, 0, LCK_PW, &lockh)) {
ldlm_lock_decref(&lockh, LCK_PW);
- RETURN(1);
+ GOTO(out, rc = 1);
}
- /* If we're acting on an IT_OPEN intent and the file is already open,
- * we won't get called in lookup2 if we return 0, so return 1.
+ /* If the dentry is busy, we won't get called in lookup2 if we
+ * return 0, so return 1.
*
* This is a temporary fix for bug 618962, but is one of the causes of
* 619078. */
CDEBUG(D_INFO, "d_count: %d\n", atomic_read(&de->d_count));
- if (atomic_read(&de->d_count) > 0)
- RETURN(1);
+ if (it && atomic_read(&de->d_count) > 0) {
+ CERROR("returning 1 for %*s during %s because d_count is %d\n",
+ de->d_name.len, de->d_name.name, ldlm_it2str(it->it_op),
+ atomic_read(&de->d_count));
+ GOTO(out, rc = 1);
+ }
+ out:
if (ll_d2d(de) == NULL) {
CERROR("allocating fsdata\n");
ll_set_dd(de);
}
- down(&ll_d2d(de)->lld_it_sem);
- // de->d_it = it;
+ //down(&ll_d2d(de)->lld_it_sem);
+ // de->d_it = it;
- RETURN(0);
+ RETURN(rc);
}
int ll_set_dd(struct dentry *de)
dentry->d_op = &ll_d_ops;
d_add(dentry, inode);
- if (ll_d2d(dentry) == NULL) {
+ if (ll_d2d(dentry) == NULL)
ll_set_dd(dentry);
- }
- down(&ll_d2d(dentry)->lld_it_sem);
+ // down(&ll_d2d(dentry)->lld_it_sem);
// dentry->d_it = it;
if (it->it_op == IT_LOOKUP)
ll_intent_release(dentry);
-
return NULL;
drop_req:
if (!dentry->d_it || dentry->d_it->it_disposition == 0) {
if (!ext2_empty_dir(inode))
- LBUG();
+ RETURN(-ENOTEMPTY);
err = ll_common_unlink(dir, dentry, S_IFDIR);
} else
err = dentry->d_it->it_status;