- /* 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 (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);
+ /* Cached negative dentries are unsafe for now - look them up again */
+ if (de->d_inode == NULL)
+ RETURN(0);
+
+ exp = ll_i2mdcexp(de->d_inode);
+ ll_inode2fid(&pfid, de->d_parent->d_inode);
+ ll_inode2fid(&cfid, de->d_inode);
+ icbd.icbd_parent = de->d_parent->d_inode;
+ icbd.icbd_childp = &de;
+
+ /*
+ * never execute intents for mount points
+ * - attrs will be fixed up in ll_revalidate_inode
+ */
+ if (d_mountpoint(de))
+ RETURN(1);
+
+ ll_frob_intent(&it, &lookup_it);
+ LASSERT(it);
+
+ ll_i2uctxt(&ctxt, de->d_parent->d_inode, de->d_inode);
+
+ rc = mdc_intent_lock(exp, &ctxt, &pfid, de->d_name.name, de->d_name.len,
+ NULL, 0,
+ &cfid, it, flags, &req, ll_mdc_blocking_ast);
+ /* If req is NULL, then mdc_intent_lock only tried to do a lock match;
+ * if all was well, it will return 1 if it found locks, 0 otherwise. */
+ if (req == NULL && rc >= 0)
+ GOTO(out, rc);
+
+ if (rc < 0) {
+ if (rc != -ESTALE) {
+ CDEBUG(D_INFO, "ll_intent_lock: rc %d : it->it_status "
+ "%d\n", rc, it->d.lustre.it_status);
+ }
+ GOTO(out, rc = 0);