[LU-6881] sub_trans_commit_cb() is racy Created: 20/Jul/15  Updated: 13/Aug/15  Resolved: 13/Aug/15

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

Type: Bug Priority: Critical
Reporter: Niu Yawei (Inactive) Assignee: Di Wang
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

sub_trans_commit_cb() can be called by in parallel, so all_committed could be set to false even if all sub transactions are committed.

static void sub_trans_commit_cb(struct lu_env *env,
                                struct thandle *sub_th,
                                struct dt_txn_commit_cb *cb, int err)
{
        struct sub_thandle      *st;
        struct top_multiple_thandle *tmt = cb->dcb_data;
        bool                    all_committed = true;
        ENTRY;

        /* Check if all sub thandles are committed */
        list_for_each_entry(st, &tmt->tmt_sub_thandle_list, st_sub_list) {
                if (st->st_sub_th == sub_th) {
                        st->st_committed = 1;
                        st->st_result = err;
                }
                if (!st->st_committed)
                        all_committed = false;
        }

        if (tmt->tmt_result == 0)
                tmt->tmt_result = err;

        if (all_committed)
                top_trans_committed_cb(tmt);

        top_multiple_thandle_dump(tmt, D_INFO);
        top_multiple_thandle_put(tmt);
        RETURN_EXIT;
}


 Comments   
Comment by Gerrit Updater [ 23/Jul/15 ]

wangdi (di.wang@intel.com) uploaded a new patch: http://review.whamcloud.com/15690
Subject: LU-6881 update: add lock to protect commit check
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: b351081da4835a6d6d3ccd8f9bebe4e60c591740

Comment by Gerrit Updater [ 13/Aug/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/15690/
Subject: LU-6881 update: add lock to protect commit check
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 58c571070e72c6912aea47da5d90e7365d626d6b

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