[LU-11896] Memory leak occurs when lfs mkdir fails Created: 29/Jan/19 Updated: 01/Oct/19 Resolved: 01/Oct/19 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.10.5 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Tatsushi Takamura | Assignee: | Tatsushi Takamura |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||
| Description |
|
When lfs mkdir fails, llog_cat_cancel_records() is executed for error handling. But, in a condition of !llog_exist(loghandle), llog_handle_put() is not executed (that is, lgh_refcount is not decremented), so llog_free_handle() will not be executed in umount. This cause memory leak.
682 int llog_cat_cancel_records(const struct lu_env *env, 683 struct llog_handle *cathandle, int count, 684 struct llog_cookie *cookies) 685 { 686 int i, index, rc = 0, failed = 0; 687 688 ENTRY; 689 690 for (i = 0; i < count; i++, cookies++) { 691 struct llog_handle *loghandle; 692 struct llog_logid *lgl = &cookies->lgc_lgl; 693 int lrc; 694 695 rc = llog_cat_id2handle(env, cathandle, &loghandle, lgl); // llog_cat_id2handle(llog_handle_get) increments lgh_refcount <snip> 705 if ((cathandle->lgh_ctxt->loc_flags & 706 LLOG_CTXT_FLAG_NORMAL_FID) && !llog_exist(loghandle)) { 707 /* For update log, some of loghandles of cathandle 708 * might not exist because remote llog creation might 709 * be failed, so let's skip the record cancellation 710 * for these non-exist llogs. 711 */ 712 lrc = -ENOENT; 713 CDEBUG(D_HA, "%s: llog "DFID":%x does not exist" 714 ": rc = %d\n", 715 cathandle->lgh_ctxt->loc_obd->obd_name, 716 PFID(&lgl->lgl_oi.oi_fid), lgl->lgl_ogen, lrc); 717 failed++; 718 if (rc == 0) 719 rc = lrc; // llog_handle_put() should be called to decrement lgh_refcount 720 continue; 721 }
|
| Comments |
| Comment by Gerrit Updater [ 29/Jan/19 ] |
|
Tatsushi Takamura (takamr.tatsushi@jp.fujitsu.com) uploaded a new patch: https://review.whamcloud.com/34126 |
| Comment by Tatsushi Takamura [ 19/Feb/19 ] |
|
This bug seems to be fixed by the patch of |
| Comment by Andreas Dilger [ 01/Oct/19 ] |
|
Fixed via patch https://review.whamcloud.com/34179 " |