/* N.B. d_obtain_alias() drops inode ref on error */
result = d_obtain_alias(inode);
if (!IS_ERR(result)) {
- int rc;
-
- rc = ll_d_init(result);
- if (rc < 0) {
- dput(result);
- result = ERR_PTR(rc);
- } else {
- struct ll_dentry_data *ldd = ll_d2d(result);
-
- /*
- * Need to signal to the ll_file_open that
- * we came from NFS and so opencache needs to be
- * enabled for this one
- */
- spin_lock(&result->d_lock);
- ldd->lld_nfs_dentry = 1;
- spin_unlock(&result->d_lock);
- }
+ struct ll_dentry_data *ldd;
+
+ if (!ll_d_setup(result, true))
+ RETURN(ERR_PTR(-ENOMEM));
+ ldd = ll_d2d(result);
+ /*
+ * Need to signal to the ll_file_open that
+ * we came from NFS and so opencache needs to be
+ * enabled for this one
+ */
+ spin_lock(&result->d_lock);
+ ldd->lld_nfs_dentry = 1;
+ spin_unlock(&result->d_lock);
}
RETURN(result);