29 Jul, 2016

2 commits

  • Pull trivial tree updates from Jiri Kosina.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
    fat: fix error message for bogus number of directory entries
    fat: fix typo s/supeblock/superblock/
    ASoC: max9877: Remove unused function declaration
    dw2102: don't output spurious blank lines to the kernel log
    init: fix Kconfig text
    ARM: io: fix comment grammar
    ocfs: fix ocfs2_xattr_user_get() argument name
    scsi/qla2xxx: Remove erroneous unused macro qla82xx_get_temp_val1()

    Linus Torvalds
     
  • This changes the vfs dentry hashing to mix in the parent pointer at the
    _beginning_ of the hash, rather than at the end.

    That actually improves both the hash and the code generation, because we
    can move more of the computation to the "static" part of the dcache
    setup, and do less at lookup runtime.

    It turns out that a lot of other hash users also really wanted to mix in
    a base pointer as a 'salt' for the hash, and so the slightly extended
    interface ends up working well for other cases too.

    Users that want a string hash that is purely about the string pass in a
    'salt' pointer of NULL.

    * merge branch 'salted-string-hash':
    fs/dcache.c: Save one 32-bit multiply in dcache lookup
    vfs: make the string hashes salt the hash

    Linus Torvalds
     

24 Jun, 2016

1 commit

  • "bogus directory-entries per block" was reported for what was instead
    bogus number of directory entries. The message also mismatched the
    argument passed to printk(), which was sbi->dir_entries.

    Fix this by replacing the message with "bogus number of directory
    entries". printk() argument was kept unchanged.

    Signed-off-by: Zheng Lv
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Jiri Kosina

    Zheng Lv
     

21 Jun, 2016

1 commit


11 Jun, 2016

1 commit

  • We always mixed in the parent pointer into the dentry name hash, but we
    did it late at lookup time. It turns out that we can simplify that
    lookup-time action by salting the hash with the parent pointer early
    instead of late.

    A few other users of our string hashes also wanted to mix in their own
    pointers into the hash, and those are updated to use the same mechanism.

    Hash users that don't have any particular initial salt can just use the
    NULL pointer as a no-salt.

    Cc: Vegard Nossum
    Cc: George Spelvin
    Cc: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

08 Jun, 2016

1 commit


18 May, 2016

1 commit

  • Pull vfs cleanups from Al Viro:
    "More cleanups from Christoph"

    * 'work.preadv2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    nfsd: use RWF_SYNC
    fs: add RWF_DSYNC aand RWF_SYNC
    ceph: use generic_write_sync
    fs: simplify the generic_write_sync prototype
    fs: add IOCB_SYNC and IOCB_DSYNC
    direct-io: remove the offset argument to dio_complete
    direct-io: eliminate the offset argument to ->direct_IO
    xfs: eliminate the pos variable in xfs_file_dio_aio_write
    filemap: remove the pos argument to generic_file_direct_write
    filemap: remove pos variables in generic_file_read_iter

    Linus Torvalds
     

09 May, 2016

1 commit


02 May, 2016

1 commit


23 Mar, 2016

1 commit

  • FAT has long supported its own default file name encoding config
    setting, separate from CONFIG_NLS_DEFAULT.

    However, if UTF-8 encoded file names are desired FAT character set
    should not be set to utf8 since this would make file names case
    sensitive even if case insensitive matching is requested. Instead,
    "utf8" mount options should be provided to enable UTF-8 file names in
    FAT file system.

    Unfortunately, there was no possibility to set the default value of this
    option so on UTF-8 system "utf8" mount option had to be added manually
    to most FAT mounts.

    This patch adds config option to set such default value.

    Signed-off-by: Maciej S. Szmigiero
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Maciej S. Szmigiero
     

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
     

21 Jan, 2016

6 commits

  • The fatent_operations structures are never modified, so declare them as
    const.

    Done with the help of Coccinelle.

    Signed-off-by: Julia Lawall
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Julia Lawall
     
  • Make the fibmap call return the proper physical block number for any
    offset request in the fallocated range.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • Skip new cluster allocation after checking i_blocks limit in _fat_get_block,
    because the blocks are already allocated in fallocated region.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • Implement preallocation via the fallocate syscall on VFAT partitions.
    This patch is based on an earlier patch of the same name which had some
    issues detailed below and did not get accepted. Refer
    https://lkml.org/lkml/2007/12/22/130.

    a) The preallocated space was not persistent when the
    FALLOC_FL_KEEP_SIZE flag was set. It will deallocate cluster at evict
    time.

    b) There was no need to zero out the clusters when the flag was set
    Instead of doing an expanding truncate, just allocate clusters and add
    them to the fat chain. This reduces preallocation time.

    Compatibility with windows:

    There are no issues when FALLOC_FL_KEEP_SIZE is not set because it just
    does an expanding truncate. Thus reading from the preallocated area on
    windows returns null until data is written to it.

    When a file with preallocated area using the FALLOC_FL_KEEP_SIZE was
    written to on windows, the windows driver freed-up the preallocated
    clusters and allocated new clusters for the new data. The freed up
    clusters gets reflected in the free space available for the partition
    which can be seen from the Volume properties.

    The windows chkdsk tool also does not report any errors on a disk
    containing files with preallocated space.

    And there is also no issue using linux fat fsck. because discard
    preallocated clusters at repair time.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Cc: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     
  • This detects simple corruption cases of directory, and tries to avoid
    further damage to user data.

    And performance impact of this validation should be very low, or not
    measurable.

    Signed-off-by: OGAWA Hirofumi
    Reported-by: Vegard Nossum
    Tested-by: Vegard Nossum
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • Currently we limit values of time_offset mount option to be between -12
    and 12 hours. However e.g. zone GMT+12 can have a DST correction on top
    which makes the total time difference 13 hours. Update the checks in
    mount option parsing to allow offset of upto 24 hours to allow for unusual
    cases.

    Signed-off-by: Jan Kara
    Reported-by: Volker Kuhlmann
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Kara
     

15 Jan, 2016

1 commit

  • Mark those kmem allocations that are known to be easily triggered from
    userspace as __GFP_ACCOUNT/SLAB_ACCOUNT, which makes them accounted to
    memcg. For the list, see below:

    - threadinfo
    - task_struct
    - task_delay_info
    - pid
    - cred
    - mm_struct
    - vm_area_struct and vm_region (nommu)
    - anon_vma and anon_vma_chain
    - signal_struct
    - sighand_struct
    - fs_struct
    - files_struct
    - fdtable and fdtable->full_fds_bits
    - dentry and external_name
    - inode for all filesystems. This is the most tedious part, because
    most filesystems overwrite the alloc_inode method.

    The list is far from complete, so feel free to add more objects.
    Nevertheless, it should be close to "account everything" approach and
    keep most workloads within bounds. Malevolent users will be able to
    breach the limit, but this was possible even with the former "account
    everything" approach (simply because it did not account everything in
    fact).

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Vladimir Davydov
    Acked-by: Johannes Weiner
    Acked-by: Michal Hocko
    Cc: Tejun Heo
    Cc: Greg Thelen
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vladimir Davydov
     

21 Nov, 2015

1 commit

  • For the root directory, . and .. are faked (using dir_emit_dots()) and
    ctx->pos is reset from 2 to 0.

    A corrupted root directory could cause fat_get_entry() to fail, but
    ->iterate() (fat_readdir()) reports progress to the VFS (with ctx->pos
    rewound to 0), so any following calls to ->iterate() continue to return
    the same entries again and again.

    The result is that userspace will never see the end of the directory,
    causing e.g. 'ls' to hang in a getdents() loop.

    [hirofumi@mail.parknet.co.jp: cleanup and make sure to correct fake_offset]
    Reported-by: Vegard Nossum
    Tested-by: Vegard Nossum
    Signed-off-by: Richard Weinberger
    Signed-off-by: OGAWA Hirofumi
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

02 Jun, 2015

1 commit

  • With the planned cgroup writeback support, backing-dev related
    declarations will be more widely used across block and cgroup;
    unfortunately, including backing-dev.h from include/linux/blkdev.h
    makes cyclic include dependency quite likely.

    This patch separates out backing-dev-defs.h which only has the
    essential definitions and updates blkdev.h to include it. c files
    which need access to more backing-dev details now include
    backing-dev.h directly. This takes backing-dev.h off the common
    include dependency chain making it a lot easier to use it across block
    and cgroup.

    v2: fs/fat build failure fixed.

    Signed-off-by: Tejun Heo
    Reviewed-by: Jan Kara
    Cc: Jens Axboe
    Signed-off-by: Jens Axboe

    Tejun Heo
     

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
     

17 Apr, 2015

4 commits

  • Merge third patchbomb from Andrew Morton:

    - various misc things

    - a couple of lib/ optimisations

    - provide DIV_ROUND_CLOSEST_ULL()

    - checkpatch updates

    - rtc tree

    - befs, nilfs2, hfs, hfsplus, fatfs, adfs, affs, bfs

    - ptrace fixes

    - fork() fixes

    - seccomp cleanups

    - more mmap_sem hold time reductions from Davidlohr

    * emailed patches from Andrew Morton : (138 commits)
    proc: show locks in /proc/pid/fdinfo/X
    docs: add missing and new /proc/PID/status file entries, fix typos
    drivers/rtc/rtc-at91rm9200.c: make IO endian agnostic
    Documentation/spi/spidev_test.c: fix warning
    drivers/rtc/rtc-s5m.c: allow usage on device type different than main MFD type
    .gitignore: ignore *.tar
    MAINTAINERS: add Mediatek SoC mailing list
    tomoyo: reduce mmap_sem hold for mm->exe_file
    powerpc/oprofile: reduce mmap_sem hold for exe_file
    oprofile: reduce mmap_sem hold for mm->exe_file
    mips: ip32: add platform data hooks to use DS1685 driver
    lib/Kconfig: fix up HAVE_ARCH_BITREVERSE help text
    x86: switch to using asm-generic for seccomp.h
    sparc: switch to using asm-generic for seccomp.h
    powerpc: switch to using asm-generic for seccomp.h
    parisc: switch to using asm-generic for seccomp.h
    mips: switch to using asm-generic for seccomp.h
    microblaze: use asm-generic for seccomp.h
    arm: use asm-generic for seccomp.h
    seccomp: allow COMPAT sigreturn overrides
    ...

    Linus Torvalds
     
  • Signed-off-by: Alexander Kuleshov
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Kuleshov
     
  • 'fat.h' includes which includes which
    includes all the header files required for all *.c files fat filesystem.

    [akpm@linux-foundation.org: fs/fat/iode.c needs seq_file.h]
    [sfr@canb.auug.org.au: put one actually necessary include file back]
    Signed-off-by: Alexander Kuleshov
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Kuleshov
     
  • '*sb' never used, so let's remote it and pass inode->i_sb directly to the
    MSDOS_SB.

    Signed-off-by: Alexander Kuleshov
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Kuleshov
     

16 Apr, 2015

1 commit


12 Apr, 2015

4 commits


26 Mar, 2015

1 commit


18 Feb, 2015

1 commit


14 Dec, 2014

1 commit

  • When running FSX with direct I/O mode, fsx resulted in DATA past EOF issues.

    fsx ./file2 -Z -r 4096 -w 4096
    ...
    ..
    truncating to largest ever: 0x907c
    fallocating to largest ever: 0x11137
    truncating to largest ever: 0x2c6fe
    truncating to largest ever: 0x2cfdf
    fallocating to largest ever: 0x40000
    Mapped Read: non-zero data past EOF (0x18628) page offset 0x629 is 0x2a4e
    ...
    ..

    The reason being, it is doing a truncate down, but the zeroing does not
    happen on the last block boundary when offset is not aligned. Even though
    it calls truncate_setsize()->truncate_inode_pages()->
    truncate_inode_pages_range() and considers the partial zeroout but it
    retrieves the page using find_lock_page() - which only looks the page in
    the cache. So, zeroing out does not happen in case of direct IO.

    Make a truncate page based around block_truncate_page for FAT filesystem
    and invoke that helper to zerout in case the offset is not aligned with
    the blocksize.

    Signed-off-by: Namjae Jeon
    Signed-off-by: Amit Sahrawat
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namjae Jeon
     

11 Dec, 2014

1 commit

  • Pull VFS changes from Al Viro:
    "First pile out of several (there _definitely_ will be more). Stuff in
    this one:

    - unification of d_splice_alias()/d_materialize_unique()

    - iov_iter rewrite

    - killing a bunch of ->f_path.dentry users (and f_dentry macro).

    Getting that completed will make life much simpler for
    unionmount/overlayfs, since then we'll be able to limit the places
    sensitive to file _dentry_ to reasonably few. Which allows to have
    file_inode(file) pointing to inode in a covered layer, with dentry
    pointing to (negative) dentry in union one.

    Still not complete, but much closer now.

    - crapectomy in lustre (dead code removal, mostly)

    - "let's make seq_printf return nothing" preparations

    - assorted cleanups and fixes

    There _definitely_ will be more piles"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits)
    copy_from_iter_nocache()
    new helper: iov_iter_kvec()
    csum_and_copy_..._iter()
    iov_iter.c: handle ITER_KVEC directly
    iov_iter.c: convert copy_to_iter() to iterate_and_advance
    iov_iter.c: convert copy_from_iter() to iterate_and_advance
    iov_iter.c: get rid of bvec_copy_page_{to,from}_iter()
    iov_iter.c: convert iov_iter_zero() to iterate_and_advance
    iov_iter.c: convert iov_iter_get_pages_alloc() to iterate_all_kinds
    iov_iter.c: convert iov_iter_get_pages() to iterate_all_kinds
    iov_iter.c: convert iov_iter_npages() to iterate_all_kinds
    iov_iter.c: iterate_and_advance
    iov_iter.c: macros for iterating over iov_iter
    kill f_dentry macro
    dcache: fix kmemcheck warning in switch_names
    new helper: audit_file()
    nfsd_vfs_write(): use file_inode()
    ncpfs: use file_inode()
    kill f_dentry uses
    lockd: get rid of ->f_path.dentry->d_sb
    ...

    Linus Torvalds
     

04 Dec, 2014

1 commit

  • a) don't bother with ->d_time for positives - we only check it for
    negatives anyway.

    b) make sure to set it at unlink and rmdir time - at *that* point
    soon-to-be negative dentry matches then-current directory contents

    c) don't go into renaming of old alias in vfat_lookup() unless it
    has the same parent (which it will, unless we are seeing corrupted
    image)

    [hirofumi@mail.parknet.co.jp: make change minimum, don't call d_move() for dir]
    Signed-off-by: Al Viro
    Signed-off-by: OGAWA Hirofumi
    Cc: [3.17.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Al Viro
     

01 Nov, 2014

1 commit


14 Oct, 2014

1 commit


13 Jun, 2014

1 commit

  • Pull vfs updates from Al Viro:
    "This the bunch that sat in -next + lock_parent() fix. This is the
    minimal set; there's more pending stuff.

    In particular, I really hope to get acct.c fixes merged this cycle -
    we need that to deal sanely with delayed-mntput stuff. In the next
    pile, hopefully - that series is fairly short and localized
    (kernel/acct.c, fs/super.c and fs/namespace.c). In this pile: more
    iov_iter work. Most of prereqs for ->splice_write with sane locking
    order are there and Kent's dio rewrite would also fit nicely on top of
    this pile"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (70 commits)
    lock_parent: don't step on stale ->d_parent of all-but-freed one
    kill generic_file_splice_write()
    ceph: switch to iter_file_splice_write()
    shmem: switch to iter_file_splice_write()
    nfs: switch to iter_splice_write_file()
    fs/splice.c: remove unneeded exports
    ocfs2: switch to iter_file_splice_write()
    ->splice_write() via ->write_iter()
    bio_vec-backed iov_iter
    optimize copy_page_{to,from}_iter()
    bury generic_file_aio_{read,write}
    lustre: get rid of messing with iovecs
    ceph: switch to ->write_iter()
    ceph_sync_direct_write: stop poking into iov_iter guts
    ceph_sync_read: stop poking into iov_iter guts
    new helper: copy_page_from_iter()
    fuse: switch to ->write_iter()
    btrfs: switch to ->write_iter()
    ocfs2: switch to ->write_iter()
    xfs: switch to ->write_iter()
    ...

    Linus Torvalds
     

07 Jun, 2014

2 commits

  • Initializations like 'char *foo = "bar"' will create two variables: a
    static string and a pointer (foo) to that static string. Instead 'char
    foo[] = "bar"' will declare a single variable and will end up in shorter
    assembly (according to Jeff Garzik on the KernelJanitor's TODO list).

    Signed-off-by: Manuel Schölling
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Manuel Schölling
     
  • Add structure for parsed BPB information, struct fat_bios_param_block,
    and move all of the deserialization and validation logic from
    fat_fill_super() into fat_read_bpb().

    Add a 'dos1xfloppy' mount option to infer DOS 2.x BIOS Parameter Block
    defaults from block device geometry for ancient floppies and floppy
    images, as a fall-back from the default BPB parsing logic.

    When fat_read_bpb() finds an invalid FAT filesystem and dos1xfloppy is
    set, fall back to fat_read_static_bpb(). fat_read_static_bpb()
    validates that the entire BPB is zero, and that the floppy has a
    DOS-style 8086 code bootstrapping header. Then it fills in default BPB
    values from media size and a table.[0]

    Media size is assumed to be static for archaic FAT volumes. See also:
    [1].

    Fixes kernel.org bug #42617.

    [0]: https://en.wikipedia.org/wiki/File_Allocation_Table#Exceptions
    [1]: http://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html

    [hirofumi@mail.parknet.co.jp: fix missed error code]
    Signed-off-by: Conrad Meyer
    Acked-by: OGAWA Hirofumi
    Signed-off-by: OGAWA Hirofumi
    Tested-by: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Conrad Meyer