24 Aug, 2015

2 commits

  • When reading 0 bytes from an empty file on a 9P filesystem, the return
    code of read() was not 0 as expected due to an unitialized err variable.

    Tested with this simple program:

    #include
    #include
    #include
    #include
    #include

    int main(int argc, const char **argv)
    {
    assert(argc == 2);
    char buffer[256];
    int fd = open(argv[1], O_RDONLY|O_NOCTTY);
    assert(fd >= 0);
    assert(read(fd, buffer, 0) == 0);
    return 0;
    }

    Signed-off-by: Vincent Bernat
    Signed-off-by: Eric Van Hensbergen

    Vincent Bernat
     
  • Commit 8a0dc95fd976
    ("9p: transport API reorganization")
    removed Opt_trans in tokens not in enum.

    Signed-off-by: Fabian Frederick
    Signed-off-by: Eric Van Hensbergen

    Fabian Frederick
     

12 Jul, 2015

1 commit


26 Jun, 2015

1 commit

  • Pull cgroup writeback support from Jens Axboe:
    "This is the big pull request for adding cgroup writeback support.

    This code has been in development for a long time, and it has been
    simmering in for-next for a good chunk of this cycle too. This is one
    of those problems that has been talked about for at least half a
    decade, finally there's a solution and code to go with it.

    Also see last weeks writeup on LWN:

    http://lwn.net/Articles/648292/"

    * 'for-4.2/writeback' of git://git.kernel.dk/linux-block: (85 commits)
    writeback, blkio: add documentation for cgroup writeback support
    vfs, writeback: replace FS_CGROUP_WRITEBACK with SB_I_CGROUPWB
    writeback: do foreign inode detection iff cgroup writeback is enabled
    v9fs: fix error handling in v9fs_session_init()
    bdi: fix wrong error return value in cgwb_create()
    buffer: remove unusued 'ret' variable
    writeback: disassociate inodes from dying bdi_writebacks
    writeback: implement foreign cgroup inode bdi_writeback switching
    writeback: add lockdep annotation to inode_to_wb()
    writeback: use unlocked_inode_to_wb transaction in inode_congested()
    writeback: implement unlocked_inode_to_wb transaction and use it for stat updates
    writeback: implement [locked_]inode_to_wb_and_lock_list()
    writeback: implement foreign cgroup inode detection
    writeback: make writeback_control track the inode being written back
    writeback: relocate wb[_try]_get(), wb_put(), inode_{attach|detach}_wb()
    mm: vmscan: disable memcg direct reclaim stalling if cgroup writeback support is in use
    writeback: implement memcg writeback domain based throttling
    writeback: reset wb_domain->dirty_limit[_tstmp] when memcg domain size changes
    writeback: implement memcg wb_domain
    writeback: update wb_over_bg_thresh() to use wb_domain aware operations
    ...

    Linus Torvalds
     

08 Jun, 2015

1 commit

  • On failure, v9fs_session_init() returns with the v9fs_session_info
    struct partially initialized and expects the caller to invoke
    v9fs_session_close() to clean it up; however, it doesn't track whether
    the bdi is initialized or not and curiously invokes bdi_destroy() in
    both vfs_session_init() failure path too.

    A. If v9fs_session_init() fails before the bdi is initialized, the
    follow-up v9fs_session_close() will invoke bdi_destroy() on an
    uninitialized bdi.

    B. If v9fs_session_init() fails after the bdi is initialized,
    bdi_destroy() will be called twice on the same bdi - once in the
    failure path of v9fs_session_init() and then by
    v9fs_session_close().

    A is broken no matter what. B used to be okay because bdi_destroy()
    allowed being invoked multiple times on the same bdi, which BTW was
    broken in its own way - if bdi_destroy() was invoked on an initialiezd
    but !registered bdi, it'd fail to free percpu counters. Since
    f0054bb1e1f3 ("writeback: move backing_dev_info->wb_lock and
    ->worklist into bdi_writeback"), this no longer work - bdi_destroy()
    on an initialized but not registered bdi works correctly but multiple
    invocations of bdi_destroy() is no longer allowed.

    The obvious culprit here is v9fs_session_init()'s odd and broken error
    behavior. It should simply clean up after itself on failures. This
    patch makes the following updates to v9fs_session_init().

    * @rc -> @retval error return propagation removed. It didn't serve
    any purpose. Just use @rc.

    * Move addition to v9fs_sessionlist to the end of the function so that
    incomplete sessions are not put on the list or iterated and error
    path doesn't have to worry about it.

    * Update error handling so that it cleans up after itself.

    Signed-off-by: Tejun Heo
    Reported-by: Sasha Levin
    Signed-off-by: Jens Axboe

    Tejun Heo
     

15 May, 2015

1 commit


11 May, 2015

4 commits

  • its only use is getting passed to nd_jump_link(), which can obtain
    it from current->nameidata

    Signed-off-by: Al Viro

    Al Viro
     
  • a) instead of storing the symlink body (via nd_set_link()) and returning
    an opaque pointer later passed to ->put_link(), ->follow_link() _stores_
    that opaque pointer (into void * passed by address by caller) and returns
    the symlink body. Returning ERR_PTR() on error, NULL on jump (procfs magic
    symlinks) and pointer to symlink body for normal symlinks. Stored pointer
    is ignored in all cases except the last one.

    Storing NULL for opaque pointer (or not storing it at all) means no call
    of ->put_link().

    b) the body used to be passed to ->put_link() implicitly (via nameidata).
    Now only the opaque pointer is. In the cases when we used the symlink body
    to free stuff, ->follow_link() now should store it as opaque pointer in addition
    to returning it.

    Signed-off-by: Al Viro

    Al Viro
     
  • We copy there a kmalloc'ed string and proceed to kfree that string immediately
    after that. Easier to just feed that string to nd_set_link() and _not_
    kfree it until ->put_link() (which becomes kfree_put_link() in that case).

    Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     

27 Apr, 2015

1 commit

  • Pull fourth vfs update from Al Viro:
    "d_inode() annotations from David Howells (sat in for-next since before
    the beginning of merge window) + four assorted fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    RCU pathwalk breakage when running into a symlink overmounting something
    fix I_DIO_WAKEUP definition
    direct-io: only inc/dec inode->i_dio_count for file systems
    fs/9p: fix readdir()
    VFS: assorted d_backing_inode() annotations
    VFS: fs/inode.c helpers: d_inode() annotations
    VFS: fs/cachefiles: d_backing_inode() annotations
    VFS: fs library helpers: d_inode() annotations
    VFS: assorted weird filesystems: d_inode() annotations
    VFS: normal filesystems (and lustre): d_inode() annotations
    VFS: security/: d_inode() annotations
    VFS: security/: d_backing_inode() annotations
    VFS: net/: d_inode() annotations
    VFS: net/unix: d_backing_inode() annotations
    VFS: kernel/: d_inode() annotations
    VFS: audit: d_backing_inode() annotations
    VFS: Fix up some ->d_inode accesses in the chelsio driver
    VFS: Cachefiles should perform fs modifications on the top layer only
    VFS: AF_UNIX sockets should call mknod on the top layer only

    Linus Torvalds
     

25 Apr, 2015

1 commit

  • Al Viro's IOV changes broke 9p readdir() because the new code
    didn't abort the read when it returned nothing. The original
    code checked if the combined error/length was
    Fixes: e1200fe68f20 ("9p: switch p9_client_read() to passing struct iov_iter *")
    Signed-off-by: Johannes Berg
    Signed-off-by: Al Viro

    Johannes Berg
     

19 Apr, 2015

1 commit

  • Pull 9pfs updates from Eric Van Hensbergen:
    "Some accumulated cleanup patches for kerneldoc and unused variables as
    well as some lock bug fixes and adding privateport option for RDMA"

    * tag 'for-linus-4.1-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
    net/9p: add a privport option for RDMA transport.
    fs/9p: Initialize status in v9fs_file_do_lock.
    net/9p: Initialize opts->privport as it should be.
    net/9p: use memcpy() instead of snprintf() in p9_mount_tag_show()
    9p: use unsigned integers for nwqid/count
    9p: do not crash on unknown lock status code
    9p: fix error handling in v9fs_file_do_lock
    9p: remove unused variable in p9_fd_create()
    9p: kerneldoc warning fixes

    Linus Torvalds
     

16 Apr, 2015

1 commit


12 Apr, 2015

14 commits


26 Mar, 2015

1 commit


22 Mar, 2015

1 commit

  • If p9_client_lock_dotl returns an error, status is possibly never filled
    but will be used in the following switch.
    Initializing it to P9_LOCK_ERROR makes sur we will return an error and
    cleanup (and not hit the default case).

    Signed-off-by: Dominique Martinet
    Signed-off-by: Eric Van Hensbergen

    Dominique Martinet
     

20 Mar, 2015

3 commits

  • Current 9p implementation will crash whole system if sees unknown lock
    status code. It's trivial target for DOS: 9p server can produce such
    code easily.

    Let's fallback more gracefully: warning in dmesg + -ENOLCK.

    Signed-off-by: Kirill A. Shutemov
    Signed-off-by: Dominique Martinet
    Signed-off-by: Eric Van Hensbergen

    Kirill A. Shutemov
     
  • p9_client_lock_dotl() doesn't set status if p9_client_rpc() fails.
    It can lead to 'default:' case in switch below and kernel crashes.

    Let's bypass the switch if p9_client_lock_dotl() fails.

    Signed-off-by: Kirill A. Shutemov
    Signed-off-by: Dominique Martinet
    Signed-off-by: Eric Van Hensbergen

    Kirill A. Shutemov
     
  • options argument was removed from v9fs_session_info in commit 4b53e4b50077
    ("9p: remove unnecessary v9fses->options which duplicates the mount string")

    iov and nr_segs were removed from v9fs_direct_IO
    in commit d8d3d94b80aa
    ("pass iov_iter to ->direct_IO()")

    Cc: Eric Van Hensbergen
    Cc: Ron Minnich
    Cc: Latchesar Ionkov
    Cc: v9fs-developer@lists.sourceforge.net
    Signed-off-by: Fabian Frederick
    Signed-off-by: Dominique Martinet
    Signed-off-by: Eric Van Hensbergen

    Fabian Frederick
     

23 Feb, 2015

1 commit

  • Convert the following where appropriate:

    (1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).

    (2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).

    (3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry). This is actually more
    complicated than it appears as some calls should be converted to
    d_can_lookup() instead. The difference is whether the directory in
    question is a real dir with a ->lookup op or whether it's a fake dir with
    a ->d_automount op.

    In some circumstances, we can subsume checks for dentry->d_inode not being
    NULL into this, provided we the code isn't in a filesystem that expects
    d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
    use d_inode() rather than d_backing_inode() to get the inode pointer).

    Note that the dentry type field may be set to something other than
    DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
    manages the fall-through from a negative dentry to a lower layer. In such a
    case, the dentry type of the negative union dentry is set to the same as the
    type of the lower dentry.

    However, if you know d_inode is not NULL at the call site, then you can use
    the d_is_xxx() functions even in a filesystem.

    There is one further complication: a 0,0 chardev dentry may be labelled
    DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE. Strictly, this was
    intended for special directory entry types that don't have attached inodes.

    The following perl+coccinelle script was used:

    use strict;

    my @callers;
    open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
    die "Can't grep for S_ISDIR and co. callers";
    @callers = ;
    close($fd);
    unless (@callers) {
    print "No matches\n";
    exit(0);
    }

    my @cocci = (
    '@@',
    'expression E;',
    '@@',
    '',
    '- S_ISLNK(E->d_inode->i_mode)',
    '+ d_is_symlink(E)',
    '',
    '@@',
    'expression E;',
    '@@',
    '',
    '- S_ISDIR(E->d_inode->i_mode)',
    '+ d_is_dir(E)',
    '',
    '@@',
    'expression E;',
    '@@',
    '',
    '- S_ISREG(E->d_inode->i_mode)',
    '+ d_is_reg(E)' );

    my $coccifile = "tmp.sp.cocci";
    open($fd, ">$coccifile") || die $coccifile;
    print($fd "$_\n") || die $coccifile foreach (@cocci);
    close($fd);

    foreach my $file (@callers) {
    chomp $file;
    print "Processing ", $file, "\n";
    system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
    die "spatch failed";
    }

    [AV: overlayfs parts skipped]

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     

13 Feb, 2015

1 commit

  • Pull backing device changes from Jens Axboe:
    "This contains a cleanup of how the backing device is handled, in
    preparation for a rework of the life time rules. In this part, the
    most important change is to split the unrelated nommu mmap flags from
    it, but also removing a backing_dev_info pointer from the
    address_space (and inode), and a cleanup of other various minor bits.

    Christoph did all the work here, I just fixed an oops with pages that
    have a swap backing. Arnd fixed a missing export, and Oleg killed the
    lustre backing_dev_info from staging. Last patch was from Al,
    unexporting parts that are now no longer needed outside"

    * 'for-3.20/bdi' of git://git.kernel.dk/linux-block:
    Make super_blocks and sb_lock static
    mtd: export new mtd_mmap_capabilities
    fs: make inode_to_bdi() handle NULL inode
    staging/lustre/llite: get rid of backing_dev_info
    fs: remove default_backing_dev_info
    fs: don't reassign dirty inodes to default_backing_dev_info
    nfs: don't call bdi_unregister
    ceph: remove call to bdi_unregister
    fs: remove mapping->backing_dev_info
    fs: export inode_to_bdi and use it in favor of mapping->backing_dev_info
    nilfs2: set up s_bdi like the generic mount_bdev code
    block_dev: get bdev inode bdi directly from the block device
    block_dev: only write bdev inode on close
    fs: introduce f_op->mmap_capabilities for nommu mmap support
    fs: kill BDI_CAP_SWAP_BACKED
    fs: deduplicate noop_backing_dev_info

    Linus Torvalds
     

11 Feb, 2015

1 commit


21 Jan, 2015

1 commit

  • Since "BDI: Provide backing device capability information [try #3]" the
    backing_dev_info structure also provides flags for the kind of mmap
    operation available in a nommu environment, which is entirely unrelated
    to it's original purpose.

    Introduce a new nommu-only file operation to provide this information to
    the nommu mmap code instead. Splitting this from the backing_dev_info
    structure allows to remove lots of backing_dev_info instance that aren't
    otherwise needed, and entirely gets rid of the concept of providing a
    backing_dev_info for a character device. It also removes the need for
    the mtd_inodefs filesystem.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Tejun Heo
    Acked-by: Brian Norris
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

20 Nov, 2014

2 commits


09 Oct, 2014

1 commit