[Ocfs2-devel] [PATCH] Mounting failed will not clean up dlm and o2hb

Shichangkuo shi.changkuo at h3c.com
Wed Apr 20 00:53:23 PDT 2016


Hi all
    When mounting an ocfs2 device, the dlm will join the domian firstly, in ocfs2_dlm_init function. Then the storage link changes to inactive, then ocfs2_super_lock retutn -EIO.
ocfs2_dismount_volume will be called to clean up osb, but it just return when lock failed. This will cause dlm and o2hb thread still exits.

-------------------------
Signed-off-by: shichangkuo <shi.changkuo at h3c.com>
Reviewed-by: zhangguanghui <zhang.guanghui at h3c.com>

diff -pu linux-4.6-rc4/fs/ocfs2/super.c super.c
--- linux-4.6-rc4/fs/ocfs2/super.c      2016-04-18 10:13:32.000000000 +0800
+++ super.c     2016-04-20 15:45:31.306475078 +0800
@@ -1922,21 +1922,20 @@ static void ocfs2_dismount_volume(struct
        ocfs2_purge_refcount_trees(osb);

        /* No cluster connection means we've failed during mount, so skip
-        * all the steps which depended on that to complete. */
-       if (osb->cconn) {
+        * all the steps which depended on that to complete.
+    * to fix resource leaks and avoid call sb_getblk again, mount can't return*/
+       if (!mnt_err && osb->cconn) {
                tmp = ocfs2_super_lock(osb, 1);
                if (tmp < 0) {
                        mlog_errno(tmp);
-                       return;
+               } else {
+                       if (osb->slot_num != OCFS2_INVALID_SLOT)
+                ocfs2_put_slot(osb);
+
+               ocfs2_super_unlock(osb, 1);
                }
        }

-       if (osb->slot_num != OCFS2_INVALID_SLOT)
-               ocfs2_put_slot(osb);
-
-       if (osb->cconn)
-               ocfs2_super_unlock(osb, 1);
-
        ocfs2_release_system_inodes(osb);

        /*

Best regards.

Changkuo
-------------------------------------------------------------------------------------------------------------------------------------
本邮件及其附件含有杭州华三通信技术有限公司的保密信息,仅限于发送给上面地址中列出
的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、
或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本
邮件!
This e-mail and its attachments contain confidential information from H3C, which is
intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
by phone or email immediately and delete it!


More information about the Ocfs2-devel mailing list