[LU-4189] Strange code in mdc_changelog_send_thread Created: 30/Oct/13 Updated: 07/Jul/15 Resolved: 07/Jul/15 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.6.0 |
| Fix Version/s: | Lustre 2.8.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Oleg Drokin | Assignee: | WC Triage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | easy, patch | ||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 11329 | ||||||||
| Description |
|
Playing with the stack tool, it uncovered this strange piece in mdc_changelog_send_thread: /* Send EOF no matter what our result */ if ((kuch = changelog_kuc_hdr(cs->cs_buf, sizeof(*kuch), cs->cs_flags))) { kuch->kuc_msgtype = CL_EOF; libcfs_kkuc_msg_put(cs->cs_fp, kuch); } Now, the thing is that changelog_kuc_hdr never returns NULL as we pass the pointer into it already and if it's zero, we'd totally die before even returning: static struct kuc_hdr *changelog_kuc_hdr(char *buf, int len, int flags) { struct kuc_hdr *lh = (struct kuc_hdr *)buf; LASSERT(len <= KUC_CHANGELOG_MSG_MAXSIZE); lh->kuc_magic = KUC_MAGIC; lh->kuc_transport = KUC_TRANSPORT_CHANGELOG; lh->kuc_flags = flags; lh->kuc_msgtype = CL_RECORD; lh->kuc_msglen = len; return lh; } So I guess weeither should do away with the if here and make for a more readable code, or actually insert some checks into changelog_kuc_hdr |
| Comments |
| Comment by Gerrit Updater [ 03/Dec/14 ] |
|
Henri Doreau (henri.doreau@cea.fr) uploaded a new patch: http://review.whamcloud.com/12919 |
| Comment by Henri Doreau (Inactive) [ 22/Jan/15 ] |
|
I have posted a patch to clean that on http://review.whamcloud.com/#/c/12919/ Could someone have a look? I'm not sure who to add as reviewer. |
| Comment by Gerrit Updater [ 28/Apr/15 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/12919/ |
| Comment by Peter Jones [ 07/Jul/15 ] |
|
landed for 2.8 |