LWN.net Logo

LinuxConf.eu wrapup

LinuxConf.eu wrapup

Posted Sep 13, 2007 21:34 UTC (Thu) by jengelh (subscriber, #33263)
In reply to: LinuxConf.eu wrapup by intgr
Parent article: LinuxConf.eu wrapup

Yes, of course you are right, inotify is at the VFS. But the VFS is deep and shallow :-)
Consider the following little pseudo function. (I am not sure it is lock-wise correct, but that is not the issue here.)

static ssize_t foofs_write(struct file *filp, const char __user *buf, size_t len, off_t *ppos)
{
    struct fooinode *ino = filp->f_dentry->d_inode->i_private;
    struct dentry *de;
    list_for_each_entry(de, ino->dentries, ...) {
        fsnotify_modify(de);
    }
    return do_sync_write(filp, buf, len, ppos);
}

This is specific to foofs that it can actually trigger fsnotify_modify events on all dentries that reference the same inode, because only foofs has the 1:N mapping from inode:dentries.

The regular case outside foofs only triggers an fsnotify_modify on the dentry you actually opened (see fs/read_write.c in vfs_write()).


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds