[Devel] O_NONBLOCK for directory

Kir Kolyshkin kir at openvz.org
Thu Apr 14 15:35:09 PDT 2016


I am reviewing recent VZ7 libploop commits, in particular, this one:

   https://src.openvz.org/projects/OVZ/repos/ploop/commits/36df847b9

I left a question there, let me repeat it here in a hope someone answers.

> Igor Sukhihcommitted36df847b99c 
> <https://src.openvz.org/projects/OVZ/repos/ploop/commits/36df847b99c92557c69255ebfb00d4cc74cb51ac>Yesterday
> ploop_copy_init(): open folder with O_DIRECTORY flag
>
...
> -        _h->mntfd = open(mnt, O_RDONLY);
> +        _h->mntfd = open(mnt, O_RDONLY|O_NONBLOCK|O_DIRECTORY);

1. What's the reason for adding O_NONBLOCK here? As far as I can see, it 
doesn't
change anything at all (neither in this open(), nor in subsequent 
syncfs(), ioctl()
and close())? I went as far as the kernel sources to check that O_NONBLOCK
doesn't affect syncfs() call, but maybe I'm mistaken?

2. What's the reason for adding O_DIRECTORY? Ideally, the changelog
should say why we're doing it, not what we do (as it's pretty clear
from the patch itself).

Regards,
   Kir.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/devel/attachments/20160414/c1a041df/attachment.html>


More information about the Devel mailing list