04 Jan, 2012

4 commits


14 Dec, 2011

1 commit


28 Sep, 2011

1 commit

  • There are numerous broken references to Documentation files (in other
    Documentation files, in comments, etc.). These broken references are
    caused by typo's in the references, and by renames or removals of the
    Documentation files. Some broken references are simply odd.

    Fix these broken references, sometimes by dropping the irrelevant text
    they were part of.

    Signed-off-by: Paul Bolle
    Signed-off-by: Jiri Kosina

    Paul Bolle
     

28 May, 2011

1 commit


27 May, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (25 commits)
    cifs: remove unnecessary dentry_unhash on rmdir/rename_dir
    ocfs2: remove unnecessary dentry_unhash on rmdir/rename_dir
    exofs: remove unnecessary dentry_unhash on rmdir/rename_dir
    nfs: remove unnecessary dentry_unhash on rmdir/rename_dir
    ext2: remove unnecessary dentry_unhash on rmdir/rename_dir
    ext3: remove unnecessary dentry_unhash on rmdir/rename_dir
    ext4: remove unnecessary dentry_unhash on rmdir/rename_dir
    btrfs: remove unnecessary dentry_unhash in rmdir/rename_dir
    ceph: remove unnecessary dentry_unhash calls
    vfs: clean up vfs_rename_other
    vfs: clean up vfs_rename_dir
    vfs: clean up vfs_rmdir
    vfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems
    libfs: drop unneeded dentry_unhash
    vfs: update dentry_unhash() comment
    vfs: push dentry_unhash on rename_dir into file systems
    vfs: push dentry_unhash on rmdir into file systems
    vfs: remove dget() from dentry_unhash()
    vfs: dentry_unhash immediately prior to rmdir
    vfs: Block mmapped writes while the fs is frozen
    ...

    Linus Torvalds
     

26 May, 2011

1 commit

  • Only a few file systems need this. Start by pushing it down into each
    fs rmdir method (except gfs2 and xfs) so it can be dealt with on a per-fs
    basis.

    This does not change behavior for any in-tree file systems.

    Acked-by: Christoph Hellwig
    Signed-off-by: Sage Weil
    Signed-off-by: Al Viro

    Sage Weil
     

18 May, 2011

2 commits

  • configfs_readdir() will use the existing inode numbers of inodes in the
    dcache, but it makes them up for attribute files that aren't currently
    instantiated. There is a race where a closing attribute file can be
    tearing down at the same time as configfs_readdir() is trying to get its
    inode number.

    We want to get the inode number of open attribute files, because they
    should match while instantiated. We can't lock down the transition
    where dentry->d_inode is set to NULL, so we just check for NULL there.
    We can, however, ensure that an inode we find isn't iput() in
    configfs_d_iput() until after we've accessed it.

    Signed-off-by: Joel Becker

    Joel Becker
     
  • When configfs is faking mkdir() on its subsystem or default group
    objects, it starts by adding a negative dentry. It then tries to
    instantiate the group. If that should fail, it must clean up after
    itself.

    I was using d_delete() here, but configfs_attach_group() promises to
    return an empty dentry on error. d_delete() explodes with the entry
    dentry. Let's try d_drop() instead. The unhashing is what we want for
    our dentry.

    Signed-off-by: Joel Becker

    Joel Becker
     

31 Mar, 2011

1 commit


17 Jan, 2011

1 commit


13 Jan, 2011

1 commit


07 Jan, 2011

7 commits

  • Reduce some branches and memory accesses in dcache lookup by adding dentry
    flags to indicate common d_ops are set, rather than having to check them.
    This saves a pointer memory access (dentry->d_op) in common path lookup
    situations, and saves another pointer load and branch in cases where we
    have d_op but not the particular operation.

    Patched with:

    git grep -E '[.>]([[:space:]])*d_op([[:space:]])*=' | xargs sed -e 's/\([^\t ]*\)->d_op = \(.*\);/d_set_d_op(\1, \2);/' -e 's/\([^\t ]*\)\.d_op = \(.*\);/d_set_d_op(\&\1, \2);/' -i

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • dget_locked was a shortcut to avoid the lazy lru manipulation when we already
    held dcache_lock (lru manipulation was relatively cheap at that point).
    However, how that the lru lock is an innermost one, we never hold it at any
    caller, so the lock cost can now be avoided. We already have well working lazy
    dcache LRU, so it should be fine to defer LRU manipulations to scan time.

    Signed-off-by: Nick Piggin

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

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Protect d_unhashed(dentry) condition with d_lock. This means keeping
    DCACHE_UNHASHED bit in synch with hash manipulations.

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Make d_count non-atomic and protect it with d_lock. This allows us to ensure a
    0 refcount dentry remains 0 without dcache_lock. It is also fairly natural when
    we start protecting many other dentry members with d_lock.

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Change d_delete from a dentry deletion notification to a dentry caching
    advise, more like ->drop_inode. Require it to be constant and idempotent,
    and not take d_lock. This is how all existing filesystems use the callback
    anyway.

    This makes fine grained dentry locking of dput and dentry lru scanning
    much simpler.

    Signed-off-by: Nick Piggin

    Nick Piggin
     
  • Switching d_op on a live dentry is racy in general, so avoid it. In this case
    it is a negative dentry, which is safer, but there are still concurrent ops
    which may be called on d_op in that case (eg. d_revalidate). So in general
    a filesystem may not do this. Fix configfs so as not to do this.

    Signed-off-by: Nick Piggin

    Nick Piggin
     

29 Oct, 2010

1 commit


26 Oct, 2010

1 commit

  • Instead of always assigning an increasing inode number in new_inode
    move the call to assign it into those callers that actually need it.
    For now callers that need it is estimated conservatively, that is
    the call is added to all filesystems that do not assign an i_ino
    by themselves. For a few more filesystems we can avoid assigning
    any inode number given that they aren't user visible, and for others
    it could be done lazily when an inode number is actually needed,
    but that's left for later patches.

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

    Christoph Hellwig
     

05 Jun, 2010

1 commit

  • sysfs and configfs setattr functions have error cases after the generic inode's
    attributes have been changed. Fix consistency by changing the generic inode
    attributes only when it is guaranteed to succeed.

    Signed-off-by: Nick Piggin
    Acked-by: Joel Becker
    Signed-off-by: Greg Kroah-Hartman

    Nick Piggin
     

28 May, 2010

1 commit


15 May, 2010

1 commit

  • 1) i_flags simply doesn't work for mount/unlink race prevention;
    we may have many links to file and rm on one of those obviously
    shouldn't prevent bind on top of another later on. To fix it
    right way we need to mark _dentry_ as unsuitable for mounting
    upon; new flag (DCACHE_CANT_MOUNT) is protected by d_flags and
    i_mutex on the inode in question. Set it (with dont_mount(dentry))
    in unlink/rmdir/etc., check (with cant_mount(dentry)) in places
    in namespace.c that used to check for S_DEAD. Setting S_DEAD
    is still needed in places where we used to set it (for directories
    getting killed), since we rely on it for readdir/rmdir race
    prevention.

    2) rename()/mount() protection has another bogosity - we unhash
    the target before we'd checked that it's not a mountpoint. Fixed.

    3) ancient bogosity in pivot_root() - we locked i_mutex on the
    right directory, but checked S_DEAD on the different (and wrong)
    one. Noticed and fixed.

    Signed-off-by: Al Viro

    Al Viro
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

14 Jan, 2010

1 commit


11 Sep, 2009

1 commit


01 May, 2009

2 commits

  • configfs_depend_item() recursively locks all inodes mutex from configfs root to
    the target item, which makes lockdep unhappy. The purpose of this recursive
    locking is to ensure that the item tree can be safely parsed and that the target
    item, if found, is not about to leave.

    This patch reworks configfs_depend_item() locking using configfs_dirent_lock.
    Since configfs_dirent_lock protects all changes to the configfs_dirent tree, and
    protects tagging of items to be removed, this lock can be used instead of the
    inodes mutex lock chain.
    This needs that the check for dependents be done atomically with
    CONFIGFS_USET_DROPPING tagging.

    Now lockdep looks happy with configfs.

    [ Lifted the setting of s_type into configfs_new_dirent() to satisfy the
    atomic setting of CONFIGFS_USET_CREATING -- Joel ]

    Signed-off-by: Louis Rilling
    Signed-off-by: Joel Becker

    Louis Rilling
     
  • When attaching default groups (subdirs) of a new group (in mkdir() or
    in configfs_register()), configfs recursively takes inode's mutexes
    along the path from the parent of the new group to the default
    subdirs. This is needed to ensure that the VFS will not race with
    operations on these sub-dirs. This is safe for the following reasons:

    - the VFS allows one to lock first an inode and second one of its
    children (The lock subclasses for this pattern are respectively
    I_MUTEX_PARENT and I_MUTEX_CHILD);
    - from this rule any inode path can be recursively locked in
    descending order as long as it stays under a single mountpoint and
    does not follow symlinks.

    Unfortunately lockdep does not know (yet?) how to handle such
    recursion.

    I've tried to use Peter Zijlstra's lock_set_subclass() helper to
    upgrade i_mutexes from I_MUTEX_CHILD to I_MUTEX_PARENT when we know
    that we might recursively lock some of their descendant, but this
    usage does not seem to fit the purpose of lock_set_subclass() because
    it leads to several i_mutex locked with subclass I_MUTEX_PARENT by
    the same task.

    >From inside configfs it is not possible to serialize those recursive
    locking with a top-level one, because mkdir() and rmdir() are already
    called with inodes locked by the VFS. So using some
    mutex_lock_nest_lock() is not an option.

    I am proposing two solutions:
    1) one that wraps recursive mutex_lock()s with
    lockdep_off()/lockdep_on().
    2) (as suggested earlier by Peter Zijlstra) one that puts the
    i_mutexes recursively locked in different classes based on their
    depth from the top-level config_group created. This
    induces an arbitrary limit (MAX_LOCK_DEPTH - 2 == 46) on the
    nesting of configfs default groups whenever lockdep is activated
    but this limit looks reasonably high. Unfortunately, this also
    isolates VFS operations on configfs default groups from the others
    and thus lowers the chances to detect locking issues.

    Nobody likes solution 1), which I can understand.

    This patch implements solution 2). However lockdep is still not happy with
    configfs_depend_item(). Next patch reworks the locking of
    configfs_depend_item() and finally makes lockdep happy.

    [ Note: This hides a few locking interactions with the VFS from lockdep.
    That was my big concern, because we like lockdep's protection. However,
    the current state always dumps a spurious warning. The locking is
    correct, so I tell people to ignore the warning and that we'll keep
    our eyes on the locking to make sure it stays correct. With this patch,
    we eliminate the warning. We do lose some of the lockdep protections,
    but this only means that we still have to keep our eyes on the locking.
    We're going to do that anyway. -- Joel ]

    Signed-off-by: Louis Rilling
    Signed-off-by: Joel Becker

    Louis Rilling
     

22 Apr, 2009

1 commit

  • I observed the following build warning with fs/configfs/symlink.c:

    fs/configfs/symlink.c: In function 'configfs_symlink':
    fs/configfs/symlink.c:138: warning: 'target_item' may be used uninitialized in this function

    Here is a small fix for this.

    Cc: Patrick Mochel
    Cc: Balbir Singh
    Cc: Sachin P Sant
    Signed-Off-By: Subrata Modak
    Signed-off-by: Joel Becker

    Subrata Modak
     

28 Mar, 2009

1 commit


05 Feb, 2009

1 commit


03 Feb, 2009

1 commit

  • When attaching default groups (subdirs) of a new group (in mkdir() or
    in configfs_register()), configfs recursively takes inode's mutexes
    along the path from the parent of the new group to the default
    subdirs. This is needed to ensure that the VFS will not race with
    operations on these sub-dirs. This is safe for the following reasons:

    - the VFS allows one to lock first an inode and second one of its
    children (The lock subclasses for this pattern are respectively
    I_MUTEX_PARENT and I_MUTEX_CHILD);
    - from this rule any inode path can be recursively locked in
    descending order as long as it stays under a single mountpoint and
    does not follow symlinks.

    Unfortunately lockdep does not know (yet?) how to handle such
    recursion.

    I've tried to use Peter Zijlstra's lock_set_subclass() helper to
    upgrade i_mutexes from I_MUTEX_CHILD to I_MUTEX_PARENT when we know
    that we might recursively lock some of their descendant, but this
    usage does not seem to fit the purpose of lock_set_subclass() because
    it leads to several i_mutex locked with subclass I_MUTEX_PARENT by
    the same task.

    >From inside configfs it is not possible to serialize those recursive
    locking with a top-level one, because mkdir() and rmdir() are already
    called with inodes locked by the VFS. So using some
    mutex_lock_nest_lock() is not an option.

    I am proposing two solutions:
    1) one that wraps recursive mutex_lock()s with
    lockdep_off()/lockdep_on().
    2) (as suggested earlier by Peter Zijlstra) one that puts the
    i_mutexes recursively locked in different classes based on their
    depth from the top-level config_group created. This
    induces an arbitrary limit (MAX_LOCK_DEPTH - 2 == 46) on the
    nesting of configfs default groups whenever lockdep is activated
    but this limit looks reasonably high. Unfortunately, this alos
    isolates VFS operations on configfs default groups from the others
    and thus lowers the chances to detect locking issues.

    This patch implements solution 1).

    Solution 2) looks better from lockdep's point of view, but fails with
    configfs_depend_item(). This needs to rework the locking
    scheme of configfs_depend_item() by removing the variable lock recursion
    depth, and I think that it's doable thanks to the configfs_dirent_lock.
    For now, let's stick to solution 1).

    Signed-off-by: Louis Rilling
    Acked-by: Joel Becker
    Signed-off-by: Mark Fasheh

    Joel Becker
     

22 Jan, 2009

1 commit


06 Jan, 2009

1 commit


23 Oct, 2008

1 commit


23 Aug, 2008

1 commit


01 Aug, 2008

1 commit

  • configfs_mkdir() creates a new item by calling its parent's
    ->make_item/group() functions. Once that object is created,
    configfs_mkdir() calls try_module_get() on the new item's module. If it
    succeeds, the module owning the new item cannot be unloaded, and
    configfs is safe to reference the item.

    If the item and the subsystem it belongs to are part of the same module,
    the subsystem is also pinned. This is the common case.

    However, if the subsystem is made up of multiple modules, this may not
    pin the subsystem. Thus, it would be possible to unload the toplevel
    subsystem module while there is still a child item. Thus, we now
    try_module_get() the subsystem's module. This only really affects
    children of the toplevel subsystem group. Deeper children already have
    their parents pinned.

    Signed-off-by: Joel Becker
    Signed-off-by: Mark Fasheh

    Joel Becker