17 Feb, 2010

1 commit

  • There is currently a bug in sysfs_sd_setattr inherited from
    sysfs_setattr in 2.6.32 where the first time we set the attributes
    on a sysfs file we allocate backing store but do not set the
    backing store attributes. Resulting in overly restrictive
    permissions on sysfs files.

    The fix is to simply modify the code so that it always executes
    when we update the sysfs attributes, as we did in 2.6.31 and earlier.

    Signed-off-by: Eric W. Biederman
    Tested-by: Jean Delvare
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     

16 Feb, 2010

3 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
    Btrfs: btrfs_mark_extent_written uses the wrong slot

    Linus Torvalds
     
  • The cached read and write paths initialize fattr->time_start in their
    setup procedures. The value of fattr->time_start is propagated to
    read_cache_jiffies by nfs_update_inode(). Subsequent calls to
    nfs_attribute_timeout() will then use a good time stamp when
    computing the attribute cache timeout, and squelch unneeded GETATTR
    calls.

    Since the direct I/O paths erroneously leave the inode's
    fattr->time_start field set to zero, read_cache_jiffies for that inode
    is set to zero after any direct read or write operation. This
    triggers an otw GETATTR or ACCESS call to update the file's attribute
    and access caches properly, even when the NFS READ or WRITE replies
    have usable post-op attributes.

    Make sure the direct read and write setup code performs the same fattr
    initialization as the cached I/O paths to prevent unnecessary GETATTR
    calls.

    This was likely introduced by commit 0e574af1 in 2.6.15, which appears
    to add new nfs_fattr_init() call sites in the cached read and write
    paths, but not in the equivalent places in fs/nfs/direct.c. A
    subsequent commit in the same series, 33801147, introduces the
    fattr->time_start field.

    Interestingly, the direct write reschedule path already has a call to
    nfs_fattr_init() in the right place.

    Reported-by: Quentin Barnes
    Signed-off-by: Chuck Lever
    Cc: stable@kernel.org
    Signed-off-by: Trond Myklebust
    Signed-off-by: Linus Torvalds

    Chuck Lever
     
  • …t/frederic/random-tracing

    * 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
    reiserfs: Fix softlockup while waiting on an inode

    Linus Torvalds
     

15 Feb, 2010

1 commit

  • When we wait for an inode through reiserfs_iget(), we hold
    the reiserfs lock. And waiting for an inode may imply waiting
    for its writeback. But the inode writeback path may also require
    the reiserfs lock, which leads to a deadlock.

    We just need to release the reiserfs lock from reiserfs_iget()
    to fix this.

    Reported-by: Alexander Beregalov
    Signed-off-by: Frederic Weisbecker
    Tested-by: Christian Kujau
    Cc: Chris Mason

    Frederic Weisbecker
     

13 Feb, 2010

1 commit

  • My test do: fallocate a big file and do write. The file is 512M, but
    after file write is done btrfs-debug-tree shows:
    item 6 key (257 EXTENT_DATA 0) itemoff 3516 itemsize 53
    extent data disk byte 1103101952 nr 536870912
    extent data offset 0 nr 399634432 ram 536870912
    extent compression 0
    Looks like a regression introducted by
    6c7d54ac87f338c479d9729e8392eca3f76e11e1, where we set wrong slot.

    Signed-off-by: Shaohua Li
    Acked-by: Yan Zheng
    Signed-off-by: Chris Mason

    Shaohua Li
     

12 Feb, 2010

6 commits

  • This patch solves a corner case during allocation which occurs if both
    metadata (indirect) and data blocks are required but there is an
    obstacle in the filesystem (e.g. a resource group header or another
    allocated block) such that when the allocation is requested only
    enough blocks for the metadata are returned.

    By changing the exit condition of this loop, we ensure that a
    minimum of one data block will always be returned.

    Signed-off-by: Steven Whitehouse

    Steven Whitehouse
     
  • We need this one-liner to signal the mount helper of the 'insufficient journals' condition.

    Signed-off-by: Abhijith Das
    Signed-off-by: Steven Whitehouse

    Abhijith Das
     
  • * 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
    NFS: Fix the mapping of the NFSERR_SERVERFAULT error
    NFS: Remove a redundant check for PageFsCache in nfs_migrate_page()
    NFS: Fix a bug in nfs_fscache_release_page()

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
    [SCSI] qla2xxx: Obtain proper host structure during response-queue processing.
    [SCSI] compat_ioct: fix bsg SG_IO
    [SCSI] qla2xxx: make msix interrupt handler safe for irq
    [SCSI] zfcp: Report FC BSG errors in correct field
    [SCSI] mptfusion : mptscsih_abort return value should be SUCCESS instead of value 0.

    Linus Torvalds
     
  • When reserving stack space for a new process, make sure we're not
    attempting to expand the stack by more than rlimit allows.

    This fixes a bug caused by b6a2fea39318e43fee84fa7b0b90d68bed92d2ba ("mm:
    variable length argument support") and unmasked by
    fc63cf237078c86214abcb2ee9926d8ad289da9b ("exec: setup_arg_pages() fails
    to return errors").

    This bug means that when limiting the stack to less the 20*PAGE_SIZE (eg.
    80K on 4K pages or 'ulimit -s 79') all processes will be killed before
    they start. This is particularly bad with 64K pages, where a ulimit below
    1280K will kill every process.

    To test, do:

    'ulimit -s 15; ls'

    before and after the patch is applied. Before it's applied, 'ls' should
    be killed. After the patch is applied, 'ls' should no longer be killed.

    A stack limit of 15KB since it's small enough to trigger 20*PAGE_SIZE.
    Also 15KB not a multiple of PAGE_SIZE, which is a trickier case to handle
    correctly with this code.

    4K pages should be fine to test with.

    [kosaki.motohiro@jp.fujitsu.com: cleanup]
    [akpm@linux-foundation.org: cleanup cleanup]
    Signed-off-by: Michael Neuling
    Signed-off-by: KOSAKI Motohiro
    Cc: Americo Wang
    Cc: Anton Blanchard
    Cc: Oleg Nesterov
    Cc: James Morris
    Cc: Ingo Molnar
    Cc: Serge Hallyn
    Cc: Benjamin Herrenschmidt
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Neuling
     
  • This is used by tcgetsid(3).

    Signed-off-by: Andreas Schwab
    Cc: Alan Cox
    Acked-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andreas Schwab
     

10 Feb, 2010

6 commits


09 Feb, 2010

11 commits

  • * 'for-2.6.33' of git://linux-nfs.org/~bfields/linux:
    Revert "nfsd4: fix error return when pseudoroot missing"

    Linus Torvalds
     
  • * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2:
    ocfs2/cluster: Make o2net connect messages KERN_NOTICE
    ocfs2/dlm: Fix printing of lockname
    ocfs2: Fix contiguousness check in ocfs2_try_to_merge_extent_map()
    ocfs2/dlm: Remove BUG_ON in dlm recovery when freeing locks of a dead node
    ocfs2: Plugs race between the dc thread and an unlock ast message
    ocfs2: Remove overzealous BUG_ON during blocked lock processing
    ocfs2: Do not downconvert if the lock level is already compatible
    ocfs2: Prevent a livelock in dlmglue
    ocfs2: Fix setting of OCFS2_LOCK_BLOCKED during bast
    ocfs2: Use compat_ptr in reflink_arguments.
    ocfs2/dlm: Handle EAGAIN for compatibility - v2
    ocfs2: Add parenthesis to wrap the check for O_DIRECT.
    ocfs2: Only bug out when page size is larger than cluster size.
    ocfs2: Fix memory overflow in cow_by_page.
    ocfs2/dlm: Print more messages during lock migration
    ocfs2/dlm: Ignore LVBs of locks in the Blocked list
    ocfs2/trivial: Remove trailing whitespaces
    ocfs2: fix a misleading variable name
    ocfs2: Sync max_inline_data_with_xattr from tools.
    ocfs2: Fix refcnt leak on ocfs2_fast_follow_link() error path

    Linus Torvalds
     
  • If match_strdup() fail this function exits without freeing the options string.

    Signed-off-by: Venkateswararao Jujjuri
    Sigend-off-by: Eric Van Hensbergen

    Eric Van Hensbergen
     
  • Options pointer is being moved before calling kfree() which seems
    to cause problems. This uses a separate pointer to track and free
    original allocation.

    Signed-off-by: Venkateswararao Jujjuri
    Signed-off-by: Eric Van Hensbergen w

    Eric Van Hensbergen
     
  • Implement the fsync in the client side by marking stat field values to 'don't touch' so that server may
    interpret it as a request to guarantee that the contents of the associated file are committed to stable
    storage before the Rwstat message is returned.

    Without this patch, calling fsync on a 9p file results in "Invalid argument" error. Please check the attached
    C program.

    Signed-off-by: Aneesh Kumar K.V
    Signed-off-by: M. Mohan Kumar
    Acked-by: Venkateswararao Jujjuri (JV)
    Signed-off-by: Eric Van Hensbergen

    M. Mohan Kumar
     
  • Connect and disconnect messages are more than informational as they are required
    during root cause analysis for failures. This patch changes them from KERN_INFO
    to KERN_NOTICE.

    Signed-off-by: Sunil Mushran
    Acked-by: Mark Faseh
    Signed-off-by: Joel Becker

    Sunil Mushran
     
  • The debug call printing the name of the lock resource was chopping
    off the last character. This patch fixes the problem.

    Signed-off-by: Sunil Mushran
    Acked-by: Mark Fasheh
    Signed-off-by: Joel Becker

    Sunil Mushran
     
  • Commit f39bde24b275ddc45d fixed the error return from PUTROOTFH in the
    case where there is no pseudofilesystem.

    This is really a case we shouldn't hit on a correctly configured server:
    in the absence of a root filehandle, there's no point accepting version
    4 NFS rpc calls at all.

    But the shared responsibility between kernel and userspace here means
    the kernel on its own can't eliminate the possiblity of this happening.
    And we have indeed gotten this wrong in distro's, so new client-side
    mount code that attempts to negotiate v4 by default first has to work
    around this case.

    Therefore when commit f39bde24b275ddc45d arrived at roughly the same
    time as the new v4-default mount code, which explicitly checked only for
    the previous error, the result was previously fine mounts suddenly
    failing.

    We'll fix both sides for now: revert the error change, and make the
    client-side mount workaround more robust.

    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     
  • bsg's SG_IO doesn't work on 32-bit userspace and 64-bit kernelspace.

    The problem is that both sg and bsg drivers use SG_IO
    ioctl. sg_ioctl_trans() does 32/64-bit conversion even against bsg
    header. It messes up bsg header. bsg driver gets garbage.

    This patch fixes sg_ioctl_trans to handle only sg header (struct
    sg_io_hdr).

    Reported-by: Giridhar Malavali
    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     
  • case-insensitive mounts shouldn't use full_name_hash(). Make sure we
    use the parent dentry's d_hash routine when one is set.

    Reported-by: Dave Kleikamp
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • force revalidate of the file when any of the timestamps are set since
    some filesytem types do not have finer granularity timestamps and
    we can not always detect which file systems round timestamps down
    to determine whether we can cache the mtime on setattr
    samba bugzilla 3775

    Acked-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Steve French
     

08 Feb, 2010

2 commits

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
    Take ima_file_free() to proper place.
    ima: rename PATH_CHECK to FILE_CHECK
    ima: rename ima_path_check to ima_file_check
    ima: initialize ima before inodes can be allocated
    fix ima breakage
    Take ima_path_check() in nfsd past dentry_open() in nfsd_open()
    freeze_bdev: don't deactivate successfully frozen MS_RDONLY sb
    befs: fix leak

    Linus Torvalds
     
  • This reverts commit 703625118069 ("tty: fix race in tty_fasync") and
    commit b04da8bfdfbb ("fnctl: f_modown should call write_lock_irqsave/
    restore") that tried to fix up some of the fallout but was incomplete.

    It turns out that we really cannot hold 'tty->ctrl_lock' over calling
    __f_setown, because not only did that cause problems with interrupt
    disables (which the second commit fixed), it also causes a potential
    ABBA deadlock due to lock ordering.

    Thanks to Tetsuo Handa for following up on the issue, and running
    lockdep to show the problem. It goes roughly like this:

    - f_getown gets filp->f_owner.lock for reading without interrupts
    disabled, so an interrupt that happens while that lock is held can
    cause a lockdep chain from f_owner.lock -> sighand->siglock.

    - at the same time, the tty->ctrl_lock -> f_owner.lock chain that
    commit 703625118069 introduced, together with the pre-existing
    sighand->siglock -> tty->ctrl_lock chain means that we have a lock
    dependency the other way too.

    So instead of extending tty->ctrl_lock over the whole __f_setown() call,
    we now just take a reference to the 'pid' structure while holding the
    lock, and then release it after having done the __f_setown. That still
    guarantees that 'struct pid' won't go away from under us, which is all
    we really ever needed.

    Reported-and-tested-by: Tetsuo Handa
    Acked-by: Greg Kroah-Hartman
    Acked-by: Américo Wang
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

07 Feb, 2010

6 commits

  • Hooks: Just Say No.

    Signed-off-by: Al Viro

    Al Viro
     
  • ima_path_check actually deals with files! call it ima_file_check instead.

    Signed-off-by: Eric Paris
    Acked-by: Mimi Zohar
    Signed-off-by: Al Viro

    Mimi Zohar
     
  • The "Untangling ima mess, part 2 with counters" patch messed
    up the counters. Based on conversations with Al Viro, this patch
    streamlines ima_path_check() by removing the counter maintaince.
    The counters are now updated independently, from measuring the file,
    in __dentry_open() and alloc_file() by calling ima_counts_get().
    ima_path_check() is called from nfsd and do_filp_open().
    It also did not measure all files that should have been measured.
    Reason: ima_path_check() got bogus value passed as mask.
    [AV: mea culpa]
    [AV: add missing nfsd bits]

    Signed-off-by: Mimi Zohar
    Signed-off-by: Al Viro

    Mimi Zohar
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Thanks Thomas and Christoph for testing and review.
    I removed 'smp_wmb()' before up_write from the previous patch,
    since up_write() should have necessary ordering constraints.
    (I.e. the change of s_frozen is visible to others after up_write)
    I'm quite sure the change is harmless but if you are uncomfortable
    with Tested-by/Reviewed-by on the modified patch, please remove them.

    If MS_RDONLY, freeze_bdev should just up_write(s_umount) instead of
    deactivate_locked_super().
    Also, keep sb->s_frozen consistent so that remount can check the frozen state.

    Otherwise a crash reported here can happen:
    http://lkml.org/lkml/2010/1/16/37
    http://lkml.org/lkml/2010/1/28/53

    This patch should be applied for 2.6.32 stable series, too.

    Reviewed-by: Christoph Hellwig
    Tested-by: Thomas Backlund
    Signed-off-by: Jun'ichi Nomura
    Cc: stable@kernel.org
    Signed-off-by: Al Viro

    Jun'ichi Nomura
     
  • Signed-off-by: Al Viro

    Al Viro
     

06 Feb, 2010

3 commits

  • Fix length check reported by D. Binderman (see below)

    d binderman wrote:
    >
    > I just ran the sourceforge tool cppcheck over the source code of the
    > new Linux kernel 2.6.33-rc6
    >
    > It said
    >
    > [./cifs/sess.c:250]: (error) Buffer access out-of-bounds

    May turn out to be harmless, but best to be safe. Note max
    username length is defined to 32 due to Linux (Windows
    maximum is 20).

    Signed-off-by: Steve French

    Steve French
     
  • cifs_from_ucs2 returns the length of the converted name, including the
    length of the NULL terminator. We don't want to include the NULL
    terminator in the dentry name length however since that'll throw off the
    hash calculation for the dentry cache.

    I believe that this is the root cause of several problems that have
    cropped up recently that seem to be papered over with the "noserverino"
    mount option. More confirmation of that would be good, but this is
    clearly a bug and it fixes at least one reproducible problem that
    was reported.

    This patch fixes at least this reproducer in this kernel.org bug:

    http://bugzilla.kernel.org/show_bug.cgi?id=15088#c12

    Reported-by: Bjorn Tore Sund
    Acked-by: Dave Kleikamp
    Signed-off-by: Jeff Layton
    Cc: stable@kernel.org
    Signed-off-by: Steve French

    Jeff Layton
     
  • The wrong member was compared in the continguousness check.

    Acked-by: Tao Ma
    Signed-off-by: Roel Kluin
    Signed-off-by: Joel Becker

    Roel Kluin