Re: [smartos-discuss] inotify issues

2014-12-11 Thread Bryan Cantrill via smartos-discuss
Just wanted to let you know that I fixed this; commit is here: https://github.com/joyent/illumos-joyent/commit/af6c46b5dae7a37d78d71546df5045236cd48994 This doesn't address the IN_CREATE issue, which is a much more involved issue -- but should solve the FIONREAD problems... - Bryan

Re: [smartos-discuss] inotify issues

2014-12-11 Thread Youzhong Yang via smartos-discuss
Thanks Bryan for your attentions to these issues and providing fixes so quickly. I really appreciate it. This morning I built new image with your fix and confirmed that now samba works smoothly providing change notification using inotify in a smartos OS zone. It's the first time we no longer

Re: [smartos-discuss] inotify issues

2014-12-11 Thread Bryan Cantrill via smartos-discuss
Youzhong, Awesome -- that's great news! And that's exactly what I wanted to know with respect to IN_CREATE, thank you! I think it's worth keeping track of that issue, but any fix is going to be pretty ugly, so I'm just as happy to not fix it. ;) Thanks again for the issues and test cases --

[smartos-discuss] inotify issues

2014-12-10 Thread Youzhong Yang via smartos-discuss
Hello again, I downloaded smartos latest image (joyent_20141127T173954Z) and tested inotify using it. Two issues were observed: 1. ioctl(fd, FIONREAD, ...) does not work as expected. It does not return the number of bytes that are available to be read on an inotify instance. 2. In an OS zone,

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Bryan Cantrill via smartos-discuss
The touch differences can be explained by the touch(1) that you're using: in the global zone, you're using /usr/bin/touch, but in the non-global, I imagine that you're using /opt/local/bin/touch. These two implementations differ, so not a huge surprise that their implementation details differ.

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Youzhong Yang via smartos-discuss
Thanks Bryan. Indeed in the zone /opt/local/bin/touch is used. But I still see the issue: open(filename, O_WRONLY|O_NONBLOCK|O_CREAT|O_NOCTTY, 0666) is a file open operation and should result in no IN_CREATE event if the file exists (O_CREAT - Create the file if it does not exist). I used the

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Youzhong Yang via smartos-discuss
Hi Bryan, I saw the bug in the function inotify_ioctl() and tried to fix it. Now with my new image ioctl(FIONREAD) returns state-ins_size as the bytes available to be read. [root@batfs5901 ~]# /var/tmp/inotify ioctl = 0, errno = 0, bufsize = 64 got 48 bytes - New file yyang created - yyang

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Bryan Cantrill via smartos-discuss
Yes, on looking this, it turns out (to my surprise, actually) that fop_create() is called on extant files (that is, when O_CREAT is set but the file exists). Unfortunately, there's not really an easy answer here; it might be tempting to fire IN_CREATE on the VE_CREATE vnode event (rather than the

Re: [smartos-discuss] inotify issues

2014-12-10 Thread Bryan Cantrill via smartos-discuss
Yeah, that's busted, and I see the bug (we're calculating the size incorrectly); I'll fix that when I fix FIONREAD -- with my apologies... - Bryan On Wed, Dec 10, 2014 at 12:37 PM, Youzhong Yang youzh...@gmail.com wrote: Hi Bryan, I saw the bug in the function inotify_ioctl() and