* [PATCH] Fix overlayfs inotify interaction
@ 2016-06-30 11:04 Andrey Jr. Melnikov
2016-07-12 21:01 ` Andrey Melnikov
0 siblings, 1 reply; 6+ messages in thread
From: Andrey Jr. Melnikov @ 2016-06-30 11:04 UTC (permalink / raw)
To: Miklos Szeredi, linux-unionfs; +Cc: John McCutchan, Robert Love, Eric Paris
Fix overlayfs inotify interaction - use d_real_inode() helper
to resolve real (underlying) inode. Without this inotify is not functional on
overlayfs.
Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
---
Runtime tested with inotifywait in monitor mode to confirm event generation.
cd /tmp/ && mkdir dest upper lower work
mount -t overlay none dest -o upperdir=upper/,lowerdir=lower/,workdir=work/
while /bin/true; do echo test >>/tmp/dest/lower-data; sleep 5; done &
inotifywait -m /tmp/dest/lower-data
fs/notify/inotify/inotify_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index b8d08d0..592ce16 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -742,7 +742,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
goto fput_and_out;
/* inode held in place by reference to path; group by fget on fd */
- inode = path.dentry->d_inode;
+ inode = d_real_inode(path.dentry);
group = f.file->private_data;
/* create/update an inode mark */
--
2.8.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix overlayfs inotify interaction
2016-06-30 11:04 [PATCH] Fix overlayfs inotify interaction Andrey Jr. Melnikov
@ 2016-07-12 21:01 ` Andrey Melnikov
2016-07-14 9:23 ` Miklos Szeredi
0 siblings, 1 reply; 6+ messages in thread
From: Andrey Melnikov @ 2016-07-12 21:01 UTC (permalink / raw)
To: Miklos Szeredi, linux-unionfs
Ping.
2016-06-30 14:04 GMT+03:00 Andrey Jr. Melnikov <temnota.am@gmail.com>:
> Fix overlayfs inotify interaction - use d_real_inode() helper
> to resolve real (underlying) inode. Without this inotify is not functional on
> overlayfs.
>
> Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
>
> ---
> Runtime tested with inotifywait in monitor mode to confirm event generation.
>
> cd /tmp/ && mkdir dest upper lower work
> mount -t overlay none dest -o upperdir=upper/,lowerdir=lower/,workdir=work/
> while /bin/true; do echo test >>/tmp/dest/lower-data; sleep 5; done &
> inotifywait -m /tmp/dest/lower-data
>
> fs/notify/inotify/inotify_user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index b8d08d0..592ce16 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -742,7 +742,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
> goto fput_and_out;
>
> /* inode held in place by reference to path; group by fget on fd */
> - inode = path.dentry->d_inode;
> + inode = d_real_inode(path.dentry);
> group = f.file->private_data;
>
> /* create/update an inode mark */
> --
> 2.8.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix overlayfs inotify interaction
2016-07-12 21:01 ` Andrey Melnikov
@ 2016-07-14 9:23 ` Miklos Szeredi
2016-07-14 9:42 ` Andrey Melnikov
0 siblings, 1 reply; 6+ messages in thread
From: Miklos Szeredi @ 2016-07-14 9:23 UTC (permalink / raw)
To: Andrey Melnikov; +Cc: linux-unionfs@vger.kernel.org
On Tue, Jul 12, 2016 at 11:01 PM, Andrey Melnikov <temnota.am@gmail.com> wrote:
> Ping.
>
> 2016-06-30 14:04 GMT+03:00 Andrey Jr. Melnikov <temnota.am@gmail.com>:
>> Fix overlayfs inotify interaction - use d_real_inode() helper
>> to resolve real (underlying) inode. Without this inotify is not functional on
>> overlayfs.
Have you tried the alternative patch from Aihua Zhang:
https://lkml.org/lkml/2016/7/7/83
?
Thanks,
Miklos
>>
>> Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
>>
>> ---
>> Runtime tested with inotifywait in monitor mode to confirm event generation.
>>
>> cd /tmp/ && mkdir dest upper lower work
>> mount -t overlay none dest -o upperdir=upper/,lowerdir=lower/,workdir=work/
>> while /bin/true; do echo test >>/tmp/dest/lower-data; sleep 5; done &
>> inotifywait -m /tmp/dest/lower-data
>>
>> fs/notify/inotify/inotify_user.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
>> index b8d08d0..592ce16 100644
>> --- a/fs/notify/inotify/inotify_user.c
>> +++ b/fs/notify/inotify/inotify_user.c
>> @@ -742,7 +742,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
>> goto fput_and_out;
>>
>> /* inode held in place by reference to path; group by fget on fd */
>> - inode = path.dentry->d_inode;
>> + inode = d_real_inode(path.dentry);
>> group = f.file->private_data;
>>
>> /* create/update an inode mark */
>> --
>> 2.8.1
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix overlayfs inotify interaction
2016-07-14 9:23 ` Miklos Szeredi
@ 2016-07-14 9:42 ` Andrey Melnikov
2016-07-14 9:53 ` Miklos Szeredi
0 siblings, 1 reply; 6+ messages in thread
From: Andrey Melnikov @ 2016-07-14 9:42 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: linux-unionfs@vger.kernel.org, zhangaihua
2016-07-14 12:23 GMT+03:00 Miklos Szeredi <miklos@szeredi.hu>:
> On Tue, Jul 12, 2016 at 11:01 PM, Andrey Melnikov <temnota.am@gmail.com> wrote:
>> Ping.
>>
>> 2016-06-30 14:04 GMT+03:00 Andrey Jr. Melnikov <temnota.am@gmail.com>:
>>> Fix overlayfs inotify interaction - use d_real_inode() helper
>>> to resolve real (underlying) inode. Without this inotify is not functional on
>>> overlayfs.
>
> Have you tried the alternative patch from Aihua Zhang:
> https://lkml.org/lkml/2016/7/7/83
No. My patch add small overhead, lookup inode once when add inotify
watch, this patch - lookup inode on each operation. For what?
>>>
>>> Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
>>>
>>> ---
>>> Runtime tested with inotifywait in monitor mode to confirm event generation.
>>>
>>> cd /tmp/ && mkdir dest upper lower work
>>> mount -t overlay none dest -o upperdir=upper/,lowerdir=lower/,workdir=work/
>>> while /bin/true; do echo test >>/tmp/dest/lower-data; sleep 5; done &
>>> inotifywait -m /tmp/dest/lower-data
>>>
>>> fs/notify/inotify/inotify_user.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
>>> index b8d08d0..592ce16 100644
>>> --- a/fs/notify/inotify/inotify_user.c
>>> +++ b/fs/notify/inotify/inotify_user.c
>>> @@ -742,7 +742,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
>>> goto fput_and_out;
>>>
>>> /* inode held in place by reference to path; group by fget on fd */
>>> - inode = path.dentry->d_inode;
>>> + inode = d_real_inode(path.dentry);
>>> group = f.file->private_data;
>>>
>>> /* create/update an inode mark */
>>> --
>>> 2.8.1
>>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix overlayfs inotify interaction
2016-07-14 9:42 ` Andrey Melnikov
@ 2016-07-14 9:53 ` Miklos Szeredi
2016-07-14 10:08 ` Andrey Melnikov
0 siblings, 1 reply; 6+ messages in thread
From: Miklos Szeredi @ 2016-07-14 9:53 UTC (permalink / raw)
To: Andrey Melnikov; +Cc: linux-unionfs@vger.kernel.org, zhangaihua
On Thu, Jul 14, 2016 at 11:42 AM, Andrey Melnikov <temnota.am@gmail.com> wrote:
> 2016-07-14 12:23 GMT+03:00 Miklos Szeredi <miklos@szeredi.hu>:
>> On Tue, Jul 12, 2016 at 11:01 PM, Andrey Melnikov <temnota.am@gmail.com> wrote:
>>> Ping.
>>>
>>> 2016-06-30 14:04 GMT+03:00 Andrey Jr. Melnikov <temnota.am@gmail.com>:
>>>> Fix overlayfs inotify interaction - use d_real_inode() helper
>>>> to resolve real (underlying) inode. Without this inotify is not functional on
>>>> overlayfs.
>>
>> Have you tried the alternative patch from Aihua Zhang:
>> https://lkml.org/lkml/2016/7/7/83
>
> No. My patch add small overhead, lookup inode once when add inotify
> watch, this patch - lookup inode on each operation. For what?
I'm afraid that your patch won't work for all notifications (like
directory modification).
Thanks,
Miklos
>
>>>>
>>>> Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
>>>>
>>>> ---
>>>> Runtime tested with inotifywait in monitor mode to confirm event generation.
>>>>
>>>> cd /tmp/ && mkdir dest upper lower work
>>>> mount -t overlay none dest -o upperdir=upper/,lowerdir=lower/,workdir=work/
>>>> while /bin/true; do echo test >>/tmp/dest/lower-data; sleep 5; done &
>>>> inotifywait -m /tmp/dest/lower-data
>>>>
>>>> fs/notify/inotify/inotify_user.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
>>>> index b8d08d0..592ce16 100644
>>>> --- a/fs/notify/inotify/inotify_user.c
>>>> +++ b/fs/notify/inotify/inotify_user.c
>>>> @@ -742,7 +742,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
>>>> goto fput_and_out;
>>>>
>>>> /* inode held in place by reference to path; group by fget on fd */
>>>> - inode = path.dentry->d_inode;
>>>> + inode = d_real_inode(path.dentry);
>>>> group = f.file->private_data;
>>>>
>>>> /* create/update an inode mark */
>>>> --
>>>> 2.8.1
>>>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix overlayfs inotify interaction
2016-07-14 9:53 ` Miklos Szeredi
@ 2016-07-14 10:08 ` Andrey Melnikov
0 siblings, 0 replies; 6+ messages in thread
From: Andrey Melnikov @ 2016-07-14 10:08 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: linux-unionfs@vger.kernel.org, zhangaihua
2016-07-14 12:53 GMT+03:00 Miklos Szeredi <miklos@szeredi.hu>:
> On Thu, Jul 14, 2016 at 11:42 AM, Andrey Melnikov <temnota.am@gmail.com> wrote:
>> 2016-07-14 12:23 GMT+03:00 Miklos Szeredi <miklos@szeredi.hu>:
>>> On Tue, Jul 12, 2016 at 11:01 PM, Andrey Melnikov <temnota.am@gmail.com> wrote:
>>>> Ping.
>>>>
>>>> 2016-06-30 14:04 GMT+03:00 Andrey Jr. Melnikov <temnota.am@gmail.com>:
>>>>> Fix overlayfs inotify interaction - use d_real_inode() helper
>>>>> to resolve real (underlying) inode. Without this inotify is not functional on
>>>>> overlayfs.
>>>
>>> Have you tried the alternative patch from Aihua Zhang:
>>> https://lkml.org/lkml/2016/7/7/83
>>
>> No. My patch add small overhead, lookup inode once when add inotify
>> watch, this patch - lookup inode on each operation. For what?
>
> I'm afraid that your patch won't work for all notifications (like
> directory modification).
It work with dir's too:
# mount
none on /tmp/dest type overlay
(rw,relatime,lowerdir=lower/,upperdir=upper/,workdir=work/)
# cd /tmp/dest/test-dir/
/tmp/dest/test-dir# ls -als
total 8
4 drwxr-xr-x 2 root root 4096 Jul 14 09:58 .
4 drwxr-xr-x 1 root root 4096 Jul 14 09:58 ..
/tmp/dest/test-dir# touch test-1
/tmp/dest/test-dir# cd ..
/tmp/dest# mv test-dir/ test-dir-1/
/tmp/dest# touch test-dir-1/test-2
/tmp/dest# mkdir test-dir-1/test-dir-2
in other console:
# inotifywait -m /tmp/dest/test-dir/
Setting up watches.
Watches established.
/tmp/dest/test-dir/ OPEN,ISDIR
/tmp/dest/test-dir/ ACCESS,ISDIR
/tmp/dest/test-dir/ CLOSE_NOWRITE,CLOSE,ISDIR
/tmp/dest/test-dir/ OPEN,ISDIR
/tmp/dest/test-dir/ ACCESS,ISDIR
/tmp/dest/test-dir/ CLOSE_NOWRITE,CLOSE,ISDIR
/tmp/dest/test-dir/ CREATE test-1
/tmp/dest/test-dir/ OPEN test-1
/tmp/dest/test-dir/ ATTRIB test-1
/tmp/dest/test-dir/ CLOSE_WRITE,CLOSE test-1
/tmp/dest/test-dir/ MOVE_SELF
/tmp/dest/test-dir/ OPEN,ISDIR
/tmp/dest/test-dir/ ACCESS,ISDIR
/tmp/dest/test-dir/ CLOSE_NOWRITE,CLOSE,ISDIR
/tmp/dest/test-dir/ CREATE test-2
/tmp/dest/test-dir/ OPEN test-2
/tmp/dest/test-dir/ ATTRIB test-2
/tmp/dest/test-dir/ CLOSE_WRITE,CLOSE test-2
/tmp/dest/test-dir/ CREATE,ISDIR test-dir-2
/tmp/dest/test-dir/ OPEN,ISDIR
/tmp/dest/test-dir/ ACCESS,ISDIR
/tmp/dest/test-dir/ CLOSE_NOWRITE,CLOSE,ISDIR
Can't see any problem here.
>>>>> Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
>>>>>
>>>>> ---
>>>>> Runtime tested with inotifywait in monitor mode to confirm event generation.
>>>>>
>>>>> cd /tmp/ && mkdir dest upper lower work
>>>>> mount -t overlay none dest -o upperdir=upper/,lowerdir=lower/,workdir=work/
>>>>> while /bin/true; do echo test >>/tmp/dest/lower-data; sleep 5; done &
>>>>> inotifywait -m /tmp/dest/lower-data
>>>>>
>>>>> fs/notify/inotify/inotify_user.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
>>>>> index b8d08d0..592ce16 100644
>>>>> --- a/fs/notify/inotify/inotify_user.c
>>>>> +++ b/fs/notify/inotify/inotify_user.c
>>>>> @@ -742,7 +742,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
>>>>> goto fput_and_out;
>>>>>
>>>>> /* inode held in place by reference to path; group by fget on fd */
>>>>> - inode = path.dentry->d_inode;
>>>>> + inode = d_real_inode(path.dentry);
>>>>> group = f.file->private_data;
>>>>>
>>>>> /* create/update an inode mark */
>>>>> --
>>>>> 2.8.1
>>>>>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-07-14 10:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-30 11:04 [PATCH] Fix overlayfs inotify interaction Andrey Jr. Melnikov
2016-07-12 21:01 ` Andrey Melnikov
2016-07-14 9:23 ` Miklos Szeredi
2016-07-14 9:42 ` Andrey Melnikov
2016-07-14 9:53 ` Miklos Szeredi
2016-07-14 10:08 ` Andrey Melnikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).