|
@@ -290,6 +290,21 @@ out_attach:
|
|
|
else
|
|
|
mlog_errno(ret);
|
|
|
|
|
|
+ /*
|
|
|
+ * In case of error, manually free the allocation and do the iput().
|
|
|
+ * We need to do this because error here means no d_instantiate(),
|
|
|
+ * which means iput() will not be called during dput(dentry).
|
|
|
+ */
|
|
|
+ if (ret < 0 && !alias) {
|
|
|
+ ocfs2_lock_res_free(&dl->dl_lockres);
|
|
|
+ BUG_ON(dl->dl_count != 1);
|
|
|
+ spin_lock(&dentry_attach_lock);
|
|
|
+ dentry->d_fsdata = NULL;
|
|
|
+ spin_unlock(&dentry_attach_lock);
|
|
|
+ kfree(dl);
|
|
|
+ iput(inode);
|
|
|
+ }
|
|
|
+
|
|
|
dput(alias);
|
|
|
|
|
|
return ret;
|