[Devel] O_NONBLOCK for directory
Dmitry Mishin
dim at virtuozzo.com
Fri Apr 15 04:48:11 PDT 2016
From: <devel-bounces at openvz.org<mailto:devel-bounces at openvz.org>> on behalf of Kir Kolyshkin <kir at openvz.org<mailto:kir at openvz.org>>
Date: Friday 15 April 2016 01:35
To: "devel at openvz.org<mailto:devel at openvz.org>" <devel at openvz.org<mailto:devel at openvz.org>>
Subject: [Devel] O_NONBLOCK for directory
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 Sukhih committed 36df847b99c<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?
Added accidentally, you are right, it doesn't change anything.
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).
It does exactly as specified - enforces open file to be a directory. Any problems with this enforcement?
Thank you,
Dmitry.
Regards,
Kir.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/devel/attachments/20160415/e50bb156/attachment-0001.html>
More information about the Devel
mailing list