23 Jan, 2016

1 commit

  • parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
    inode_foo(inode) being mutex_foo(&inode->i_mutex).

    Please, use those for access to ->i_mutex; over the coming cycle
    ->i_mutex will become rwsem, with ->lookup() done with it held
    only shared.

    Signed-off-by: Al Viro

    Al Viro
     

16 Apr, 2015

1 commit


20 Dec, 2013

1 commit


09 Nov, 2013

2 commits

  • NFSv4 uses leases to guarantee that clients can cache metadata as well
    as data.

    Cc: Mikulas Patocka
    Cc: David Howells
    Cc: Tyler Hicks
    Cc: Dustin Kirkland
    Acked-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Al Viro

    J. Bruce Fields
     
  • We need to break delegations on any operation that changes the set of
    links pointing to an inode. Start with unlink.

    Such operations also hold the i_mutex on a parent directory. Breaking a
    delegation may require waiting for a timeout (by default 90 seconds) in
    the case of a unresponsive NFS client. To avoid blocking all directory
    operations, we therefore drop locks before waiting for the delegation.
    The logic then looks like:

    acquire locks
    ...
    test for delegation; if found:
    take reference on inode
    release locks
    wait for delegation break
    drop reference on inode
    retry

    It is possible this could never terminate. (Even if we take precautions
    to prevent another delegation being acquired on the same inode, we could
    get a different inode on each retry.) But this seems very unlikely.

    The initial test for a delegation happens after the lock on the target
    inode is acquired, but the directory inode may have been acquired
    further up the call stack. We therefore add a "struct inode **"
    argument to any intervening functions, which we use to pass the inode
    back up to the caller in the case it needs a delegation synchronously
    broken.

    Cc: David Howells
    Cc: Tyler Hicks
    Cc: Dustin Kirkland
    Acked-by: Jeff Layton
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Al Viro

    J. Bruce Fields
     

12 Apr, 2013

1 commit


11 Apr, 2013

2 commits

  • If CONFIG_UIDGID_STRICT_TYPE_CHECKS is enalbed, the below compile
    failure will be triggered:

    drivers/base/devtmpfs.c: In function 'handle_create':
    drivers/base/devtmpfs.c:214:19: error: incompatible types when assigning to type 'kuid_t' from type 'uid_t'
    drivers/base/devtmpfs.c:215:19: error: incompatible types when assigning to type 'kgid_t' from type 'gid_t'
    make[2]: *** [drivers/base/devtmpfs.o] Error 1

    This patch fixes the compile failure.

    Signed-off-by: Ming Lei
    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • This fixes a sparse warning, and is a good idea given that the
    devtmpfs_init() prototype is in this file.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

08 Apr, 2013

1 commit

  • Some drivers want to tell userspace what uid and gid should be used for
    their device nodes, so allow that information to percolate through the
    driver core to userspace in order to make this happen. This means that
    some systems (i.e. Android and friends) will not need to even run a
    udev-like daemon for their device node manager and can just rely in
    devtmpfs fully, reducing their footprint even more.

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

26 Feb, 2013

1 commit


21 Dec, 2012

1 commit


21 Sep, 2012

1 commit


30 Jul, 2012

1 commit


14 Jul, 2012

1 commit

  • all callers want the same thing, actually - a kinda-sorta analog of
    kern_path_create(). I.e. they want parent vfsmount/dentry (with
    ->i_mutex held, to make sure the child dentry is still their child)
    + the child dentry.

    Signed-off-by Al Viro

    Al Viro
     

19 Apr, 2012

1 commit


09 Jan, 2012

1 commit

  • * 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (165 commits)
    reiserfs: Properly display mount options in /proc/mounts
    vfs: prevent remount read-only if pending removes
    vfs: count unlinked inodes
    vfs: protect remounting superblock read-only
    vfs: keep list of mounts for each superblock
    vfs: switch ->show_options() to struct dentry *
    vfs: switch ->show_path() to struct dentry *
    vfs: switch ->show_devname() to struct dentry *
    vfs: switch ->show_stats to struct dentry *
    switch security_path_chmod() to struct path *
    vfs: prefer ->dentry->d_sb to ->mnt->mnt_sb
    vfs: trim includes a bit
    switch mnt_namespace ->root to struct mount
    vfs: take /proc/*/mounts and friends to fs/proc_namespace.c
    vfs: opencode mntget() mnt_set_mountpoint()
    vfs: spread struct mount - remaining argument of next_mnt()
    vfs: move fsnotify junk to struct mount
    vfs: move mnt_devname
    vfs: move mnt_list to struct mount
    vfs: switch pnode.h macros to struct mount *
    ...

    Linus Torvalds
     

04 Jan, 2012

2 commits


16 Nov, 2011

1 commit

  • - Set the state to TASK_INTERRUPTIBLE using __set_current_state()
    instead of set_current_state() as the spin_unlock is an implicit memory
    barrier.

    - After return from schedule(), there is no need to set the current
    state to TASK_RUNNING - a call to schedule() always returns in
    TASK_RUNNING state.

    Signed-off-by: Kautuk Consul
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Kautuk Consul
     

09 Aug, 2011

1 commit

  • This fixes the following section mismatch issue:

    WARNING: vmlinux.o(.text+0x1192bf): Section mismatch in reference from the function devtmpfsd() to the variable .init.data:setup_done
    The function devtmpfsd() references the variable __initdata setup_done.
    This is often because devtmpfsd lacks a __initdata annotation or the annotation of setup_done is wrong.

    WARNING: vmlinux.o(.text+0x119342): Section mismatch in reference from the function devtmpfsd() to the variable .init.data:setup_done
    The function devtmpfsd() references the variable __initdata setup_done.
    This is often because devtmpfsd lacks a __initdata annotation or the annotation of setup_done is wrong.

    Signed-off-by: Arnaud Lacombe
    Signed-off-by: Greg Kroah-Hartman

    Arnaud Lacombe
     

28 Jul, 2011

1 commit

  • create_path() on something without a single / in it will return err
    without initializing it. It actually can't happen (we call that thing
    only if create on the same path returns -ENOENT, which won't happen
    happen for single-component path), but in this case initializing err
    to 0 is more than making compiler to STFU - would be the right thing
    to return on such paths; the function creates a parent directory of
    given pathname and in that case it has no work to do...

    Signed-off-by: Al Viro

    Al Viro
     

26 Jul, 2011

1 commit

  • After we's done complete(&req->done), there's nothing to prevent the
    scope containing *req from being gone and *req overwritten by any
    kind of junk. So we must read req->next before that...

    Signed-off-by: Al Viro

    Al Viro
     

20 Jul, 2011

3 commits


29 Oct, 2010

1 commit


22 May, 2010

1 commit


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
     

08 Mar, 2010

1 commit

  • Before unlinking the inode, reset the current permissions of possible
    references like hardlinks, so granted permissions can not be retained
    across the device lifetime by creating hardlinks, in the unusual case
    that there is a user-writable directory on the same filesystem.

    Signed-off-by: Kay Sievers
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

21 Jan, 2010

1 commit

  • On Mon, Jan 18, 2010 at 05:26:20PM +0530, Sachin Sant wrote:
    > Hello Heiko,
    >
    > Today while trying to boot next-20100118 i came across
    > the following Oops :
    >
    > Brought up 4 CPUs
    > Unable to handle kernel pointer dereference at virtual kernel address 0000000000
    > 543000
    > Oops: 0004 #1 SMP
    > Modules linked in:
    > CPU: 0 Not tainted 2.6.33-rc4-autotest-next-20100118-5-default #1
    > Process swapper (pid: 1, task: 00000000fd792038, ksp: 00000000fd797a30)
    > Krnl PSW : 0704200180000000 00000000001eb0b8 (shmem_parse_options+0xc0/0x328)
    > R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:2 PM:0 EA:3
    > Krnl GPRS: 000000000054388a 000000000000003d 0000000000543836 000000000000003d
    > 0000000000000000 0000000000483f28 0000000000536112 00000000fd797d00
    > 00000000fd4ba100 0000000000000100 0000000000483978 0000000000543832
    > 0000000000000000 0000000000465958 00000000001eb0b0 00000000fd797c58
    > Krnl Code: 00000000001eb0aa: c0e5000994f1 brasl %r14,31da8c
    > 00000000001eb0b0: b9020022 ltgr %r2,%r2
    > 00000000001eb0b4: a784010b brc 8,1eb2ca
    > >00000000001eb0b8: 92002000 mvi 0(%r2),0
    > 00000000001eb0bc: a7080000 lhi %r0,0
    > 00000000001eb0c0: 41902001 la %r9,1(%r2)
    > 00000000001eb0c4: b9040016 lgr %r1,%r6
    > 00000000001eb0c8: b904002b lgr %r2,%r11
    > Call Trace:
    > ( 0xfd797c50)
    > shmem_fill_super+0x13a/0x25c
    > get_sb_single+0xbe/0xdc
    > dev_get_sb+0x2c/0x38
    > devtmpfs_init+0x46/0xc0
    > driver_init+0x22/0x60
    > kernel_init+0x24e/0x3d0
    > kernel_thread_starter+0x6/0xc
    > kernel_thread_starter+0x0/0xc
    >
    > I never tried to boot a kernel with DEVTMPFS enabled on a s390 box.
    > So am wondering if this is supported or not ? If you think this
    > is supported i will send a mail to community on this.

    There is nothing arch specific to devtmpfs. This part crashes because the
    kernel tries to modify the data read-only section which is write protected
    on s390.

    Signed-off-by: Heiko Carstens
    Acked-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Heiko Carstens
     

24 Dec, 2009

2 commits

  • Reported-by: Kirill A. Shutemov
    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • devtmpfs has a rw_lock dirlock which serializes delete_path and
    create_path.

    This code was obviously never tested with the usual set of debugging
    facilities enabled. In the dirlock held sections the code calls:

    - vfs functions which take mutexes
    - kmalloc(, GFP_KERNEL)

    In both code pathes the might sleep warning triggers and spams dmesg.

    Convert the rw_lock to a mutex. There is no reason why this needs to
    be a rwlock.

    Signed-off-by: Thomas Gleixner
    Cc: Kay Sievers
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

12 Dec, 2009

5 commits


20 Sep, 2009

1 commit

  • This allows subsytems to provide devtmpfs with non-default permissions
    for the device node. Instead of the default mode of 0600, null, zero,
    random, urandom, full, tty, ptmx now have a mode of 0666, which allows
    non-privileged processes to access standard device nodes in case no
    other userspace process applies the expected permissions.

    This also fixes a wrong assignment in pktcdvd and a checkpatch.pl complain.

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

16 Sep, 2009

1 commit

  • Devtmpfs lets the kernel create a tmpfs instance called devtmpfs
    very early at kernel initialization, before any driver-core device
    is registered. Every device with a major/minor will provide a
    device node in devtmpfs.

    Devtmpfs can be changed and altered by userspace at any time,
    and in any way needed - just like today's udev-mounted tmpfs.
    Unmodified udev versions will run just fine on top of it, and will
    recognize an already existing kernel-created device node and use it.
    The default node permissions are root:root 0600. Proper permissions
    and user/group ownership, meaningful symlinks, all other policy still
    needs to be applied by userspace.

    If a node is created by devtmps, devtmpfs will remove the device node
    when the device goes away. If the device node was created by
    userspace, or the devtmpfs created node was replaced by userspace, it
    will no longer be removed by devtmpfs.

    If it is requested to auto-mount it, it makes init=/bin/sh work
    without any further userspace support. /dev will be fully populated
    and dynamic, and always reflect the current device state of the kernel.
    With the commonly used dynamic device numbers, it solves the problem
    where static devices nodes may point to the wrong devices.

    It is intended to make the initial bootup logic simpler and more robust,
    by de-coupling the creation of the inital environment, to reliably run
    userspace processes, from a complex userspace bootstrap logic to provide
    a working /dev.

    Signed-off-by: Kay Sievers
    Signed-off-by: Jan Blunck
    Tested-By: Harald Hoyer
    Tested-By: Scott James Remnant
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers