26 Jan, 2011

1 commit


25 Jan, 2011

1 commit


24 Jan, 2011

2 commits

  • Teach cifs about network namespaces, so mounting uses adresses/routing
    visible from the container rather than from init context.

    A container is a chroot on steroids that changes more than just the root
    filesystem the new processes see. One thing containers can isolate is
    "network namespaces", meaning each container can have its own set of
    ethernet interfaces, each with its own own IP address and routing to the
    outside world. And if you open a socket in _userspace_ from processes
    within such a container, this works fine.

    But sockets opened from within the kernel still use a single global
    networking context in a lot of places, meaning the new socket's address
    and routing are correct for PID 1 on the host, but are _not_ what
    userspace processes in the container get to use.

    So when you mount a network filesystem from within in a container, the
    mount code in the CIFS driver uses the host's networking context and not
    the container's networking context, so it gets the wrong address, uses
    the wrong routing, and may even try to go out an interface that the
    container can't even access... Bad stuff.

    This patch copies the mount process's network context into the CIFS
    structure that stores the rest of the server information for that mount
    point, and changes the socket open code to use the saved network context
    instead of the global network context. I.E. "when you attempt to use
    these addresses, do so relative to THIS set of network interfaces and
    routing rules, not the old global context from back before we supported
    containers".

    The big long HOWTO sets up a test environment on the assumption you've
    never used ocntainers before. It basically says:

    1) configure and build a new kernel that has container support
    2) build a new root filesystem that includes the userspace container
    control package (LXC)
    3) package/run them under KVM (so you don't have to mess up your host
    system in order to play with containers).
    4) set up some containers under the KVM system
    5) set up contradictory routing in the KVM system and the container so
    that the host and the container see different things for the same address
    6) try to mount a CIFS share from both contexts so you can both force it
    to work and force it to fail.

    For a long drawn out test reproduction sequence, see:

    http://landley.livejournal.com/47024.html
    http://landley.livejournal.com/47205.html
    http://landley.livejournal.com/47476.html

    Signed-off-by: Rob Landley
    Reviewed-by: Jeff Layton
    Signed-off-by: Steve French

    Rob Landley
     
  • In fs/cifs/cifs_dfs_ref.c::cifs_dfs_do_automount() we have this code:

    ...
    mnt = ERR_PTR(-EINVAL);
    if (IS_ERR(tlink)) {
    mnt = ERR_CAST(tlink);
    goto free_full_path;
    }
    ses = tlink_tcon(tlink)->ses;

    rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls,
    &num_referrals, &referrals,
    cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);

    cifs_put_tlink(tlink);

    mnt = ERR_PTR(-ENOENT);
    ...

    The assignment of 'mnt = ERR_PTR(-EINVAL);' is completely pointless. If we
    take the 'if (IS_ERR(tlink))' branch we'll set 'mnt' again and we'll also
    do so if we do not take the branch. There is no way we'll ever use 'mnt'
    with the assigned 'ERR_PTR(-EINVAL)' value, so we may as well just remove
    the pointless assignment.

    Signed-off-by: Jesper Juhl
    Signed-off-by: Steve French

    Jesper Juhl
     

23 Jan, 2011

1 commit

  • Fix new fs/dcache.c kernel-doc warnings:

    Warning(fs/dcache.c:184): No description found for parameter 'dentry'
    Warning(fs/dcache.c:296): No description found for parameter 'parent'
    Warning(fs/dcache.c:1985): No description found for parameter 'dparent'
    Warning(fs/dcache.c:1985): Excess function parameter 'parent' description in 'd_validate'

    Signed-off-by: Randy Dunlap
    Cc: Alexander Viro
    Cc: Nick Piggin
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

22 Jan, 2011

2 commits

  • Fixes the following kernel oops in nilfs_setup_super() which could
    arise if one of two super-blocks is unavailable.

    > BUG: unable to handle kernel NULL pointer dereference at (null)
    > Pid: 3529, comm: mount.nilfs2 Not tainted 2.6.37 #1 /
    > EIP: 0060:[] EFLAGS: 00010202 CPU: 3
    > EIP is at memcpy+0xc/0x1b
    > Call Trace:
    > [] ? nilfs_setup_super+0x6c/0xa5 [nilfs2]
    > [] ? nilfs_get_root_dentry+0x81/0xcb [nilfs2]
    > [] ? nilfs_mount+0x4f9/0x62c [nilfs2]
    > [] ? kstrdup+0x36/0x3f
    > [] ? nilfs_mount+0x0/0x62c [nilfs2]
    > [] ? vfs_kern_mount+0x4d/0x12c
    > [] ? get_fs_type+0x76/0x8f
    > [] ? do_kern_mount+0x33/0xbf
    > [] ? do_mount+0x2ed/0x714
    > [] ? copy_mount_options+0x28/0xfc
    > [] ? sys_mount+0x72/0xaf
    > [] ? syscall_call+0x7/0xb

    Reported-by: Wakko Warner
    Signed-off-by: Ryusuke Konishi
    Tested-by: Wakko Warner
    Cc: stable [2.6.37, 2.6.36]
    LKML-Reference:

    Ryusuke Konishi
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
    cifs: fix up CIFSSMBEcho for unaligned access
    cifs: fix unaligned accesses in cifsConvertToUCS
    cifs: clean up unaligned accesses in cifs_unicode.c
    cifs: fix unaligned access in check2ndT2 and coalesce_t2
    cifs: clean up unaligned accesses in validate_t2
    cifs: use get/put_unaligned functions to access ByteCount
    cifs: move time field in cifsInodeInfo
    cifs: TCP_Server_Info diet
    CIFS: Implement cifs_strict_readv (try #4)
    CIFS: Implement cifs_file_strict_mmap (try #2)
    CIFS: Implement cifs_strict_fsync
    CIFS: Make cifsFileInfo_put work with strict cache mode

    Linus Torvalds
     

21 Jan, 2011

30 commits

  • * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6:
    quota: Fix deadlock during path resolution

    Linus Torvalds
     
  • Make sure that CIFSSMBEcho can handle unaligned fields. Also fix a minor
    bug that causes this warning:

    fs/cifs/cifssmb.c: In function 'CIFSSMBEcho':
    fs/cifs/cifssmb.c:740: warning: large integer implicitly truncated to unsigned type

    ...WordCount is u8, not __le16, so no need to convert it.

    This patch should apply cleanly on top of the rest of the patchset to
    clean up unaligned access.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Steve French
     
  • * akpm:
    kernel/smp.c: consolidate writes in smp_call_function_interrupt()
    kernel/smp.c: fix smp_call_function_many() SMP race
    memcg: correctly order reading PCG_USED and pc->mem_cgroup
    backlight: fix 88pm860x_bl macro collision
    drivers/leds/ledtrig-gpio.c: make output match input, tighten input checking
    MAINTAINERS: update Atmel AT91 entry
    mm: fix truncate_setsize() comment
    memcg: fix rmdir, force_empty with THP
    memcg: fix LRU accounting with THP
    memcg: fix USED bit handling at uncharge in THP
    memcg: modify accounting function for supporting THP better
    fs/direct-io.c: don't try to allocate more than BIO_MAX_PAGES in a bio
    mm: compaction: prevent division-by-zero during user-requested compaction
    mm/vmscan.c: remove duplicate include of compaction.h
    memblock: fix memblock_is_region_memory()
    thp: keep highpte mapped until it is no longer needed
    kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT

    Linus Torvalds
     
  • When using devices that support max_segments > BIO_MAX_PAGES (256), direct
    IO tries to allocate a bio with more pages than allowed, which leads to an
    oops in dio_bio_alloc(). Clamp the request to the supported maximum, and
    change dio_bio_alloc() to reflect that bio_alloc() will always return a
    bio when called with __GFP_WAIT and a valid number of vectors.

    [akpm@linux-foundation.org: remove redundant BUG_ON()]
    Signed-off-by: David Dillow
    Reviewed-by: Jeff Moyer
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Dillow
     
  • The meaning of CONFIG_EMBEDDED has long since been obsoleted; the option
    is used to configure any non-standard kernel with a much larger scope than
    only small devices.

    This patch renames the option to CONFIG_EXPERT in init/Kconfig and fixes
    references to the option throughout the kernel. A new CONFIG_EMBEDDED
    option is added that automatically selects CONFIG_EXPERT when enabled and
    can be used in the future to isolate options that should only be
    considered for embedded systems (RISC architectures, SLOB, etc).

    Calling the option "EXPERT" more accurately represents its intention: only
    expert users who understand the impact of the configuration changes they
    are making should enable it.

    Reviewed-by: Ingo Molnar
    Acked-by: David Woodhouse
    Signed-off-by: David Rientjes
    Cc: Greg KH
    Cc: "David S. Miller"
    Cc: Jens Axboe
    Cc: Arnd Bergmann
    Cc: Robin Holt
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     
  • * 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
    cifs: mangle existing header for SMB_COM_NT_CANCEL
    cifs: remove code for setting timeouts on requests
    [CIFS] cifs: reconnect unresponsive servers
    cifs: set up recurring workqueue job to do SMB echo requests
    cifs: add ability to send an echo request
    cifs: add cifs_call_async
    cifs: allow for different handling of received response
    cifs: clean up sync_mid_result
    cifs: don't reconnect server when we don't get a response
    cifs: wait indefinitely for responses
    cifs: Use mask of ACEs for SID Everyone to calculate all three permissions user, group, and other
    cifs: Fix regression during share-level security mounts (Repost)
    [CIFS] Update cifs version number
    cifs: move mid result processing into common function
    cifs: move locked sections out of DeleteMidQEntry and AllocMidQEntry
    cifs: clean up accesses to midCount
    cifs: make wait_for_free_request take a TCP_Server_Info pointer
    cifs: no need to mark smb_ses_list as cifs_demultiplex_thread is exiting
    cifs: don't fail writepages on -EAGAIN errors
    CIFS: Fix oplock break handling (try #2)

    Linus Torvalds
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
    GFS2: Fix error path in gfs2_lookup_by_inum()
    GFS2: remove iopen glocks from cache on failed deletes

    Linus Torvalds
     
  • Commit e462c448fdc8 ("pipe: use event aware wakeups") optimized the pipe
    event wakeup calls to avoid wakeups if the events do not match the
    requested set.

    However, the optimization was buggy, in that it didn't actually use the
    correct sets for the events: when we make room for more data to be
    written, the pipe poll() routine will return both the POLLOUT _and_
    POLLWRNORM bits. Similarly for read.

    And most critically, when a pipe is released, that will potentially
    result in POLLHUP|POLLERR (depending on whether it was the last reader
    or writer), not just the regular POLLIN|POLLOUT.

    This bug showed itself as a hung gnome-screensaver-dialog process, stuck
    forever (or at least until it was poked by a signal or by being traced)
    in a poll() system call.

    Cc: Davide Libenzi
    Cc: David S. Miller
    Cc: Eric Dumazet
    Cc: Jens Axboe
    Cc: Andrew Morton
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Move cifsConvertToUCS to cifs_unicode.c where all of the other unicode
    related functions live. Have it store mapped characters in 'temp' and
    then use put_unaligned_le16 to copy it to the target buffer. Also fix
    the comments to match kernel coding style.

    Signed-off-by: Jeff Layton
    Acked-by: Pavel Shilovsky
    Reviewed-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Jeff Layton
     
  • Make sure we use get/put_unaligned routines when accessing wide
    character strings.

    Signed-off-by: Jeff Layton
    Acked-by: Pavel Shilovsky
    Reviewed-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Jeff Layton
     
  • Signed-off-by: Jeff Layton
    Acked-by: Pavel Shilovsky
    Reviewed-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Jeff Layton
     
  • ...and clean up function to reduce indentation.

    Signed-off-by: Jeff Layton
    Acked-by: Pavel Shilovsky
    Reviewed-by: Shirish Pargaonkar
    Signed-off-by: Steve French

    Jeff Layton
     
  • It's possible that when we access the ByteCount that the alignment
    will be off. Most CPUs deal with that transparently, but there's
    usually some performance impact. Some CPUs raise an exception on
    unaligned accesses.

    Fix this by accessing the byte count using the get_unaligned and
    put_unaligned inlined functions. While we're at it, fix the types
    of some of the variables that end up getting returns from these
    functions.

    Acked-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • ...and remove length qualifiers from bools.

    Before:

    /* size: 1176, cachelines: 19, members: 13 */
    /* sum members: 1165, holes: 2, sum holes: 11 */
    /* bit holes: 1, sum bit holes: 4 bits */
    /* last cacheline: 24 bytes */

    After:

    /* size: 1168, cachelines: 19, members: 13 */
    /* last cacheline: 16 bytes */

    ...savings of 8 bytes per inode.

    Signed-off-by: Jeff Layton
    Reviewed-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Jeff Layton
     
  • Remove fields that are completely unused, and rearrange struct
    according to recommendations by "pahole".

    Before:

    /* size: 1112, cachelines: 18, members: 49 */
    /* sum members: 1086, holes: 8, sum holes: 26 */
    /* bit holes: 1, sum bit holes: 7 bits */
    /* last cacheline: 24 bytes */

    After:

    /* size: 1072, cachelines: 17, members: 42 */
    /* sum members: 1065, holes: 3, sum holes: 7 */
    /* last cacheline: 48 bytes */

    ...savings of 40 bytes per struct on x86_64. 21 bytes by field removal,
    and 19 by reorganizing to eliminate holes.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Read from the cache if we have at least Level II oplock - otherwise
    read from the server. Add cifs_user_readv to let the client read into
    iovec buffers.

    Reviewed-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     
  • Invalidate inode mapping if we don't have at least Level II oplock.

    Reviewed-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     
  • Invalidate inode mapping if we don't have at least Level II oplock in
    cifs_strict_fsync. Also remove filemap_write_and_wait call from cifs_fsync
    because it is previously called from vfs_fsync_range. Add file operations'
    structures for strict cache mode.

    Reviewed-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     
  • On strict cache mode when we close the last file handle of the inode we
    should set invalid_mapping flag on this inode to prevent data coherency
    problem when we open it again but it has been modified on the server.

    Reviewed-by: Jeff Layton
    Signed-off-by: Pavel Shilovsky
    Signed-off-by: Steve French

    Pavel Shilovsky
     
  • The NT_CANCEL command looks just like the original command, except for a
    few small differences. The send_nt_cancel function however currently takes
    a tcon, which we don't have in SendReceive and SendReceive2.

    Instead of "respinning" the entire header for an NT_CANCEL, just mangle
    the existing header by replacing just the fields we need. This means we
    don't need a tcon and allows us to call it from other places.

    Reviewed-by: Pavel Shilovsky
    Reviewed-by: Suresh Jayaraman
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Since we don't time out individual requests anymore, remove the code
    that we used to use for setting timeouts on different requests.

    Reviewed-by: Pavel Shilovsky
    Reviewed-by: Suresh Jayaraman
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • If the server isn't responding to echoes, we don't want to leave tasks
    hung waiting for it to reply. At that point, we'll want to reconnect
    so that soft mounts can return an error to userspace quickly.

    If the client hasn't received a reply after a specified number of echo
    intervals, assume that the transport is down and attempt to reconnect
    the socket.

    The number of echo_intervals to wait before attempting to reconnect is
    tunable via a module parameter. Setting it to 0, means that the client
    will never attempt to reconnect. The default is 5.

    Signed-off-by: Jeff Layton

    Steve French
     
  • Reviewed-by: Suresh Jayaraman
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Reviewed-by: Suresh Jayaraman
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Add a function that will send a request, and set up the mid for an
    async reply.

    Reviewed-by: Suresh Jayaraman
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • In order to incorporate async requests, we need to allow for a more
    general way to do things on receive, rather than just waking up a
    process.

    Turn the task pointer in the mid_q_entry into a callback function and a
    generic data pointer. When a response comes in, or the socket is
    reconnected, cifsd can call the callback function in order to wake up
    the process.

    The default is to just wake up the current process which should mean no
    change in behavior for existing code.

    Also, clean up the locking in cifs_reconnect. There doesn't seem to be
    any need to hold both the srv_mutex and GlobalMid_Lock when walking the
    list of mids.

    Reviewed-by: Suresh Jayaraman
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • Make it use a switch statement based on the value of the midStatus. If
    the resp_buf is set, then MID_RESPONSE_RECEIVED is too.

    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • We only want to force a reconnect to the server under very limited and
    specific circumstances. Now that we have processes waiting indefinitely
    for responses, we shouldn't reach this point unless a reconnect is
    already in process. Thus, there's no reason to re-mark the server for
    reconnect here.

    Reviewed-by: Suresh Jayaraman
    Reviewed-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     
  • The client should not be timing out on individual SMB requests. Too much
    of the state between client and server is tied to the state of the
    socket. If we time out requests and issue spurious disconnects then that
    comprimises data integrity.

    Instead of doing this complicated dance where we try to decide how long
    to wait for a response for particular requests, have the client instead
    wait indefinitely for a response. Also, use a TASK_KILLABLE sleep here
    so that fatal signals will break out of this waiting.

    Later patches will add support for detecting dead peers and forcing
    reconnects based on that.

    Reviewed-by: Suresh Jayaraman
    Reviewed-by: Pavel Shilovsky
    Signed-off-by: Jeff Layton
    Signed-off-by: Steve French

    Jeff Layton
     

20 Jan, 2011

3 commits