CDEBUG(D_CHANGELOG, "changelog to fp=%p start "LPU64"\n",
cs->cs_fp, cs->cs_startrec);
+ /*
+ * It's important to daemonize here to close unused FDs.
+ * The write fd from pipe is already opened by the caller,
+ * so it's fine to clear all files here
+ */
+ cfs_daemonize("mdc_clg_send_thread");
+
OBD_ALLOC(cs->cs_buf, CR_MAXSIZE);
if (cs->cs_buf == NULL)
GOTO(out, rc = -ENOMEM);
GOTO(out, rc);
}
- /* We need the pipe fd open, so llog_process can't daemonize */
- rc = llog_cat_process_flags(llh, changelog_show_cb, cs,
- LLOG_FLAG_NODEAMON, 0, 0);
+ rc = llog_cat_process_flags(llh, changelog_show_cb, cs, 0, 0, 0);
/* Send EOF no matter what our result */
if ((kuch = changelog_kuc_hdr(cs->cs_buf, sizeof(*kuch),