<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/notify/inotify, branch linux-4.0.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.0.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.0.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-12-13T20:42:53Z</updated>
<entry>
<title>fsnotify: unify inode and mount marks handling</title>
<updated>2014-12-13T20:42:53Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-12-13T00:58:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0809ab69a2782afac8c4d7f3d35cd123050aab9a'/>
<id>urn:sha1:0809ab69a2782afac8c4d7f3d35cd123050aab9a</id>
<content type='text'>
There's a lot of common code in inode and mount marks handling.  Factor it
out to a common helper function.

Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Cc: Eric Paris &lt;eparis@redhat.com&gt;
Cc: Heinrich Schuchardt &lt;xypron.glpk@gmx.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>sched, inotify: Deal with nested sleeps</title>
<updated>2014-10-28T09:55:37Z</updated>
<author>
<name>Peter Zijlstra</name>
</author>
<published>2014-09-24T08:18:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e23738a7300a7591a57a22f47b813fd1b53ec404'/>
<id>urn:sha1:e23738a7300a7591a57a22f47b813fd1b53ec404</id>
<content type='text'>
inotify_read is a wait loop with sleeps in. Wait loops rely on
task_struct::state and sleeps do too, since that's the only means of
actually sleeping. Therefore the nested sleeps destroy the wait loop
state and the wait loop breaks the sleep functions that assume
TASK_RUNNING (mutex_lock).

Fix this by using the new woken_wake_function and wait_woken() stuff,
which registers wakeups in wait and thereby allows shrinking the
task_state::state changes to the actual sleep part.

Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: tglx@linutronix.de
Cc: ilya.dryomov@inktank.com
Cc: umgwanakikbuti@gmail.com
Cc: Robert Love &lt;rlove@rlove.org&gt;
Cc: Eric Paris &lt;eparis@parisplace.org&gt;
Cc: John McCutchan &lt;john@johnmccutchan.com&gt;
Cc: Robert Love &lt;rlove@rlove.org&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Link: http://lkml.kernel.org/r/20140924082242.254858080@infradead.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>fsnotify: don't put user context if it was never assigned</title>
<updated>2014-10-10T02:25:45Z</updated>
<author>
<name>Sasha Levin</name>
</author>
<published>2014-10-09T22:24:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=105d1b425303120c7681abc0761b6fc6c3f8a8e8'/>
<id>urn:sha1:105d1b425303120c7681abc0761b6fc6c3f8a8e8</id>
<content type='text'>
On some failure paths we may attempt to free user context even if it
wasn't assigned yet.  This will cause a NULL ptr deref and a kernel BUG.

The path I was looking at is in inotify_new_group():

        oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL);
        if (unlikely(!oevent)) {
                fsnotify_destroy_group(group);
                return ERR_PTR(-ENOMEM);
        }

fsnotify_destroy_group() would get called here, but
group-&gt;inotify_data.user is only getting assigned later:

	group-&gt;inotify_data.user = get_current_user();

Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Cc: John McCutchan &lt;john@johnmccutchan.com&gt;
Cc: Robert Love &lt;rlove@rlove.org&gt;
Cc: Eric Paris &lt;eparis@parisplace.org&gt;
Reviewed-by: Heinrich Schuchardt &lt;xypron.glpk@gmx.de&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>fsnotify: rename event handling functions</title>
<updated>2014-08-07T01:01:12Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-08-06T23:03:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8ba8fa917093510cdcb4ec8ff8b9603e1b525658'/>
<id>urn:sha1:8ba8fa917093510cdcb4ec8ff8b9603e1b525658</id>
<content type='text'>
Rename fsnotify_add_notify_event() to fsnotify_add_event() since the
"notify" part is duplicit.  Rename fsnotify_remove_notify_event() and
fsnotify_peek_notify_event() to fsnotify_remove_first_event() and
fsnotify_peek_first_event() respectively since "notify" part is duplicit
and they really look at the first event in the queue.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Cc: Eric Paris &lt;eparis@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>inotify: convert use of typedef ctl_table to struct ctl_table</title>
<updated>2014-06-06T23:08:16Z</updated>
<author>
<name>Joe Perches</name>
</author>
<published>2014-06-06T21:38:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=92f778dd5d2d3a7619c09d04a59fe10bfb19774e'/>
<id>urn:sha1:92f778dd5d2d3a7619c09d04a59fe10bfb19774e</id>
<content type='text'>
This typedef is unnecessary and should just be removed.

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>fsnotify: Allocate overflow events with proper type</title>
<updated>2014-02-25T10:18:06Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-02-21T18:14:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ff57cd5863cf3014c1c5ed62ce2715294f065b17'/>
<id>urn:sha1:ff57cd5863cf3014c1c5ed62ce2715294f065b17</id>
<content type='text'>
Commit 7053aee26a35 "fsnotify: do not share events between notification
groups" used overflow event statically allocated in a group with the
size of the generic notification event. This causes problems because
some code looks at type specific parts of event structure and gets
confused by a random data it sees there and causes crashes.

Fix the problem by allocating overflow event with type corresponding to
the group type so code cannot get confused.

Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>inotify: Fix reporting of cookies for inotify events</title>
<updated>2014-02-18T10:17:17Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-02-17T12:09:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=45a22f4c11fef4ecd5c61c0a299cd3f23d77be8e'/>
<id>urn:sha1:45a22f4c11fef4ecd5c61c0a299cd3f23d77be8e</id>
<content type='text'>
My rework of handling of notification events (namely commit 7053aee26a35
"fsnotify: do not share events between notification groups") broke
sending of cookies with inotify events. We didn't propagate the value
passed to fsnotify() properly and passed 4 uninitialized bytes to
userspace instead (so it is also an information leak). Sadly I didn't
notice this during my testing because inotify cookies aren't used very
much and LTP inotify tests ignore them.

Fix the problem by passing the cookie value properly.

Fixes: 7053aee26a3548ebaba046ae2e52396ccf56ac6c
Reported-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>fsnotify: Do not return merged event from fsnotify_add_notify_event()</title>
<updated>2014-01-29T12:57:10Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-01-28T17:53:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=83c0e1b442b488571f4fef4a91c2fe52eed6c705'/>
<id>urn:sha1:83c0e1b442b488571f4fef4a91c2fe52eed6c705</id>
<content type='text'>
The event returned from fsnotify_add_notify_event() cannot ever be used
safely as the event may be freed by the time the function returns (after
dropping notification_mutex). So change the prototype to just return
whether the event was added or merged into some existing event.

Reported-and-tested-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
Reported-and-tested-by: Dave Jones &lt;davej@fedoraproject.org&gt;
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
</content>
</entry>
<entry>
<title>fsnotify: remove .should_send_event callback</title>
<updated>2014-01-22T00:19:41Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-01-21T23:48:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=83c4c4b0a3aadc1ce7b5b2870ce1fc1f65498da0'/>
<id>urn:sha1:83c4c4b0a3aadc1ce7b5b2870ce1fc1f65498da0</id>
<content type='text'>
After removing event structure creation from the generic layer there is
no reason for separate .should_send_event and .handle_event callbacks.
So just remove the first one.

Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Eric Paris &lt;eparis@parisplace.org&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>fsnotify: do not share events between notification groups</title>
<updated>2014-01-22T00:19:41Z</updated>
<author>
<name>Jan Kara</name>
</author>
<published>2014-01-21T23:48:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7053aee26a3548ebaba046ae2e52396ccf56ac6c'/>
<id>urn:sha1:7053aee26a3548ebaba046ae2e52396ccf56ac6c</id>
<content type='text'>
Currently fsnotify framework creates one event structure for each
notification event and links this event into all interested notification
groups.  This is done so that we save memory when several notification
groups are interested in the event.  However the need for event
structure shared between inotify &amp; fanotify bloats the event structure
so the result is often higher memory consumption.

Another problem is that fsnotify framework keeps path references with
outstanding events so that fanotify can return open file descriptors
with its events.  This has the undesirable effect that filesystem cannot
be unmounted while there are outstanding events - a regression for
inotify compared to a situation before it was converted to fsnotify
framework.  For fanotify this problem is hard to avoid and users of
fanotify should kind of expect this behavior when they ask for file
descriptors from notified files.

This patch changes fsnotify and its users to create separate event
structure for each group.  This allows for much simpler code (~400 lines
removed by this patch) and also smaller event structures.  For example
on 64-bit system original struct fsnotify_event consumes 120 bytes, plus
additional space for file name, additional 24 bytes for second and each
subsequent group linking the event, and additional 32 bytes for each
inotify group for private data.  After the conversion inotify event
consumes 48 bytes plus space for file name which is considerably less
memory unless file names are long and there are several groups
interested in the events (both of which are uncommon).  Fanotify event
fits in 56 bytes after the conversion (fanotify doesn't care about file
names so its events don't have to have it allocated).  A win unless
there are four or more fanotify groups interested in the event.

The conversion also solves the problem with unmount when only inotify is
used as we don't have to grab path references for inotify events.

[hughd@google.com: fanotify: fix corruption preventing startup]
Signed-off-by: Jan Kara &lt;jack@suse.cz&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Eric Paris &lt;eparis@parisplace.org&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Hugh Dickins &lt;hughd@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
