27 Apr, 2016

1 commit

  • This is more prep-work for the upcoming pty changes. Still just code
    cleanup with no actual semantic changes.

    This removes a bunch pointless complexity by just having the slave pty
    side remember the dentry associated with the devpts slave rather than
    the inode. That allows us to remove all the "look up the dentry" code
    for when we want to remove it again.

    Together with moving the tty pointer from "inode->i_private" to
    "dentry->d_fsdata" and getting rid of pointless inode locking, this
    removes about 30 lines of code. Not only is the end result smaller,
    it's simpler and easier to understand.

    The old code, for example, depended on the d_find_alias() to not just
    find the dentry, but also to check that it is still hashed, which in
    turn validated the tty pointer in the inode.

    That is a _very_ roundabout way to say "invalidate the cached tty
    pointer when the dentry is removed".

    The new code just does

    dentry->d_fsdata = NULL;

    in devpts_pty_kill() instead, invalidating the tty pointer rather more
    directly and obviously. Don't do something complex and subtle when the
    obvious straightforward approach will do.

    The rest of the patch (ie apart from code deletion and the above tty
    pointer clearing) is just switching the calling convention to pass the
    dentry or file pointer around instead of the inode.

    Cc: Eric Biederman
    Cc: Peter Anvin
    Cc: Andy Lutomirski
    Cc: Al Viro
    Cc: Peter Hurley
    Cc: Serge Hallyn
    Cc: Willy Tarreau
    Cc: Aurelien Jarno
    Cc: Alan Cox
    Cc: Jann Horn
    Cc: Greg KH
    Cc: Jiri Slaby
    Cc: Florian Weimer
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

20 Apr, 2016

1 commit

  • Merge the ptmx internal interface cleanup branch.

    This doesn't change semantics, but it should be a sane basis for
    eventually getting the multi-instance devpts code into some sane shape
    where we can get rid of the kernel config option. Which we can
    hopefully get done next merge window..

    * ptmx-cleanup:
    devpts: clean up interface to pty drivers

    Linus Torvalds
     

19 Apr, 2016

1 commit

  • This gets rid of the horrible notion of having that

    struct inode *ptmx_inode

    be the linchpin of the interface between the pty code and devpts.

    By de-emphasizing the ptmx inode, a lot of things actually get cleaner,
    and we will have a much saner way forward. In particular, this will
    allow us to associate with any particular devpts instance at open-time,
    and not be artificially tied to one particular ptmx inode.

    The patch itself is actually fairly straightforward, and apart from some
    locking and return path cleanups it's pretty mechanical:

    - the interfaces that devpts exposes all take "struct pts_fs_info *"
    instead of "struct inode *ptmx_inode" now.

    NOTE! The "struct pts_fs_info" thing is a completely opaque structure
    as far as the pty driver is concerned: it's still declared entirely
    internally to devpts. So the pty code can't actually access it in any
    way, just pass it as a "cookie" to the devpts code.

    - the "look up the pts fs info" is now a single clear operation, that
    also does the reference count increment on the pts superblock.

    So "devpts_add/del_ref()" is gone, and replaced by a "lookup and get
    ref" operation (devpts_get_ref(inode)), along with a "put ref" op
    (devpts_put_ref()).

    - the pty master "tty->driver_data" field now contains the pts_fs_info,
    not the ptmx inode.

    - because we don't care about the ptmx inode any more as some kind of
    base index, the ref counting can now drop the inode games - it just
    gets the ref on the superblock.

    - the pts_fs_info now has a back-pointer to the super_block. That's so
    that we can easily look up the information we actually need. Although
    quite often, the pts fs info was actually all we wanted, and not having
    to look it up based on some magical inode makes things more
    straightforward.

    In particular, now that "devpts_get_ref(inode)" operation should really
    be the *only* place we need to look up what devpts instance we're
    associated with, and we do it exactly once, at ptmx_open() time.

    The other side of this is that one ptmx node could now be associated
    with multiple different devpts instances - you could have a single
    /dev/ptmx node, and then have multiple mount namespaces with their own
    instances of devpts mounted on /dev/pts/. And that's all perfectly sane
    in a model where we just look up the pts instance at open time.

    This will eventually allow us to get rid of our odd single-vs-multiple
    pts instance model, but this patch in itself changes no semantics, only
    an internal binding model.

    Cc: Eric Biederman
    Cc: Peter Anvin
    Cc: Andy Lutomirski
    Cc: Al Viro
    Cc: Peter Hurley
    Cc: Serge Hallyn
    Cc: Willy Tarreau
    Cc: Aurelien Jarno
    Cc: Alan Cox
    Cc: Jann Horn
    Cc: Greg KH
    Cc: Jiri Slaby
    Cc: Florian Weimer
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

17 Apr, 2016

1 commit

  • Pull misc fixes from Greg KH:
    "Here are three small fixes for 4.6-rc4.

    Two fix up some lz4 issues with big endian systems, and the remaining
    one resolves a minor debugfs issue that was reported.

    All have been in linux-next with no reported issues"

    * tag 'driver-core-4.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    lib: lz4: cleanup unaligned access efficiency detection
    lib: lz4: fixed zram with lz4 on big endian machines
    debugfs: Make automount point inodes permanently empty

    Linus Torvalds
     

15 Apr, 2016

2 commits

  • Pull f2fs/fscrypto fixes from Jaegeuk Kim:
    "In addition to f2fs/fscrypto fixes, I've added one patch which
    prevents RCU mode lookup in d_revalidate, as Al mentioned.

    These patches fix f2fs and fscrypto based on -rc3 bug fixes in ext4
    crypto, which have not yet been fully propagated as follows.

    - use of dget_parent and file_dentry to avoid crashes
    - disallow RCU-mode lookup in d_invalidate
    - disallow -ENOMEM in the core data encryption path"

    * tag 'for-linus-4.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
    ext4/fscrypto: avoid RCU lookup in d_revalidate
    fscrypto: don't let data integrity writebacks fail with ENOMEM
    f2fs: use dget_parent and file_dentry in f2fs_file_open
    fscrypto: use dget_parent() in fscrypt_d_revalidate()

    Linus Torvalds
     
  • A lot of seqfile users seem to be using things like %pK that uses the
    credentials of the current process, but that is actually completely
    wrong for filesystem interfaces.

    The unix semantics for permission checking files is to check permissions
    at _open_ time, not at read or write time, and that is not just a small
    detail: passing off stdin/stdout/stderr to a suid application and making
    the actual IO happen in privileged context is a classic exploit
    technique.

    So if we want to be able to look at permissions at read time, we need to
    use the file open credentials, not the current ones. Normal file
    accesses can just use "f_cred" (or any of the helper functions that do
    that, like file_ns_capable()), but the seqfile interfaces do not have
    any such options.

    It turns out that seq_file _does_ save away the user_ns information of
    the file, though. Since user_ns is just part of the full credential
    information, replace that special case with saving off the cred pointer
    instead, and suddenly seq_file has all the permission information it
    needs.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

13 Apr, 2016

5 commits

  • As Al pointed, d_revalidate should return RCU lookup before using d_inode.
    This was originally introduced by:
    commit 34286d666230 ("fs: rcu-walk aware d_revalidate method").

    Reported-by: Al Viro
    Signed-off-by: Jaegeuk Kim
    Cc: Theodore Ts'o
    Cc: stable

    Jaegeuk Kim
     
  • Starting with 4.1 the tracing subsystem has its own filesystem
    which is automounted in the tracing subdirectory of debugfs.
    Prior to this debugfs could be bind mounted in a cloned mount
    namespace, but if tracefs has been mounted under debugfs this
    now fails because there is a locked child mount. This creates
    a regression for container software which bind mounts debugfs
    to satisfy the assumption of some userspace software.

    In other pseudo filesystems such as proc and sysfs we're already
    creating mountpoints like this in such a way that no dirents can
    be created in the directories, allowing them to be exceptions to
    some MNT_LOCKED tests. In fact we're already do this for the
    tracefs mountpoint in sysfs.

    Do the same in debugfs_create_automount(), since the intention
    here is clearly to create a mountpoint. This fixes the regression,
    as locked child mounts on permanently empty directories do not
    cause a bind mount to fail.

    Cc: stable@vger.kernel.org # v4.1+
    Signed-off-by: Seth Forshee
    Acked-by: Serge Hallyn
    Signed-off-by: Greg Kroah-Hartman

    Seth Forshee
     
  • This patch fixes the issue introduced by the ext4 crypto fix in a same manner.
    For F2FS, however, we flush the pending IOs and wait for a while to acquire free
    memory.

    Fixes: c9af28fdd4492 ("ext4 crypto: don't let data integrity writebacks fail with ENOMEM")
    Cc: Theodore Ts'o
    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • This patch synced with the below two ext4 crypto fixes together.

    In 4.6-rc1, f2fs newly introduced accessing f_path.dentry which crashes
    overlayfs. To fix, now we need to use file_dentry() to access that field.

    Fixes: c0a37d487884 ("ext4: use file_dentry()")
    Fixes: 9dd78d8c9a7b ("ext4: use dget_parent() in ext4_file_open()")
    Cc: Miklos Szeredi
    Cc: Theodore Ts'o
    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     
  • This patch updates fscrypto along with the below ext4 crypto change.

    Fixes: 3d43bcfef5f0 ("ext4 crypto: use dget_parent() in ext4_d_revalidate()")
    Cc: Theodore Ts'o
    Signed-off-by: Jaegeuk Kim

    Jaegeuk Kim
     

11 Apr, 2016

1 commit

  • 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
     

10 Apr, 2016

2 commits

  • Pull btrfs fixes from Chris Mason:
    "These are bug fixes, including a really old fsync bug, and a few trace
    points to help us track down problems in the quota code"

    * 'for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
    Btrfs: fix file/data loss caused by fsync after rename and new inode
    btrfs: Reset IO error counters before start of device replacing
    btrfs: Add qgroup tracing
    Btrfs: don't use src fd for printk
    btrfs: fallback to vmalloc in btrfs_compare_tree
    btrfs: handle non-fatal errors in btrfs_qgroup_inherit()
    btrfs: Output more info for enospc_debug mount option
    Btrfs: fix invalid reference in replace_path
    Btrfs: Improve FL_KEEP_SIZE handling in fallocate

    Linus Torvalds
     
  • Pull orangefs fixes from Mike Marshall:
    "Orangefs cleanups and a strncpy vulnerability fix.

    Cleanups:
    - remove an unused variable from orangefs_readdir.
    - clean up printk wrapper used for ofs "gossip" debugging.
    - clean up truncate ctime and mtime setting in inode.c
    - remove a useless null check found by coccinelle.
    - optimize some memcpy/memset boilerplate code.
    - remove some useless sanity checks from xattr.c

    Fix:
    - fix a potential strncpy vulnerability"

    * tag 'for-linus-4.6-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
    orangefs: remove unused variable
    orangefs: Add KERN_ to gossip_ macros
    orangefs: strncpy -> strscpy
    orangefs: clean up truncate ctime and mtime setting
    Orangefs: fix ifnullfree.cocci warnings
    Orangefs: optimize boilerplate code.
    Orangefs: xattr.c cleanup

    Linus Torvalds
     

09 Apr, 2016

7 commits

  • Signed-off-by: Martin Brandenburg
    Signed-off-by: Mike Marshall

    Martin Brandenburg
     
  • Emit the logging messages at the appropriate levels.

    Miscellanea:

    o Change format to fmt
    o Use the more common ##__VA_ARGS__

    Signed-off-by: Joe Perches
    Signed-off-by: Mike Marshall

    Joe Perches
     
  • It would have been possible for a rogue client-core to send in a symlink
    target which is not NUL terminated. This returns EIO if the client-core
    gives us corrupt data.

    Leave debugfs and superblock code as is for now.

    Other dcache.c and namei.c strncpy instances are safe because
    ORANGEFS_NAME_MAX = NAME_MAX + 1; there is always enough space for a
    name plus a NUL byte.

    Signed-off-by: Martin Brandenburg
    Signed-off-by: Mike Marshall

    Martin Brandenburg
     
  • The ctime and mtime are always updated on a successful ftruncate and
    only updated on a successful truncate where the size changed.

    We handle the ``if the size changed'' bit.

    This matches FUSE's behavior.

    Signed-off-by: Martin Brandenburg
    Signed-off-by: Mike Marshall

    Martin Brandenburg
     
  • fs/orangefs/orangefs-debugfs.c:130:2-26: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

    NULL check before some freeing functions is not needed.

    Based on checkpatch warning
    "kfree(NULL) is safe this check is probably not required"
    and kfreeaddr.cocci by Julia Lawall.

    Generated by: scripts/coccinelle/free/ifnullfree.cocci

    Signed-off-by: Fengguang Wu
    Signed-off-by: Mike Marshall

    kbuild test robot
     
  • Suggested by David Binderman
    The former can potentially be a performance win over the latter.

    memcpy(d, s, len);
    memset(d+len, c, size-len);

    memset(d, c, size);
    memcpy(d, s, len);

    Signed-off-by: Mike Marshall

    Mike Marshall
     
  • 1. It is nonsense to test for negative size_t, suggested by
    David Binderman

    2. By the time Orangefs gets called, the vfs has ensured that
    name != NULL, and that buffer and size are sane.

    Signed-off-by: Mike Marshall

    Mike Marshall
     

08 Apr, 2016

1 commit

  • Pull ext4 bugfixes from Ted Ts'o:
    "These changes contains a fix for overlayfs interacting with some
    (badly behaved) dentry code in various file systems. These have been
    reviewed by Al and the respective file system mtinainers and are going
    through the ext4 tree for convenience.

    This also has a few ext4 encryption bug fixes that were discovered in
    Android testing (yes, we will need to get these sync'ed up with the
    fs/crypto code; I'll take care of that). It also has some bug fixes
    and a change to ignore the legacy quota options to allow for xfstests
    regression testing of ext4's internal quota feature and to be more
    consistent with how xfs handles this case"

    * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    ext4: ignore quota mount options if the quota feature is enabled
    ext4 crypto: fix some error handling
    ext4: avoid calling dquot_get_next_id() if quota is not enabled
    ext4: retry block allocation for failed DIO and DAX writes
    ext4: add lockdep annotations for i_data_sem
    ext4: allow readdir()'s of large empty directories to be interrupted
    btrfs: fix crash/invalid memory access on fsync when using overlayfs
    ext4 crypto: use dget_parent() in ext4_d_revalidate()
    ext4: use file_dentry()
    ext4: use dget_parent() in ext4_file_open()
    nfs: use file_dentry()
    fs: add file_dentry()
    ext4 crypto: don't let data integrity writebacks fail with ENOMEM
    ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea()

    Linus Torvalds
     

07 Apr, 2016

1 commit

  • If we rename an inode A (be it a file or a directory), create a new
    inode B with the old name of inode A and under the same parent directory,
    fsync inode B and then power fail, at log tree replay time we end up
    removing inode A completely. If inode A is a directory then all its files
    are gone too.

    Example scenarios where this happens:
    This is reproducible with the following steps, taken from a couple of
    test cases written for fstests which are going to be submitted upstream
    soon:

    # Scenario 1

    mkfs.btrfs -f /dev/sdc
    mount /dev/sdc /mnt
    mkdir -p /mnt/a/x
    echo "hello" > /mnt/a/x/foo
    echo "world" > /mnt/a/x/bar
    sync
    mv /mnt/a/x /mnt/a/y
    mkdir /mnt/a/x
    xfs_io -c fsync /mnt/a/x

    The next time the fs is mounted, log tree replay happens and
    the directory "y" does not exist nor do the files "foo" and
    "bar" exist anywhere (neither in "y" nor in "x", nor the root
    nor anywhere).

    # Scenario 2

    mkfs.btrfs -f /dev/sdc
    mount /dev/sdc /mnt
    mkdir /mnt/a
    echo "hello" > /mnt/a/foo
    sync
    mv /mnt/a/foo /mnt/a/bar
    echo "world" > /mnt/a/foo
    xfs_io -c fsync /mnt/a/foo

    The next time the fs is mounted, log tree replay happens and the
    file "bar" does not exists anymore. A file with the name "foo"
    exists and it matches the second file we created.

    Another related problem that does not involve file/data loss is when a
    new inode is created with the name of a deleted snapshot and we fsync it:

    mkfs.btrfs -f /dev/sdc
    mount /dev/sdc /mnt
    mkdir /mnt/testdir
    btrfs subvolume snapshot /mnt /mnt/testdir/snap
    btrfs subvolume delete /mnt/testdir/snap
    rmdir /mnt/testdir
    mkdir /mnt/testdir
    xfs_io -c fsync /mnt/testdir # or fsync some file inside /mnt/testdir

    The next time the fs is mounted the log replay procedure fails because
    it attempts to delete the snapshot entry (which has dir item key type
    of BTRFS_ROOT_ITEM_KEY) as if it were a regular (non-root) entry,
    resulting in the following error that causes mount to fail:

    [52174.510532] BTRFS info (device dm-0): failed to delete reference to snap, inode 257 parent 257
    [52174.512570] ------------[ cut here ]------------
    [52174.513278] WARNING: CPU: 12 PID: 28024 at fs/btrfs/inode.c:3986 __btrfs_unlink_inode+0x178/0x351 [btrfs]()
    [52174.514681] BTRFS: Transaction aborted (error -2)
    [52174.515630] Modules linked in: btrfs dm_flakey dm_mod overlay crc32c_generic ppdev xor raid6_pq acpi_cpufreq parport_pc tpm_tis sg parport tpm evdev i2c_piix4 proc
    [52174.521568] CPU: 12 PID: 28024 Comm: mount Tainted: G W 4.5.0-rc6-btrfs-next-27+ #1
    [52174.522805] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS by qemu-project.org 04/01/2014
    [52174.524053] 0000000000000000 ffff8801df2a7710 ffffffff81264e93 ffff8801df2a7758
    [52174.524053] 0000000000000009 ffff8801df2a7748 ffffffff81051618 ffffffffa03591cd
    [52174.524053] 00000000fffffffe ffff88015e6e5000 ffff88016dbc3c88 ffff88016dbc3c88
    [52174.524053] Call Trace:
    [52174.524053] [] dump_stack+0x67/0x90
    [52174.524053] [] warn_slowpath_common+0x99/0xb2
    [52174.524053] [] ? __btrfs_unlink_inode+0x178/0x351 [btrfs]
    [52174.524053] [] warn_slowpath_fmt+0x48/0x50
    [52174.524053] [] __btrfs_unlink_inode+0x178/0x351 [btrfs]
    [52174.524053] [] ? iput+0xb0/0x284
    [52174.524053] [] btrfs_unlink_inode+0x1c/0x3d [btrfs]
    [52174.524053] [] check_item_in_log+0x1fe/0x29b [btrfs]
    [52174.524053] [] replay_dir_deletes+0x167/0x1cf [btrfs]
    [52174.524053] [] fixup_inode_link_count+0x289/0x2aa [btrfs]
    [52174.524053] [] fixup_inode_link_counts+0xcb/0x105 [btrfs]
    [52174.524053] [] btrfs_recover_log_trees+0x258/0x32c [btrfs]
    [52174.524053] [] ? replay_one_extent+0x511/0x511 [btrfs]
    [52174.524053] [] open_ctree+0x1dd4/0x21b9 [btrfs]
    [52174.524053] [] btrfs_mount+0x97e/0xaed [btrfs]
    [52174.524053] [] ? trace_hardirqs_on+0xd/0xf
    [52174.524053] [] mount_fs+0x67/0x131
    [52174.524053] [] vfs_kern_mount+0x6c/0xde
    [52174.524053] [] btrfs_mount+0x1ac/0xaed [btrfs]
    [52174.524053] [] ? trace_hardirqs_on+0xd/0xf
    [52174.524053] [] ? lockdep_init_map+0xb9/0x1b3
    [52174.524053] [] mount_fs+0x67/0x131
    [52174.524053] [] vfs_kern_mount+0x6c/0xde
    [52174.524053] [] do_mount+0x8a6/0x9e8
    [52174.524053] [] ? strndup_user+0x3f/0x59
    [52174.524053] [] SyS_mount+0x77/0x9f
    [52174.524053] [] entry_SYSCALL_64_fastpath+0x12/0x6b
    [52174.561288] ---[ end trace 6b53049efb1a3ea6 ]---

    Fix this by forcing a transaction commit when such cases happen.
    This means we check in the commit root of the subvolume tree if there
    was any other inode with the same reference when the inode we are
    fsync'ing is a new inode (created in the current transaction).

    Test cases for fstests, covering all the scenarios given above, were
    submitted upstream for fstests:

    * fstests: generic test for fsync after renaming directory
    https://patchwork.kernel.org/patch/8694281/

    * fstests: generic test for fsync after renaming file
    https://patchwork.kernel.org/patch/8694301/

    * fstests: add btrfs test for fsync after snapshot deletion
    https://patchwork.kernel.org/patch/8670671/

    Cc: stable@vger.kernel.org
    Signed-off-by: Filipe Manana
    Signed-off-by: Chris Mason

    Filipe Manana
     

05 Apr, 2016

5 commits

  • Pull quota fixes from Jan Kara:
    "Fixes for oopses when the new quotactl gets used with quotas disabled"

    * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
    ocfs2: Fix Q_GETNEXTQUOTA for filesystem without quotas
    quota: Handle Q_GETNEXTQUOTA when quota is disabled

    Linus Torvalds
     
  • Pull f2fs fixes from Jaegeuk Kim.

    * tag 'f2fs-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
    f2fs: retrieve IO write stat from the right place
    f2fs crypto: fix corrupted symlink in encrypted case
    f2fs: cover large section in sanity check of super

    Linus Torvalds
     
  • Merge PAGE_CACHE_SIZE removal patches from Kirill Shutemov:
    "PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The first patch with most changes has been done with coccinelle. The
    second is manual fixups on top.

    The third patch removes macros definition"

    [ I was planning to apply this just before rc2, but then I spaced out,
    so here it is right _after_ rc2 instead.

    As Kirill suggested as a possibility, I could have decided to only
    merge the first two patches, and leave the old interfaces for
    compatibility, but I'd rather get it all done and any out-of-tree
    modules and patches can trivially do the converstion while still also
    working with older kernels, so there is little reason to try to
    maintain the redundant legacy model. - Linus ]

    * PAGE_CACHE_SIZE-removal:
    mm: drop PAGE_CACHE_* and page_cache_{get,release} definition
    mm, fs: remove remaining PAGE_CACHE_* and page_cache_{get,release} usage
    mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros

    Linus Torvalds
     
  • Mostly direct substitution with occasional adjustment or removing
    outdated comments.

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     
  • PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    We have many places where PAGE_CACHE_SIZE assumed to be equal to
    PAGE_SIZE. And it's constant source of confusion on whether
    PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
    especially on the border between fs and mm.

    Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
    breakage to be doable.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The changes are pretty straight-forward:

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

    - page_cache_get() -> get_page();

    - page_cache_release() -> put_page();

    This patch contains automated changes generated with coccinelle using
    script below. For some reason, coccinelle doesn't patch header files.
    I've called spatch for them manually.

    The only adjustment after coccinelle is revert of changes to
    PAGE_CAHCE_ALIGN definition: we are going to drop it later.

    There are few places in the code where coccinelle didn't reach. I'll
    fix them manually in a separate patch. Comments and documentation also
    will be addressed with the separate patch.

    virtual patch

    @@
    expression E;
    @@
    - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    expression E;
    @@
    - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    @@
    - PAGE_CACHE_SHIFT
    + PAGE_SHIFT

    @@
    @@
    - PAGE_CACHE_SIZE
    + PAGE_SIZE

    @@
    @@
    - PAGE_CACHE_MASK
    + PAGE_MASK

    @@
    expression E;
    @@
    - PAGE_CACHE_ALIGN(E)
    + PAGE_ALIGN(E)

    @@
    expression E;
    @@
    - page_cache_get(E)
    + get_page(E)

    @@
    expression E;
    @@
    - page_cache_release(E)
    + put_page(E)

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

04 Apr, 2016

9 commits

  • If device replace entry was found on disk at mounting and its num_write_errors
    stats counter has non-NULL value, then replace operation will never be
    finished and -EIO error will be reported by btrfs_scrub_dev() because
    this counter is never reset.

    # mount -o degraded /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
    # btrfs replace status /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
    Started on 25.Mar 07:28:00, canceled on 25.Mar 07:28:01 at 0.0%, 40 write errs, 0 uncorr. read errs
    # btrfs replace start -B 4 /dev/sdg /media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/
    ERROR: ioctl(DEV_REPLACE_START) failed on "/media/a4fb5c0a-21c5-4fe7-8d0e-fdd87d5f71ee/": Input/output error, no error

    Reset num_write_errors and num_uncorrectable_read_errors counters in the
    dev_replace structure before start of replacing.

    Signed-off-by: Yauhen Kharuzhy
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba

    Yauhen Kharuzhy
     
  • This patch adds tracepoints to the qgroup code on both the reporting side
    (insert_dirty_extents) and the accounting side. Taken together it allows us
    to see what qgroup operations have happened, and what their result was.

    Signed-off-by: Mark Fasheh
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba

    Mark Fasheh
     
  • The fd we pass in may not be on a btrfs file system, so don't try to do
    BTRFS_I() on it. Thanks,

    Signed-off-by: Josef Bacik
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba

    Josef Bacik
     
  • The allocation of node could fail if the memory is too fragmented for a
    given node size, practically observed with 64k.

    http://article.gmane.org/gmane.comp.file-systems.btrfs/54689

    Reported-and-tested-by: Jean-Denis Girard
    Signed-off-by: David Sterba

    David Sterba
     
  • create_pending_snapshot() will go readonly on _any_ error return from
    btrfs_qgroup_inherit(). If qgroups are enabled, a user can crash their fs by
    just making a snapshot and asking it to inherit from an invalid qgroup. For
    example:

    $ btrfs sub snap -i 1/10 /btrfs/ /btrfs/foo

    Will cause a transaction abort.

    Fix this by only throwing errors in btrfs_qgroup_inherit() when we know
    going readonly is acceptable.

    The following xfstests test case reproduces this bug:

    seq=`basename $0`
    seqres=$RESULT_DIR/$seq
    echo "QA output created by $seq"

    here=`pwd`
    tmp=/tmp/$$
    status=1 # failure is the default!
    trap "_cleanup; exit \$status" 0 1 2 3 15

    _cleanup()
    {
    cd /
    rm -f $tmp.*
    }

    # get standard environment, filters and checks
    . ./common/rc
    . ./common/filter

    # remove previous $seqres.full before test
    rm -f $seqres.full

    # real QA test starts here
    _supported_fs btrfs
    _supported_os Linux
    _require_scratch

    rm -f $seqres.full

    _scratch_mkfs
    _scratch_mount
    _run_btrfs_util_prog quota enable $SCRATCH_MNT
    # The qgroup '1/10' does not exist and should be silently ignored
    _run_btrfs_util_prog subvolume snapshot -i 1/10 $SCRATCH_MNT $SCRATCH_MNT/snap1

    _scratch_unmount

    echo "Silence is golden"

    status=0
    exit

    Signed-off-by: Mark Fasheh
    Reviewed-by: Qu Wenruo
    Signed-off-by: David Sterba

    Mark Fasheh
     
  • As one user in mail list report reproducible balance ENOSPC error, it's
    better to add more debug info for enospc_debug mount option.

    Reported-by: Marc Haber
    Signed-off-by: Qu Wenruo
    Signed-off-by: David Sterba

    Qu Wenruo
     
  • Dan Carpenter's static checker has found this error, it's introduced by
    commit 64c043de466d
    ("Btrfs: fix up read_tree_block to return proper error")

    It's really supposed to 'break' the loop on error like others.

    Cc: Dan Carpenter
    Reported-by: Dan Carpenter
    Signed-off-by: Liu Bo
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba

    Liu Bo
     
  • - We call inode_size_ok() only if FL_KEEP_SIZE isn't specified.
    - As an optimisation we can skip the call if (off + len)
    isn't greater than the current size of the file. This operation
    is called under the lock so the less work we do, the better.
    - If we call inode_size_ok() pass to it the correct value rather
    than a more conservative estimation.

    Signed-off-by: Davide Italiano
    Reviewed-by: Liu Bo
    Reviewed-by: David Sterba
    Signed-off-by: David Sterba

    Davide Italiano
     
  • Previously, ext4 would fail the mount if the file system had the quota
    feature enabled and quota mount options (used for the older quota
    setups) were present. This broke xfstests, since xfs silently ignores
    the usrquote and grpquota mount options if they are specified. This
    commit changes things so that we are consistent with xfs; having the
    mount options specified is harmless, so no sense break users by
    forbidding them.

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

    Theodore Ts'o
     

03 Apr, 2016

1 commit


02 Apr, 2016

2 commits