04 Jan, 2012

1 commit


07 Jan, 2011

4 commits

  • dcache_inode_lock can be replaced with per-inode locking. Use existing
    inode->i_lock for this. This is slightly non-trivial because we sometimes
    need to find the inode from the dentry, which requires d_inode to be
    stabilised (either with refcount or d_lock).

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • dcache_lock no longer protects anything. remove it.

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Add a new lock, dcache_inode_lock, to protect the inode's i_dentry list
    from concurrent modification. d_alias is also protected by d_lock.

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Protect d_subdirs and d_child with d_lock, except in filesystems that aren't
    using dcache_lock for these anyway (eg. using i_mutex).

    Note: if we change the locking rule in future so that ->d_child protection is
    provided only with ->d_parent->d_lock, it may allow us to reduce some locking.
    But it would be an exception to an otherwise regular locking scheme, so we'd
    have to see some good results. Probably not worthwhile.

    Signed-off-by: Nick Piggin

    Nick Piggin
     

29 Oct, 2010

2 commits


26 Oct, 2010

1 commit

  • Use dget_parent instead of opencoding it. This simplifies the code, but
    more importanly prepares for the more complicated locking for a parent
    dget in the dcache scale patch series.

    It means we do grab a reference to the parent now if need to be watched,
    but not with the specified mask. If this turns out to be a problem
    we'll have to revisit it, but for now let's keep as much as possible
    dcache internals inside dcache.[ch].

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Christoph Hellwig
     

28 Aug, 2010

2 commits

  • The fsnotify main loop has 2 bools which indicated if we processed the
    inode or vfsmount mark in that particular pass through the loop. These
    bool can we replaced with the inode_group and vfsmount_group variables
    and actually make the code a little easier to understand.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • Marks were stored on the inode and vfsmonut mark list in order from
    highest memory address to lowest memory address. The code to walk those
    lists thought they were in order from lowest to highest with
    unpredictable results when trying to match up marks from each. It was
    possible that extra events would be sent to userspace when inode
    marks ignoring events wouldn't get matched with the vfsmount marks.

    This problem only affected fanotify when using both vfsmount and inode
    marks simultaneously.

    Signed-off-by: Eric Paris

    Eric Paris
     

23 Aug, 2010

3 commits

  • The interesting 2 list lockstep walking didn't quite work out if the inode
    marks only had ignores and the vfsmount list requested events. The code to
    shortcut list traversal would not run the inode list since it didn't have real
    event requests. This code forces inode list traversal when a vfsmount mark
    matches the event type. Maybe we could add an i_fsnotify_ignored_mask field
    to struct inode to get the shortcut back, but it doesn't seem worth it to grow
    struct inode again.

    I bet with the recent changes to lock the way we do now it would actually not
    be a major perf hit to just drop i_fsnotify_mark_mask altogether. But that is
    for another day.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • The fsnotify main loop has 2 booleans which tell if a particular mark was
    sent to the listeners or if it should be processed in the next pass. The
    problem is that the booleans were not reset on each traversal of the loop.
    So marks could get skipped even when they were not sent to the notifiers.

    Reported-by: Tvrtko Ursulin
    Signed-off-by: Eric Paris

    Eric Paris
     
  • The fanotify code is supposed to get the group from the mark. It accidentally
    only used the inode_mark. If the vfsmount_mark was set but not the inode_mark
    it would deref the NULL inode_mark. Get the group from the correct place.

    Reported-by: Tvrtko Ursulin
    Signed-off-by: Eric Paris

    Eric Paris
     

13 Aug, 2010

1 commit

  • This reverts commit 3bcf3860a4ff9bbc522820b4b765e65e4deceb3e (and the
    accompanying commit c1e5c954020e "vfs/fsnotify: fsnotify_close can delay
    the final work in fput" that was a horribly ugly hack to make it work at
    all).

    The 'struct file' approach not only causes that disgusting hack, it
    somehow breaks pulseaudio, probably due to some other subtlety with
    f_count handling.

    Fix up various conflicts due to later fsnotify work.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

28 Jul, 2010

26 commits

  • fanotify currently, when given a vfsmount_mark will look up (if it exists)
    the corresponding inode mark. This patch drops that lookup and uses the
    mark provided.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • should_send_event() and handle_event() will both need to look up the inode
    event if they get a vfsmount event. Lets just pass both at the same time
    since we have them both after walking the lists in lockstep.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • We currently walk the list of marks on an inode followed by the list of
    marks on the vfsmount. These are in order (by the memory address of the
    group) so lets walk them both together. Eventually we can pass both the
    inode mark and the vfsmount mark to helpers simultaneously.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • currently ignored_mark clearing is done in a seperate list traversal
    before the actual list traversal to send events. There is no need for
    this. Do them at the same time.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • The global fsnotify groups lists were invented as a way to increase the
    performance of fsnotify by shortcutting events which were not interesting.
    With the changes to walk the object lists rather than global groups lists
    these shortcuts are not useful.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • Because we walk the object->fsnotify_marks list instead of the global
    fsnotify groups list we don't need the fsnotify_inode_mask and
    fsnotify_vfsmount_mask as these were simply shortcuts in fsnotify() for
    performance. They are now extra checks, rip them out.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • The change to use srcu and walk the object list rather than the global
    fsnotify_group list means that should_send_event is no longer needed for a
    number of groups and can be simplified for others. Do that.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • With the change of fsnotify to use srcu walking the marks list instead of
    walking the global groups list we now know the mark in question. The code can
    send the mark to the group's handling functions and the groups won't have to
    find those marks themselves.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • Currently reading the inode->i_fsnotify_marks or
    vfsmount->mnt_fsnotify_marks lists are protected by a spinlock on both the
    read and the write side. This patch protects the read side of those lists
    with a new single srcu.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • Al explains that calling dentry_open() with a mnt/dentry pair is only
    garunteed to be safe if they are already used in an open struct file. To
    make sure this is the case don't store and use a struct path in fsnotify,
    always use a struct file.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • It can be hard to debug fsnotify since there are so few printks. Use
    pr_debug to allow for dynamic debugging.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • This patch adds a check to make sure that all fsnotify bits are unique and we
    cannot accidentally use the same bit for 2 different fsnotify event types.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • It seems to me you are always returning 0 in fsnotify, when you should return
    the error (EPERM) returned by fanotify.

    Signed-off-by: Jean-Christophe DUBOIS
    Signed-off-by: Eric Paris

    Jean-Christophe Dubois
     
  • introduce a new fsnotify hook, fsnotify_perm(), which is called from the
    security code. This hook is used to allow fsnotify groups to make access
    control decisions about events on the system. We also must change the
    generic fsnotify function to return an error code if we intend these hooks
    to be in any way useful.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • fsnotify was using char * when it passed around the d_name.name string
    internally but it is actually an unsigned char *. This patch switches
    fsnotify to use unsigned and should silence some pointer signess warnings
    which have popped out of xfs. I do not add -Wpointer-sign to the fsnotify
    code as there are still issues with kstrdup and strlen which would pop
    out needless warnings.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • Some inodes a group may want to never hear about a set of events even if
    the inode is modified. We add a new mark flag which indicates that these
    marks should not have their ignored_mask cleared on modification.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • On inode modification we clear the ignored mask for all of the marks on the
    inode. This allows userspace to ignore accesses to inodes until there is
    something different.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • Per-mount watches allow groups to listen to fsnotify events on an entire
    mount. This patch simply adds and initializes the fields needed in the
    vfsmount struct to make this happen.

    Signed-off-by: Andreas Gruenbacher
    Signed-off-by: Eric Paris

    Andreas Gruenbacher
     
  • This patch adds the list and mask fields needed to support vfsmount marks.
    These are the same fields fsnotify needs on an inode. They are not used,
    just declared and we note where the cleanup hook should be (the function is
    not yet defined)

    Signed-off-by: Andreas Gruenbacher
    Signed-off-by: Eric Paris

    Andreas Gruenbacher
     
  • Some fsnotify operations send a struct file. This is more information than
    we technically need. We instead send a struct path in all cases instead of
    sometimes a path and sometimes a file.

    Signed-off-by: Andreas Gruenbacher
    Signed-off-by: Eric Paris

    Andreas Gruenbacher
     
  • To ensure that a group will not duplicate events when it receives it based
    on the vfsmount and the inode should_send_event test we should distinguish
    those two cases. We pass a vfsmount to this function so groups can make
    their own determinations.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • currently all of the notification systems implemented select which inodes
    they care about and receive messages only about those inodes (or the
    children of those inodes.) This patch begins to flesh out fsnotify support
    for the concept of listeners that want to hear notification for an inode
    accessed below a given monut point. This patch implements a second list
    of fsnotify groups to hold these types of groups and a second global mask
    to hold the events of interest for this type of group.

    The reason we want a second group list and mask is because the inode based
    notification should_send_event support which makes each group look for a mark
    on the given inode. With one nfsmount listener that means that every group would
    have to take the inode->i_lock, look for their mark, not find one, and return
    for every operation. By seperating vfsmount from inode listeners only when
    there is a inode listener will the inode groups have to look for their
    mark and take the inode lock. vfsmount listeners will have to grab the lock and
    look for a mark but there should be fewer of them, and one vfsmount listener
    won't cause the i_lock to be grabbed and released for every fsnotify group
    on every io operation.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • Simple renaming patch. fsnotify is about to support mount point listeners
    so I am renaming fsnotify_groups and fsnotify_mask to indicate these are lists
    used only for groups which have watches on inodes.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • fanotify needs a path in order to open an fd to the object which changed.
    Currently notifications to inode's parents are done using only the inode.
    For some parental notification we have the entire file, send that so
    fanotify can use it.

    Signed-off-by: Eric Paris

    Eric Paris
     
  • fanotify is going to need to look at file->private_data to know if an event
    should be sent or not. This passes the data (which might be a file,
    dentry, inode, or none) to the should_send function calls so fanotify can
    get that information when available

    Signed-off-by: Eric Paris

    Eric Paris
     
  • fanotify is only interested in event types which contain enough information
    to open the original file in the context of the fanotify listener. Since
    fanotify may not want to send events if that data isn't present we pass
    the data type to the should_send_event function call so fanotify can express
    its lack of interest.

    Signed-off-by: Eric Paris

    Eric Paris