<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 5, 2019 at 10:16 PM Petr Vorel <<a href="mailto:pvorel@suse.cz">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Li,<br>
<br>
thanks for your review.<br>
<br>
> If test exit with TBROK the reap_wd will never get a chance to set as 1,<br>
> and the cleanup() also make no sense in tst_brk() calling.<br>
No, that's a "flag" for cleanup function which is run always (no matter whether<br>
tst_brk() was called). See cleanup() and mount_flag in [1].<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">You are right. And seems the problem is only exist in original code, it put reap_wd in wrong place and mislead my sight.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">       if ((wd = myinotify_add_watch(fd_notify, DIR_PATH, IN_ALL_EVENTS)) < 0) {<br>               tst_brk(TBROK | TERRNO,<br>                       "inotify_add_watch (%d, " DIR_PATH ", IN_ALL_EVENTS) failed",<br>                       fd_notify);<br>               reap_wd = 1;<br>       };<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> > with reap_wd defined in inotify.h there could be also<br>
> > SAFE_MYINOTIFY_RM_WATCH().<br>
And my suggestion above was to handle this flag in inotify.h. Than it'd make<br>
sense to add also SAFE_MYINOTIFY_RM_WATCH().<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">You patch set looks good. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Sorry for the error in judgment, that remind me it's time to go to bed now:).</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>