Re: [RFC v2 1/4] fs: Add generic file system event notifications

From: Greg KH
Date: Mon Apr 27 2015 - 10:24:31 EST


On Mon, Apr 27, 2015 at 01:51:41PM +0200, Beata Michalska wrote:
> Introduce configurable generic interface for file
> system-wide event notifications, to provide file
> systems with a common way of reporting any potential
> issues as they emerge.
>
> The notifications are to be issued through generic
> netlink interface by newly introduced multicast group.
>
> Threshold notifications have been included, allowing
> triggering an event whenever the amount of free space drops
> below a certain level - or levels to be more precise as two
> of them are being supported: the lower and the upper range.
> The notifications work both ways: once the threshold level
> has been reached, an event shall be generated whenever
> the number of available blocks goes up again re-activating
> the threshold.
>
> The interface has been exposed through a vfs. Once mounted,
> it serves as an entry point for the set-up where one can
> register for particular file system events.
>
> Signed-off-by: Beata Michalska <b.michalska@xxxxxxxxxxx>
> ---
> Documentation/filesystems/events.txt | 231 ++++++++++
> fs/Makefile | 1 +
> fs/events/Makefile | 6 +
> fs/events/fs_event.c | 770 ++++++++++++++++++++++++++++++++++
> fs/events/fs_event.h | 25 ++
> fs/events/fs_event_netlink.c | 99 +++++
> fs/namespace.c | 1 +
> include/linux/fs.h | 6 +-
> include/linux/fs_event.h | 58 +++
> include/uapi/linux/fs_event.h | 54 +++
> include/uapi/linux/genetlink.h | 1 +
> net/netlink/genetlink.c | 7 +-
> 12 files changed, 1257 insertions(+), 2 deletions(-)
> create mode 100644 Documentation/filesystems/events.txt
> create mode 100644 fs/events/Makefile
> create mode 100644 fs/events/fs_event.c
> create mode 100644 fs/events/fs_event.h
> create mode 100644 fs/events/fs_event_netlink.c
> create mode 100644 include/linux/fs_event.h
> create mode 100644 include/uapi/linux/fs_event.h

Any reason why you just don't do uevents for the block devices today,
and not create a new type of netlink message and userspace tool required
to read these?

> --- a/fs/Makefile
> +++ b/fs/Makefile
> @@ -126,3 +126,4 @@ obj-y += exofs/ # Multiple modules
> obj-$(CONFIG_CEPH_FS) += ceph/
> obj-$(CONFIG_PSTORE) += pstore/
> obj-$(CONFIG_EFIVAR_FS) += efivarfs/
> +obj-y += events/

Always?

> diff --git a/fs/events/Makefile b/fs/events/Makefile
> new file mode 100644
> index 0000000..58d1454
> --- /dev/null
> +++ b/fs/events/Makefile
> @@ -0,0 +1,6 @@
> +#
> +# Makefile for the Linux Generic File System Event Interface
> +#
> +
> +obj-y := fs_event.o

Always? Even if the option is not selected? Why is everyone forced to
always use this code? Can't you disable it for the "tiny" systems that
don't need it?

> +struct fs_trace_entry {
> + atomic_t count;

Why not just use a 'struct kref' for your count, which will save a bunch
of open-coding of reference counting, and forcing us to audit your code
to verify you got all the corner cases correct? :)

> + atomic_t active;
> + struct super_block *sb;

Are you properly reference counting this pointer? I didn't see where
that was happening, so I must have missed it.

thanks,

greg k-h
--
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/