[LU-6873] Double mutex unlock in lod_add_device Created: 18/Jul/15  Updated: 22/Dec/15  Resolved: 28/Aug/15

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.8.0

Type: Bug Priority: Minor
Reporter: Oleg Drokin Assignee: Di Wang
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Seems there's a double mutex unlock on error path in lod_add_device.
Also in the same vein, there seems to be double reference drop

        cfs_bitmap_set(ltd->ltd_tgt_bitmap, index);
        ltd->ltd_tgtnr++;
        mutex_unlock(&ltd->ltd_mutex);
        lod_putref(lod, ltd);
...
        if (!for_ost && lod->lod_initialized) {
                rc = lod_sub_init_llog(env, lod, tgt_desc->ltd_tgt);
                if (rc != 0) {
                        CERROR("%s: cannot start llog on %s:rc = %d\n",
                               lod2obd(lod)->obd_name, osp, rc);
**                        GOTO(out_pool, rc);
                }
        }
        rc = lfsck_add_target(env, lod->lod_child, d, exp, index, for_ost);
        if (rc != 0) {
                CERROR("Fail to add LFSCK target: name = %s, type = %s, "
                       "index = %u, rc = %d\n", osp, type, index, rc);
**                GOTO(out_fini_llog, rc);
...
out_fini_llog:
        lod_sub_fini_llog(env, tgt_desc->ltd_tgt,
                          tgt_desc->ltd_recovery_thread);
out_pool:
        lod_ost_pool_remove(&lod->lod_pool_info, index);
out_mutex:
        mutex_unlock(&ltd->ltd_mutex);
        lod_putref(lod, ltd);

So we do double unlock and double reference put in those two cases which is probably a pretty bad idea,



 Comments   
Comment by Joseph Gmitter (Inactive) [ 20/Jul/15 ]

Fan Yong,

You you please have look at this issue?

Thanks.
Joe

Comment by nasf (Inactive) [ 31/Jul/15 ]

This issue is introduced by the DNE patch http://review.whamcloud.com/11408.

Wang Di, would you please to re-work your patch? Thanks!

Comment by Gerrit Updater [ 24/Aug/15 ]

wangdi (di.wang@intel.com) uploaded a new patch: http://review.whamcloud.com/16067
Subject: LU-6873 lod: duplicate mutex unlock
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: daca6187188b5ed42dfd088f9b5f4438eb3f5f0b

Comment by Gerrit Updater [ 28/Aug/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/16067/
Subject: LU-6873 lod: duplicate mutex unlock
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 0ab9e68328e2cfbcf4f891d68055b9243a1f553c

Comment by Joseph Gmitter (Inactive) [ 28/Aug/15 ]

Landed for 2.8.

Generated at Sat Feb 10 02:04:01 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.