Re: [PATCH] Send IN_ATTRIB events when link count changes

From: Jan Kara
Date: Wed Nov 28 2007 - 07:54:23 EST


On Tue 27-11-07 12:46:40, Andrew Morton wrote:
> On Mon, 26 Nov 2007 17:27:58 +0100
> Jan Kara <jack@xxxxxxx> wrote:
>
> > Hi Andrew,
> >
> > would you pick up this patch for testing in -mm? Thanks.
> >
> > Honza
> >
> > --
> > Jan Kara <jack@xxxxxxx>
> > SUSE Labs, CR
> >
> > ---
> >
> > Send inotify events to the inode itself when its link count has changed.
>
> Could we have a better changelog please? What is the reason for making
> this change? What are the before-and-after effects upon inotify clients,
> etc?
OK, hopefully a better change log:

Currently, no notification event has been sent when inode's link count
changed. This is inconvenient for the application in some cases:
Suppose you have the following directory structure
foo/test
bar/

and you watch test. If someone does "mv foo/test bar/", you get event
IN_MOVE_SELF and you know something has happened with the file "test".
However if someone does "ln foo/test bar/test" and "rm foo/test" you get no
inotify event for the file "test" (only directories "foo" and "bar" receive
events).
Furthermore it could be argued that link count belongs to file's metadata
and thus IN_ATTRIB should be sent when it changes.
The following patch implements sending of IN_ATTRIB inotify events when
link count of the inode changes, i.e., when a hardlink to the inode is
created or when it is removed. This event is sent in addition to all the
events sent so far. In particular, when a last link to a file is removed,
IN_ATTRIB event is sent in addition to IN_DELETE_SELF event.

Honza
--
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/