1. 14 4月, 2014 3 次提交
    • D
      xfs: write failure beyond EOF truncates too much data · 72ab70a1
      Dave Chinner 提交于
      If we fail a write beyond EOF and have to handle it in
      xfs_vm_write_begin(), we truncate the inode back to the current inode
      size. This doesn't take into account the fact that we may have
      already made successful writes to the same page (in the case of block
      size < page size) and hence we can truncate the page cache away from
      blocks with valid data in them. If these blocks are delayed
      allocation blocks, we now have a mismatch between the page cache and
      the extent tree, and this will trigger - at minimum - a delayed
      block count mismatch assert when the inode is evicted from the cache.
      We can also trip over it when block mapping for direct IO - this is
      the most common symptom seen from fsx and fsstress when run from
      xfstests.
      
      Fix it by only truncating away the exact range we are updating state
      for in this write_begin call.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Tested-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      72ab70a1
    • D
      xfs: kill buffers over failed write ranges properly · 4ab9ed57
      Dave Chinner 提交于
      When a write fails, if we don't clear the delalloc flags from the
      buffers over the failed range, they can persist beyond EOF and cause
      problems. writeback will see the pages in the page cache, see they
      are dirty and continually retry the write, assuming that the page
      beyond EOF is just racing with a truncate. The page will eventually
      be released due to some other operation (e.g. direct IO), and it
      will not pass through invalidation because it is dirty. Hence it
      will be released with buffer_delay set on it, and trigger warnings
      in xfs_vm_releasepage() and assert fail in xfs_file_aio_write_direct
      because invalidation failed and we didn't write the corect amount.
      
      This causes failures on block size < page size filesystems in fsx
      and fsstress workloads run by xfstests.
      
      Fix it by completely trashing any state on the buffer that could be
      used to imply that it contains valid data when the delalloc range
      over the buffer is punched out during the failed write handling.
      Signed-off-by: NDave Chinner <dchinner@redhat.com>
      Tested-by: NBrian Foster <bfoster@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NDave Chinner <david@fromorbit.com>
      4ab9ed57
    • G
      cifs: Use min_t() when comparing "size_t" and "unsigned long" · e686bd8d
      Geert Uytterhoeven 提交于
      On 32 bit, size_t is "unsigned int", not "unsigned long", causing the
      following warning when comparing with PAGE_SIZE, which is always "unsigned
      long":
      
        fs/cifs/file.c: In function ‘cifs_readdata_to_iov’:
        fs/cifs/file.c:2757: warning: comparison of distinct pointer types lacks a cast
      
      Introduced by commit 7f25bba8 ("cifs_iovec_read: keep iov_iter
      between the calls of cifs_readdata_to_iov()"), which changed the
      signedness of "remaining" and the code from min_t() to min().
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e686bd8d
  2. 13 4月, 2014 1 次提交
    • L
      ceph: fix pr_fmt() redefinition · 96c57ade
      Linus Torvalds 提交于
      The vfs merge caused a latent bug to show up:
      
         In file included from fs/ceph/super.h:4:0,
                          from fs/ceph/ioctl.c:3:
         include/linux/ceph/ceph_debug.h:4:0: warning: "pr_fmt" redefined [enabled by default]
          #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
          ^
         In file included from include/linux/kernel.h:13:0,
                          from include/linux/uio.h:12,
                          from include/linux/socket.h:7,
                          from include/uapi/linux/in.h:22,
                          from include/linux/in.h:23,
                          from fs/ceph/ioctl.c:1:
         include/linux/printk.h:214:0: note: this is the location of the previous definition
          #define pr_fmt(fmt) fmt
          ^
      
      where the reason is that <linux/ceph_debug.h> is included much too late
      for the "pr_fmt()" define.
      
      The include of <linux/ceph_debug.h> needs to be the first include in the
      file, but fs/ceph/ioctl.c had for some reason missed that, and it wasn't
      noticeable until some unrelated header file changes brought in an
      indirect earlier include of <linux/kernel.h>.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      96c57ade
  3. 12 4月, 2014 3 次提交
    • A
      cifs: fix the race in cifs_writev() · 19dfc1f5
      Al Viro 提交于
      O_APPEND handling there hadn't been completely fixed by Pavel's
      patch; it checks the right value, but it's racy - we can't really
      do that until i_mutex has been taken.
      
      Fix by switching to __generic_file_aio_write() (open-coding
      generic_file_aio_write(), actually) and pulling mutex_lock() above
      inode_size_read().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      19dfc1f5
    • A
      ceph_sync_{,direct_}write: fix an oops on ceph_osdc_new_request() failure · eab87235
      Al Viro 提交于
      ceph_osdc_put_request(ERR_PTR(-error)) oopses.  What we want there
      is break, not goto out.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      eab87235
    • D
      net: Fix use after free by removing length arg from sk_data_ready callbacks. · 676d2369
      David S. Miller 提交于
      Several spots in the kernel perform a sequence like:
      
      	skb_queue_tail(&sk->s_receive_queue, skb);
      	sk->sk_data_ready(sk, skb->len);
      
      But at the moment we place the SKB onto the socket receive queue it
      can be consumed and freed up.  So this skb->len access is potentially
      to freed up memory.
      
      Furthermore, the skb->len can be modified by the consumer so it is
      possible that the value isn't accurate.
      
      And finally, no actual implementation of this callback actually uses
      the length argument.  And since nobody actually cared about it's
      value, lots of call sites pass arbitrary values in such as '0' and
      even '1'.
      
      So just remove the length argument from the callback, that way there
      is no confusion whatsoever and all of these use-after-free cases get
      fixed as a side effect.
      
      Based upon a patch by Eric Dumazet and his suggestion to audit this
      issue tree-wide.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      676d2369
  4. 11 4月, 2014 2 次提交
    • W
      Btrfs: fix compile warnings on on avr32 platform · e4fbaee2
      Wang Shilong 提交于
      fs/btrfs/scrub.c: In function 'get_raid56_logic_offset':
      fs/btrfs/scrub.c:2269: warning: comparison of distinct pointer types lacks a cast
      fs/btrfs/scrub.c:2269: warning: right shift count >= width of type
      fs/btrfs/scrub.c:2269: warning: passing argument 1 of '__div64_32' from incompatible pointer type
      
      Since @rot is an int type, we should not use do_div(), fix it.
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NWang Shilong <wangsl.fnst@cn.fujitsu.com>
      Signed-off-by: NChris Mason <clm@fb.com>
      e4fbaee2
    • H
      btrfs: allow mounting btrfs subvolumes with different ro/rw options · 0723a047
      Harald Hoyer 提交于
      Given the following /etc/fstab entries:
      
      /dev/sda3 /mnt/foo btrfs subvol=foo,ro 0 0
      /dev/sda3 /mnt/bar btrfs subvol=bar,rw 0 0
      
      you can't issue:
      
      $ mount /mnt/foo
      $ mount /mnt/bar
      
      You would have to do:
      
      $ mount /mnt/foo
      $ mount -o remount,rw /mnt/foo
      $ mount --bind -o remount,ro /mnt/foo
      $ mount /mnt/bar
      
      or
      
      $ mount /mnt/bar
      $ mount --rw /mnt/foo
      $ mount --bind -o remount,ro /mnt/foo
      
      With this patch you can do
      
      $ mount /mnt/foo
      $ mount /mnt/bar
      
      $ cat /proc/self/mountinfo
      49 33 0:41 /foo /mnt/foo ro,relatime shared:36 - btrfs /dev/sda3 rw,ssd,space_cache
      87 33 0:41 /bar /mnt/bar rw,relatime shared:74 - btrfs /dev/sda3 rw,ssd,space_cache
      Signed-off-by: NChris Mason <clm@fb.com>
      0723a047
  5. 09 4月, 2014 9 次提交
  6. 08 4月, 2014 22 次提交