15 Oct, 2016

1 commit

  • Recent commits require line continuing printks to always use
    pr_cont or KERN_CONT. Add these markings to a few more printks.

    Miscellaneaous:

    o Integrate the ea_idebug and ea_bdebug macros to use a single
    call to printk(KERN_DEBUG instead of 3 separate printks
    o Use the more common varargs macro style

    Signed-off-by: Joe Perches
    Signed-off-by: Theodore Ts'o
    Reviewed-by: Andreas Dilger

    Joe Perches
     

11 Oct, 2016

2 commits

  • Pull more vfs updates from Al Viro:
    ">rename2() work from Miklos + current_time() from Deepa"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: Replace current_fs_time() with current_time()
    fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps
    fs: Replace CURRENT_TIME with current_time() for inode timestamps
    fs: proc: Delete inode time initializations in proc_alloc_inode()
    vfs: Add current_time() api
    vfs: add note about i_op->rename changes to porting
    fs: rename "rename2" i_op to "rename"
    vfs: remove unused i_op->rename
    fs: make remaining filesystems use .rename2
    libfs: support RENAME_NOREPLACE in simple_rename()
    fs: support RENAME_NOREPLACE for local filesystems
    ncpfs: fix unused variable warning

    Linus Torvalds
     
  • Pull vfs xattr updates from Al Viro:
    "xattr stuff from Andreas

    This completes the switch to xattr_handler ->get()/->set() from
    ->getxattr/->setxattr/->removexattr"

    * 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    vfs: Remove {get,set,remove}xattr inode operations
    xattr: Stop calling {get,set,remove}xattr inode operations
    vfs: Check for the IOP_XATTR flag in listxattr
    xattr: Add __vfs_{get,set,remove}xattr helpers
    libfs: Use IOP_XATTR flag for empty directory handling
    vfs: Use IOP_XATTR flag for bad-inode handling
    vfs: Add IOP_XATTR inode operations flag
    vfs: Move xattr_resolve_name to the front of fs/xattr.c
    ecryptfs: Switch to generic xattr handlers
    sockfs: Get rid of getxattr iop
    sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names
    kernfs: Switch to generic xattr handlers
    hfs: Switch to generic xattr handlers
    jffs2: Remove jffs2_{get,set,remove}xattr macros
    xattr: Remove unnecessary NULL attribute name check

    Linus Torvalds
     

08 Oct, 2016

1 commit


30 Sep, 2016

1 commit

  • The commit 6050d47adcad: "ext4: bail out from make_indexed_dir() on
    first error" could end up leaking bh2 in the error path.

    [ Also avoid renaming bh2 to bh, which just confuses things --tytso ]

    Cc: stable@vger.kernel.org
    Signed-off-by: yangsheng
    Signed-off-by: Theodore Ts'o

    gmail
     

27 Sep, 2016

1 commit


16 Sep, 2016

1 commit

  • Several filename crypto functions: fname_decrypt(),
    fscrypt_fname_disk_to_usr(), and fscrypt_fname_usr_to_disk(), returned
    the output length on success or -errno on failure. However, the output
    length was redundant with the value written to 'oname->len'. It is also
    potentially error-prone to make callers have to check for '< 0' instead
    of '!= 0'.

    Therefore, make these functions return 0 instead of a length, and make
    the callers who cared about the return value being a length use
    'oname->len' instead. For consistency also make other callers check for
    a nonzero result rather than a negative result.

    This change also fixes the inconsistency of fname_encrypt() actually
    already returning 0 on success, not a length like the other filename
    crypto functions and as documented in its function comment.

    Signed-off-by: Eric Biggers
    Signed-off-by: Theodore Ts'o
    Reviewed-by: Andreas Dilger
    Acked-by: Jaegeuk Kim

    Eric Biggers
     

27 Jul, 2016

1 commit

  • Pull ext4 updates from Ted Ts'o:
    "The major change this cycle is deleting ext4's copy of the file system
    encryption code and switching things over to using the copies in
    fs/crypto. I've updated the MAINTAINERS file to add an entry for
    fs/crypto listing Jaeguk Kim and myself as the maintainers.

    There are also a number of bug fixes, most notably for some problems
    found by American Fuzzy Lop (AFL) courtesy of Vegard Nossum. Also
    fixed is a writeback deadlock detected by generic/130, and some
    potential races in the metadata checksum code"

    * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (21 commits)
    ext4: verify extent header depth
    ext4: short-cut orphan cleanup on error
    ext4: fix reference counting bug on block allocation error
    MAINTAINRES: fs-crypto maintainers update
    ext4 crypto: migrate into vfs's crypto engine
    ext2: fix filesystem deadlock while reading corrupted xattr block
    ext4: fix project quota accounting without quota limits enabled
    ext4: validate s_reserved_gdt_blocks on mount
    ext4: remove unused page_idx
    ext4: don't call ext4_should_journal_data() on the journal inode
    ext4: Fix WARN_ON_ONCE in ext4_commit_super()
    ext4: fix deadlock during page writeback
    ext4: correct error value of function verifying dx checksum
    ext4: avoid modifying checksum fields directly during checksum verification
    ext4: check for extents that wrap around
    jbd2: make journal y2038 safe
    jbd2: track more dependencies on transaction commit
    jbd2: move lockdep tracking to journal_s
    jbd2: move lockdep instrumentation for jbd2 handles
    ext4: respect the nobarrier mount option in nojournal mode
    ...

    Linus Torvalds
     

11 Jul, 2016

1 commit


04 Jul, 2016

2 commits

  • ext4_dx_csum_verify() returns the success return value in two checksum
    verification failure cases. We need to set the return values to zero
    as failure like ext4_dirent_csum_verify() returning zero when failing
    to find a checksum dirent at the tail.

    Signed-off-by: Daeho Jeong
    Signed-off-by: Theodore Ts'o
    Reviewed-by: Darrick J. Wong

    Daeho Jeong
     
  • We temporally change checksum fields in buffers of some types of
    metadata into '0' for verifying the checksum values. By doing this
    without locking the buffer, some metadata's checksums, which are
    being committed or written back to the storage, could be damaged.
    In our test, several metadata blocks were found with damaged metadata
    checksum value during recovery process. When we only verify the
    checksum value, we have to avoid modifying checksum fields directly.

    Signed-off-by: Daeho Jeong
    Signed-off-by: Youngjin Gil
    Signed-off-by: Theodore Ts'o
    Reviewed-by: Darrick J. Wong

    Daeho Jeong
     

08 Jun, 2016

1 commit


25 May, 2016

1 commit

  • Pull ext4 updates from Ted Ts'o:
    "Fix a number of bugs, most notably a potential stale data exposure
    after a crash and a potential BUG_ON crash if a file has the data
    journalling flag enabled while it has dirty delayed allocation blocks
    that haven't been written yet. Also fix a potential crash in the new
    project quota code and a maliciously corrupted file system.

    In addition, fix some DAX-specific bugs, including when there is a
    transient ENOSPC situation and races between writes via direct I/O and
    an mmap'ed segment that could lead to lost I/O.

    Finally the usual set of miscellaneous cleanups"

    * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (23 commits)
    ext4: pre-zero allocated blocks for DAX IO
    ext4: refactor direct IO code
    ext4: fix race in transient ENOSPC detection
    ext4: handle transient ENOSPC properly for DAX
    dax: call get_blocks() with create == 1 for write faults to unwritten extents
    ext4: remove unmeetable inconsisteny check from ext4_find_extent()
    jbd2: remove excess descriptions for handle_s
    ext4: remove unnecessary bio get/put
    ext4: silence UBSAN in ext4_mb_init()
    ext4: address UBSAN warning in mb_find_order_for_block()
    ext4: fix oops on corrupted filesystem
    ext4: fix check of dqget() return value in ext4_ioctl_setproject()
    ext4: clean up error handling when orphan list is corrupted
    ext4: fix hang when processing corrupted orphaned inode list
    ext4: remove trailing \n from ext4_warning/ext4_error calls
    ext4: fix races between changing inode journal mode and ext4_writepages
    ext4: handle unwritten or delalloc buffers before enabling data journaling
    ext4: fix jbd2 handle extension in ext4_ext_truncate_extend_restart()
    ext4: do not ask jbd2 to write data for delalloc buffers
    jbd2: add support for avoiding data writes during transaction commits
    ...

    Linus Torvalds
     

05 May, 2016

1 commit

  • When filesystem is corrupted in the right way, it can happen
    ext4_mark_iloc_dirty() in ext4_orphan_add() returns error and we
    subsequently remove inode from the in-memory orphan list. However this
    deletion is done with list_del(&EXT4_I(inode)->i_orphan) and thus we
    leave i_orphan list_head with a stale content. Later we can look at this
    content causing list corruption, oops, or other issues. The reported
    trace looked like:

    WARNING: CPU: 0 PID: 46 at lib/list_debug.c:53 __list_del_entry+0x6b/0x100()
    list_del corruption, 0000000061c1d6e0->next is LIST_POISON1
    0000000000100100)
    CPU: 0 PID: 46 Comm: ext4.exe Not tainted 4.1.0-rc4+ #250
    Stack:
    60462947 62219960 602ede24 62219960
    602ede24 603ca293 622198f0 602f02eb
    62219950 6002c12c 62219900 601b4d6b
    Call Trace:
    [] ? vprintk_emit+0x2dc/0x5c0
    [] ? printk+0x0/0x94
    [] show_stack+0xdc/0x1a0
    [] ? printk+0x0/0x94
    [] ? printk+0x0/0x94
    [] dump_stack+0x2a/0x2c
    [] warn_slowpath_common+0x9c/0xf0
    [] ? __list_del_entry+0x6b/0x100
    [] warn_slowpath_fmt+0x94/0xa0
    [] ? __mutex_lock_slowpath+0x239/0x3a0
    [] ? warn_slowpath_fmt+0x0/0xa0
    [] ? set_signals+0x3f/0x50
    [] ? kmem_cache_free+0x10a/0x180
    [] ? mutex_lock+0x18/0x30
    [] __list_del_entry+0x6b/0x100
    [] ext4_orphan_del+0x22c/0x2f0
    [] ? __ext4_journal_start_sb+0x2c/0xa0
    [] ? ext4_truncate+0x383/0x390
    [] ext4_write_begin+0x30b/0x4b0
    [] ? copy_from_user+0x0/0xb0
    [] ? iov_iter_fault_in_readable+0xa0/0xc0
    [] generic_perform_write+0xaf/0x1e0
    [] ? file_update_time+0x46/0x110
    [] __generic_file_write_iter+0x18f/0x1b0
    [] ext4_file_write_iter+0x15f/0x470
    [] ? unlink_file_vma+0x0/0x70
    [] ? unlink_anon_vmas+0x0/0x260
    [] ? free_pgtables+0xb9/0x100
    [] __vfs_write+0xb0/0x130
    [] vfs_write+0xa5/0x170
    [] SyS_write+0x56/0xe0
    [] ? __libc_waitpid+0x0/0xa0
    [] handle_syscall+0x68/0x90
    [] userspace+0x4fd/0x600
    [] ? save_registers+0x1f/0x40
    [] ? arch_prctl+0x177/0x1b0
    [] fork_handler+0x85/0x90

    Fix the problem by using list_del_init() as we always should with
    i_orphan list.

    CC: stable@vger.kernel.org
    Reported-by: Vegard Nossum
    Signed-off-by: Jan Kara
    Signed-off-by: Theodore Ts'o

    Jan Kara
     

27 Apr, 2016

1 commit


24 Apr, 2016

1 commit

  • If a directory has a large number of empty blocks, iterating over all
    of them can take a long time, leading to scheduler warnings and users
    getting irritated when they can't kill a process in the middle of one
    of these long-running readdir operations. Fix this by adding checks to
    ext4_readdir() and ext4_htree_fill_tree().

    This was reverted earlier due to a typo in the original commit where I
    experimented with using signal_pending() instead of
    fatal_signal_pending(). The test was in the wrong place if we were
    going to return signal_pending() since we would end up returning
    duplicant entries. See 9f2394c9be47 for a more detailed explanation.

    Added fix as suggested by Linus to check for signal_pending() in
    in the filldir() functions.

    Reported-by: Benjamin LaHaise
    Google-Bug-Id: 27880676
    Signed-off-by: Theodore Ts'o

    Theodore Ts'o
     

11 Apr, 2016

2 commits

  • This reverts commit 1028b55bafb7611dda1d8fed2aeca16a436b7dff.

    It's broken: it makes ext4 return an error at an invalid point, causing
    the readdir wrappers to write the the position of the last successful
    directory entry into the position field, which means that the next
    readdir will now return that last successful entry _again_.

    You can only return fatal errors (that terminate the readdir directory
    walk) from within the filesystem readdir functions, the "normal" errors
    (that happen when the readdir buffer fills up, for example) happen in
    the iterorator where we know the position of the actual failing entry.

    I do have a very different patch that does the "signal_pending()"
    handling inside the iterator function where it is allowable, but while
    that one passes all the sanity checks, I screwed up something like four
    times while emailing it out, so I'm not going to commit it today.

    So my track record is not good enough, and the stars will have to align
    better before that one gets committed. And it would be good to get some
    review too, of course, since celestial alignments are always an iffy
    debugging model.

    IOW, let's just revert the commit that caused the problem for now.

    Reported-by: Greg Thelen
    Cc: Theodore Ts'o
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • ... and neither can ever be NULL

    Signed-off-by: Al Viro

    Al Viro
     

31 Mar, 2016

1 commit

  • If a directory has a large number of empty blocks, iterating over all
    of them can take a long time, leading to scheduler warnings and users
    getting irritated when they can't kill a process in the middle of one
    of these long-running readdir operations. Fix this by adding checks to
    ext4_readdir() and ext4_htree_fill_tree().

    Reported-by: Benjamin LaHaise
    Google-Bug-Id: 27880676
    Signed-off-by: Theodore Ts'o

    Theodore Ts'o
     

08 Feb, 2016

2 commits


23 Jan, 2016

2 commits

  • 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
     
  • Pull ext4 updates from Ted Ts'o:
    "Some locking and page fault bug fixes from Jan Kara, some ext4
    encryption fixes from me, and Li Xi's Project Quota commits"

    * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    fs: clean up the flags definition in uapi/linux/fs.h
    ext4: add FS_IOC_FSSETXATTR/FS_IOC_FSGETXATTR interface support
    ext4: add project quota support
    ext4: adds project ID support
    ext4 crypto: simplify interfaces to directory entry insert functions
    ext4 crypto: add missing locking for keyring_key access
    ext4: use pre-zeroed blocks for DAX page faults
    ext4: implement allocation of pre-zeroed blocks
    ext4: provide ext4_issue_zeroout()
    ext4: get rid of EXT4_GET_BLOCKS_NO_LOCK flag
    ext4: document lock ordering
    ext4: fix races of writeback with punch hole and zero range
    ext4: fix races between buffered IO and collapse / insert range
    ext4: move unlocked dio protection from ext4_alloc_file_blocks()
    ext4: fix races between page faults and hole punching

    Linus Torvalds
     

09 Jan, 2016

2 commits


09 Dec, 2015

1 commit

  • kmap() in page_follow_link_light() needed to go - allowing to hold
    an arbitrary number of kmaps for long is a great way to deadlocking
    the system.

    new helper (inode_nohighmem(inode)) needs to be used for pagecache
    symlinks inodes; done for all in-tree cases. page_follow_link_light()
    instrumented to yell about anything missed.

    Signed-off-by: Al Viro

    Al Viro
     

08 Nov, 2015

1 commit

  • Pull trivial updates from Jiri Kosina:
    "Trivial stuff from trivial tree that can be trivially summed up as:

    - treewide drop of spurious unlikely() before IS_ERR() from Viresh
    Kumar

    - cosmetic fixes (that don't really affect basic functionality of the
    driver) for pktcdvd and bcache, from Julia Lawall and Petr Mladek

    - various comment / printk fixes and updates all over the place"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
    bcache: Really show state of work pending bit
    hwmon: applesmc: fix comment typos
    Kconfig: remove comment about scsi_wait_scan module
    class_find_device: fix reference to argument "match"
    debugfs: document that debugfs_remove*() accepts NULL and error values
    net: Drop unlikely before IS_ERR(_OR_NULL)
    mm: Drop unlikely before IS_ERR(_OR_NULL)
    fs: Drop unlikely before IS_ERR(_OR_NULL)
    drivers: net: Drop unlikely before IS_ERR(_OR_NULL)
    drivers: misc: Drop unlikely before IS_ERR(_OR_NULL)
    UBI: Update comments to reflect UBI_METAONLY flag
    pktcdvd: drop null test before destroy functions

    Linus Torvalds
     

30 Oct, 2015

1 commit


18 Oct, 2015

2 commits


29 Sep, 2015

1 commit

  • IS_ERR(_OR_NULL) already contain an 'unlikely' compiler flag and there
    is no need to do that again from its callers. Drop it.

    Signed-off-by: Viresh Kumar
    Reviewed-by: Jeff Layton
    Reviewed-by: David Howells
    Reviewed-by: Steve French
    Signed-off-by: Jiri Kosina

    Viresh Kumar
     

27 Jul, 2015

1 commit


24 Jul, 2015

1 commit


26 Jun, 2015

1 commit

  • Pull ext4 updates from Ted Ts'o:
    "A very large number of cleanups and bug fixes --- in particular for
    the ext4 encryption patches, which is a new feature added in the last
    merge window. Also fix a number of long-standing xfstest failures.
    (Quota writes failing due to ENOSPC, a race between truncate and
    writepage in data=journalled mode that was causing generic/068 to
    fail, and other corner cases.)

    Also add support for FALLOC_FL_INSERT_RANGE, and improve jbd2
    performance eliminating locking when a buffer is modified more than
    once during a transaction (which is very common for allocation
    bitmaps, for example), in which case the state of the journalled
    buffer head doesn't need to change"

    [ I renamed "ext4_follow_link()" to "ext4_encrypted_follow_link()" in
    the merge resolution, to make it clear that that function is _only_
    used for encrypted symlinks. The function doesn't actually work for
    non-encrypted symlinks at all, and they use the generic helpers
    - Linus ]

    * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (52 commits)
    ext4: set lazytime on remount if MS_LAZYTIME is set by mount
    ext4: only call ext4_truncate when size t retry file block mapping on bigalloc fs with non-extent file
    ext4: prevent ext4_quota_write() from failing due to ENOSPC
    ext4: call sync_blockdev() before invalidate_bdev() in put_super()
    jbd2: speedup jbd2_journal_dirty_metadata()
    jbd2: get rid of open coded allocation retry loop
    ext4: improve warning directory handling messages
    jbd2: fix ocfs2 corrupt when updating journal superblock fails
    ext4: mballoc: avoid 20-argument function call
    ext4: wait for existing dio workers in ext4_alloc_file_blocks()
    ext4: recalculate journal credits as inode depth changes
    jbd2: use GFP_NOFS in jbd2_cleanup_journal_tail()
    ext4: use swap() in mext_page_double_lock()
    ext4: use swap() in memswap()
    ext4: fix race between truncate and __ext4_journalled_writepage()
    ext4 crypto: fail the mount if blocksize != pagesize
    ext4: Add support FALLOC_FL_INSERT_RANGE for fallocate
    ...

    Linus Torvalds
     

21 Jun, 2015

1 commit

  • In order to prevent quota block tracking to be inaccurate when
    ext4_quota_write() fails with ENOSPC, we make two changes. The quota
    file can now use the reserved block (since the quota file is arguably
    file system metadata), and ext4_quota_write() now uses
    ext4_should_retry_alloc() to retry the block allocation after a commit
    has completed and released some blocks for allocation.

    This fixes failures of xfstests generic/270:

    Quota error (device vdc): write_blk: dquota write failed
    Quota error (device vdc): qtree_write_dquot: Error -28 occurred while creating quota

    Signed-off-by: Theodore Ts'o

    Theodore Ts'o
     

16 Jun, 2015

1 commit

  • Several ext4_warning() messages in the directory handling code do not
    report the inode number of the (potentially corrupt) directory where a
    problem is seen, and others report this in an ad-hoc manner. Add an
    ext4_warning_inode() helper to print the inode number and command name
    consistent with ext4_error_inode().

    Consolidate the place in ext4.h that these macros are defined.

    Clean up some other directory error and warning messages to print the
    calling function name.

    Minor code style fixes in nearby lines.

    Signed-off-by: Andreas Dilger
    Signed-off-by: Theodore Ts'o

    Andreas Dilger
     

01 Jun, 2015

4 commits