24 Dec, 2010

3 commits


23 Dec, 2010

2 commits

  • This happens when __logfs_create() tries to write a new inode to the disk
    which is full.

    __logfs_create() associates the transaction pointer with inode. During
    the logfs_write_inode() function call chain this transaction pointer is
    moved from inode to page->private using function move_inode_to_page
    (do_write_inode() -> inode_to_page() -> move_inode_to_page)

    When the write inode fails, the transaction is aborted and iput is called
    on the failed inode. During delete_inode the same transaction pointer
    associated with the page is getting used. Thus causing kernel BUG.

    The patch checks for error in write_inode() and restores the page->private
    to NULL.

    Addresses https://bugzilla.kernel.org/show_bug.cgi?id=20162

    Signed-off-by: Prasad Joshi
    Cc: Joern Engel
    Cc: Florian Mickler
    Cc: "Rafael J. Wysocki"
    Cc: Maciej Rutecki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Prasad Joshi
     
  • do_logfs_journal_wl_pass() should use GFP_NOFS for memory allocation GC
    code calls btree_insert32 with GFP_KERNEL while holding a mutex
    super->s_write_mutex.

    The same mutex is used in address_space_operations->writepage(), and a
    call to writepage() could be triggered as a result of memory allocation
    in btree_insert32, causing a deadlock.

    Addresses https://bugzilla.kernel.org/show_bug.cgi?id=20342

    Signed-off-by: Prasad Joshi
    Cc: Joern Engel
    Cc: Florian Mickler
    Cc: "Rafael J. Wysocki"
    Cc: Maciej Rutecki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Prasad Joshi
     

22 Dec, 2010

1 commit

  • When we store system inodes cache in ocfs2_super,
    we use a array for global system inodes. But unfortunately,
    the range is calculated wrongly which makes it overflow and
    pollute ocfs2_super->local_system_inodes.
    This patch fix it by setting the range properly.

    The corresponding bug is ossbug1303.
    http://oss.oracle.com/bugzilla/show_bug.cgi?id=1303

    Cc: stable@kernel.org
    Signed-off-by: Tao Ma
    Signed-off-by: Joel Becker

    Tao Ma
     

21 Dec, 2010

2 commits


18 Dec, 2010

2 commits


17 Dec, 2010

1 commit

  • * 'for-linus' of git://git.infradead.org/users/eparis/notify:
    fanotify: fill in the metadata_len field on struct fanotify_event_metadata
    fanotify: split version into version and metadata_len
    fanotify: Dont try to open a file descriptor for the overflow event
    fanotify: Introduce FAN_NOFD
    fanotify: do not leak user reference on allocation failure
    inotify: stop kernel memory leak on file creation failure
    fanotify: on group destroy allow all waiters to bypass permission check
    fanotify: Dont allow a mask of 0 if setting or removing a mark
    fanotify: correct broken ref counting in case adding a mark failed
    fanotify: if set by user unset FMODE_NONOTIFY before fsnotify_perm() is called
    fanotify: remove packed from access response message
    fanotify: deny permissions when no event was sent

    Linus Torvalds
     

16 Dec, 2010

7 commits

  • When we set/clear the dyn_features for an inode we hold the ip_lock.
    So do it when we set/clear OCFS2_INDEXED_DIR_FL also.

    Signed-off-by: Tao Ma
    Signed-off-by: Joel Becker

    Tao Ma
     
  • Two masklogs had the same flag value.

    Signed-off-by: Sunil Mushran
    Signed-off-by: Joel Becker

    Sunil Mushran
     
  • On 2.6.37-rc1, garbage collection ioctl of nilfs was broken due to the
    commit 263d90cefc7d82a0 ("nilfs2: remove own inode hash used for GC"),
    and leading to filesystem corruption.

    The patch doesn't queue gc-inodes for log writer if they are reused
    through the vfs inode cache. Here, gc-inode is the inode which
    buffers blocks to be relocated on GC. That patch queues gc-inodes in
    nilfs_init_gcinode() function, but this function is not called when
    they don't have I_NEW flag. Thus, some of live blocks are wrongly
    overrode without being moved to new logs.

    This resolves the problem by moving the gc-inode queueing to an outer
    function to ensure it's done right.

    Signed-off-by: Ryusuke Konishi

    Ryusuke Konishi
     
  • The user buffer may be 512-byte aligned, not page-aligned. We were
    assuming the buffer was page-aligned and only accounting for
    non-page-aligned io offsets.

    Signed-off-by: Henry C Chang
    Signed-off-by: Sage Weil

    Henry C Chang
     
  • * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    ext4: fix typo which broke '..' detection in ext4_find_entry()
    ext4: Turn off multiple page-io submission by default

    Linus Torvalds
     
  • The install_special_mapping routine (used, for example, to setup the
    vdso) skips the security check before insert_vm_struct, allowing a local
    attacker to bypass the mmap_min_addr security restriction by limiting
    the available pages for special mappings.

    bprm_mm_init() also skips the check, and although I don't think this can
    be used to bypass any restrictions, I don't see any reason not to have
    the security check.

    $ uname -m
    x86_64
    $ cat /proc/sys/vm/mmap_min_addr
    65536
    $ cat install_special_mapping.s
    section .bss
    resb BSS_SIZE
    section .text
    global _start
    _start:
    mov eax, __NR_pause
    int 0x80
    $ nasm -D__NR_pause=29 -DBSS_SIZE=0xfffed000 -f elf -o install_special_mapping.o install_special_mapping.s
    $ ld -m elf_i386 -Ttext=0x10000 -Tbss=0x11000 -o install_special_mapping install_special_mapping.o
    $ ./install_special_mapping &
    [1] 14303
    $ cat /proc/14303/maps
    0000f000-00010000 r-xp 00000000 00:00 0 [vdso]
    00010000-00011000 r-xp 00001000 00:19 2453665 /home/taviso/install_special_mapping
    00011000-ffffe000 rwxp 00000000 00:00 0 [stack]

    It's worth noting that Red Hat are shipping with mmap_min_addr set to
    4096.

    Signed-off-by: Tavis Ormandy
    Acked-by: Kees Cook
    Acked-by: Robert Swiecki
    [ Changed to not drop the error code - akpm ]
    Reviewed-by: James Morris
    Signed-off-by: Linus Torvalds

    Tavis Ormandy
     
  • The fanotify_event_metadata now has a field which is supposed to
    indicate the length of the metadata portion of the event. Fill in that
    field as well.

    Based-in-part-on-patch-by: Alexey Zaytsev
    Signed-off-by: Eric Paris

    Eric Paris
     

15 Dec, 2010

9 commits

  • There should be a check for the NUL character instead of '0'.

    Fortunately the only thing that cares about this is NFS serving, which
    is why we didn't notice this in the merge window testing.

    Reported-by: Phil Carmody
    Signed-off-by: Aaro Koskinen
    Signed-off-by: "Theodore Ts'o"

    Aaro Koskinen
     
  • Jon Nelson has found a test case which causes postgresql to fail with
    the error:

    psql:t.sql:4: ERROR: invalid page header in block 38269 of relation base/16384/16581

    Under memory pressure, it looks like part of a file can end up getting
    replaced by zero's. Until we can figure out the cause, we'll roll
    back the change and use block_write_full_page() instead of
    ext4_bio_write_page(). The new, more efficient writing function can
    be used via the mount option mblk_io_submit, so we can test and fix
    the new page I/O code.

    To reproduce the problem, install postgres 8.4 or 9.0, and pin enough
    memory such that the system just at the end of triggering writeback
    before running the following sql script:

    begin;
    create temporary table foo as select x as a, ARRAY[x] as b FROM
    generate_series(1, 10000000 ) AS x;
    create index foo_a_idx on foo (a);
    create index foo_b_idx on foo USING GIN (b);
    rollback;

    If the temporary table is created on a hard drive partition which is
    encrypted using dm_crypt, then under memory pressure, approximately
    30-40% of the time, pgsql will issue the above failure.

    This patch should fix this problem, and the problem will come back if
    the file system is mounted with the mblk_io_submit mount option.

    Reported-by: Jon Nelson
    Signed-off-by: "Theodore Ts'o"

    Theodore Ts'o
     
  • * 'for-2.6.37' of git://linux-nfs.org/~bfields/linux:
    nfsd: Fix possible BUG_ON firing in set_change_info
    sunrpc: prevent use-after-free on clearing XPT_BUSY

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
    Btrfs: prevent RAID level downgrades when space is low
    Btrfs: account for missing devices in RAID allocation profiles
    Btrfs: EIO when we fail to read tree roots
    Btrfs: fix compiler warnings
    Btrfs: Make async snapshot ioctl more generic
    Btrfs: pwrite blocked when writing from the mmaped buffer of the same page
    Btrfs: Fix a crash when mounting a subvolume
    Btrfs: fix sync subvol/snapshot creation
    Btrfs: Fix page leak in compressed writeback path
    Btrfs: do not BUG if we fail to remove the orphan item for dead snapshots
    Btrfs: fixup return code for btrfs_del_orphan_item
    Btrfs: do not do fast caching if we are allocating blocks for tree_root
    Btrfs: deal with space cache errors better
    Btrfs: fix use after free in O_DIRECT

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
    fuse: verify ioctl retries
    fuse: fix ioctl when server is 32bit

    Linus Torvalds
     
  • * 'for-linus' of git://oss.sgi.com/xfs/xfs:
    xfs: log timestamp changes to the source inode in rename

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
    ceph: fix ioctl magic
    ceph: Behave better when handling file lock replies.
    ceph: pass lock information by struct file_lock instead of as individual params.
    ceph: Handle file locks in replies from the MDS.
    ceph: avoid possible null deref in readdir after dir llseek

    Linus Torvalds
     
  • * 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
    NFS: Fix panic after nfs_umount()
    nfs: remove extraneous and problematic calls to nfs_clear_request
    nfs: kernel should return EPROTONOSUPPORT when not support NFSv4
    NFS: Fix fcntl F_GETLK not reporting some conflicts
    nfs: Discard ACL cache on mode update
    NFS: Readdir cleanups
    NFS: nfs_readdir_search_for_cookie() don't mark as eof if cookie not found
    NFS: Fix a memory leak in nfs_readdir
    Call the filesystem back whenever a page is removed from the page cache
    NFS: Ensure we use the correct cookie in nfs_readdir_xdr_filler

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
    cifs: remove bogus remapping of error in cifs_filldir()
    cifs: allow calling cifs_build_path_to_root on incomplete cifs_sb
    cifs: fix check of error return from is_path_accessable
    cifs: remove Local_System_Name
    cifs: fix use of CONFIG_CIFS_ACL
    cifs: add attribute cache timeout (actimeo) tunable

    Linus Torvalds
     

14 Dec, 2010

3 commits

  • The extent allocator has code that allows us to fill
    allocations from any available block group, even if it doesn't
    match the raid level we've requested.

    This was put in because adding a new drive to a filesystem
    made with the default mkfs options actually upgrades the metadata from
    single spindle dup to full RAID1.

    But, the code also allows us to allocate from a raid0 chunk when we
    really want a raid1 or raid10 chunk. This can cause big trouble because
    mkfs creates a small (4MB) raid0 chunk for data and metadata which then
    goes unused for raid1/raid10 installs.

    The allocator will happily wander in and allocate from that chunk when
    things get tight, which is not correct.

    The fix here is to make sure that we provide duplication when the
    caller has asked for it. It does all the dups to be any raid level,
    which preserves the dup->raid1 upgrade abilities.

    Signed-off-by: Chris Mason

    Chris Mason
     
  • When we mount in RAID degraded mode without adding a new device to
    replace the failed one, we can end up using the wrong RAID flags for
    allocations.

    This results in strange combinations of block groups (raid1 in a raid10
    filesystem) and corruptions when we try to allocate blocks from single
    spindle chunks on drives that are actually missing.

    The first device has two small 4MB chunks in it that mkfs creates and
    these are usually unused in a raid1 or raid10 setup. But, in -o degraded,
    the allocator will fall back to these because the mask of desired raid groups
    isn't correct.

    The fix here is to count the missing devices as we build up the list
    of devices in the system. This count is used when picking the
    raid level to make sure we continue using the same levels that were
    in place before we lost a drive.

    Signed-off-by: Chris Mason

    Chris Mason
     
  • If we just get a plain IO error when we read tree roots, the code
    wasn't properly sending that error up the chain. This allowed mounts to
    continue when they should failed, and allowed operations
    on partially setup root structs. The end result was usually oopsen
    on spinlocks that hadn't been spun up correctly.

    Signed-off-by: Chris Mason

    Chris Mason
     

11 Dec, 2010

8 commits

  • ... regarding an unused function when !MIGRATION, and regarding a
    printk() format string vs argument mismatch.

    Signed-off-by: Jan Beulich
    Signed-off-by: Chris Mason

    Jan Beulich
     
  • If we had reserved some bytes in struct btrfs_ioctl_vol_args, we
    wouldn't have to create a new structure for async snapshot creation.

    Here we convert async snapshot ioctl to use a more generic ABI, as
    we'll add more ioctls for snapshots/subvolumes in the future, readonly
    snapshots for example.

    Signed-off-by: Li Zefan
    Signed-off-by: Chris Mason

    Li Zefan
     
  • This problem is found in meego testing:
    http://bugs.meego.com/show_bug.cgi?id=6672
    A file in btrfs is mmaped and the mmaped buffer is passed to pwrite to write to the same page
    of the same file. In btrfs_file_aio_write(), the pages is locked by prepare_pages(). So when
    btrfs_copy_from_user() is called, page fault happens and the same page needs to be locked again
    in filemap_fault(). The fix is to move iov_iter_fault_in_readable() before prepage_pages() to make page
    fault happen before pages are locked. And also disable page fault in critical region in
    btrfs_copy_from_user().

    Reviewed-by: Yan, Zheng
    Signed-off-by: Zhong, Xin
    Signed-off-by: Chris Mason

    Xin Zhong
     
  • We should drop dentry before deactivating the superblock, otherwise
    we can hit this bug:

    BUG: Dentry f349a690{i=100,n=/} still in use (1) [unmount of btrfs loop1]
    ...

    Steps to reproduce the bug:

    # mount /dev/loop1 /mnt
    # mkdir save
    # btrfs subvolume snapshot /mnt save/snap1
    # umount /mnt
    # mount -o subvol=save/snap1 /dev/loop1 /mnt
    (crash)

    Reported-by: Michael Niederle
    Signed-off-by: Li Zefan
    Signed-off-by: Chris Mason

    Li Zefan
     
  • We were incorrectly taking the async path even for the sync ioctls by
    passing in &transid unconditionally.

    There's ample room for further cleanup here, but this keeps the fix simple.

    Signed-off-by: Sage Weil
    Reviewed-by: Li Zefan
    Signed-off-by: Chris Mason

    Sage Weil
     
  • "start + num_bytes >= actual_end" can happen when compressed page writeback races
    with file truncation. In that case we need unlock and release pages past the end
    of file.

    Signed-off-by: Yan, Zheng
    Signed-off-by: Chris Mason

    Yan, Zheng
     
  • Not being able to delete an orphan item isn't a horrible thing. The worst that
    happens is the next time around we try and do the orphan cleanup and we can't
    find the referenced object and just delete the item and move on.

    Signed-off-by: Josef Bacik

    Josef Bacik
     
  • After a few unsuccessful NFS mount attempts in which the client and
    server cannot agree on an authentication flavor both support, the
    client panics. nfs_umount() is invoked in the kernel in this case.

    Turns out nfs_umount()'s UMNT RPC invocation causes the RPC client to
    write off the end of the rpc_clnt's iostat array. This is because the
    mount client's nrprocs field is initialized with the count of defined
    procedures (two: MNT and UMNT), rather than the size of the client's
    proc array (four).

    The fix is to use the same initialization technique used by most other
    upper layer clients in the kernel.

    Introduced by commit 0b524123, which failed to update nrprocs when
    support was added for UMNT in the kernel.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=24302
    BugLink: http://bugs.launchpad.net/bugs/683938

    Reported-by: Stefan Bader
    Tested-by: Stefan Bader
    Cc: stable@kernel.org # >= 2.6.32
    Signed-off-by: Chuck Lever
    Signed-off-by: Trond Myklebust

    Chuck Lever
     

10 Dec, 2010

2 commits

  • Due to newly-introduced 'coherency=full' O_DIRECT writes also takes the EX
    rw_lock like buffered writes did(rw_level == 1), it turns out messing the
    usage of 'level' in ocfs2_dio_end_io() up, which caused i_alloc_sem being
    failed to get up_read'd correctly.

    This patch tries to teach ocfs2_dio_end_io to understand well on all locking
    stuffs by explicitly introducing a new bit for i_alloc_sem in iocb's private
    data, just like what we did for rw_lock.

    Signed-off-by: Tristan Ye
    Signed-off-by: Joel Becker

    Tristan Ye
     
  • o2dlm was not migrating resources with zero locks because it assumed that that
    resource would get purged by dlm_thread. However, some usage patterns involve
    creating and dropping locks at a high rate leading to the migrate thread seeing
    zero locks but the purge thread seeing an active reference. When this happens,
    the dlm_thread cannot purge the resource and the migrate thread sees no reason
    to migrate that resource. The spell is broken when the migrate thread catches
    the resource with a lock.

    The fix is to make the migrate thread also consider the reference map.

    This usage pattern can be triggered by userspace on userdlm locks and flocks.

    Signed-off-by: Sunil Mushran
    Signed-off-by: Joel Becker

    Sunil Mushran