1. 24 Jan, 2011 2 commits
    • Rob Landley's avatar
      Make CIFS mount work in a container. · f1d0c998
      Rob Landley authored
      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.htmlSigned-off-by: default avatarRob Landley <rlandley@parallels.com>
      Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
      f1d0c998
    • Jesper Juhl's avatar
      CIFS: Remove pointless variable assignment in cifs_dfs_do_automount() · 3f391c79
      Jesper Juhl authored
      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: default avatarJesper Juhl <jj@chaosbits.net>
      Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
      3f391c79
  2. 22 Jan, 2011 2 commits
    • Linus Torvalds's avatar
      Linux 2.6.38-rc2 · 1bae4ce2
      Linus Torvalds authored
      1bae4ce2
    • Linus Torvalds's avatar
      Merge branch 'media_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 · 13a3cec8
      Linus Torvalds authored
      * 'media_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (101 commits)
        [media] staging/lirc: fix mem leaks and ptr err usage
        [media] hdpvr: reduce latency of i2c read/write w/recycled buffer
        [media] hdpvr: enable IR part
        [media] rc/mceusb: timeout should be in ns, not us
        [media] v4l2-device: fix 'use-after-freed' oops
        [media] v4l2-dev: don't memset video_device.dev
        [media] zoran: use video_device_alloc instead of kmalloc
        [media] w9966: zero device state after a detach
        [media] v4l: Fix a use-before-set in the control framework
        [media] v4l: Include linux/videodev2.h in media/v4l2-ctrls.h
        [media] DocBook/v4l: update V4L2 revision and update copyright years
        [media] DocBook/v4l: fix validation error in dev-rds.xml
        [media] v4l2-ctrls: queryctrl shouldn't attempt to replace V4L2_CID_PRIVATE_BASE IDs
        [media] v4l2-ctrls: fix missing 'read-only' check
        [media] pvrusb2: Provide more information about IR units to lirc_zilog and ir-kbd-i2c
        [media] ir-kbd-i2c: Add back defaults setting for Zilog Z8's at addr 0x71
        [media] lirc_zilog: Update TODO.lirc_zilog
        [media] lirc_zilog: Add Andy Walls to copyright notice and authors list
        [media] lirc_zilog: Remove useless struct i2c_driver.command function
        [media] lirc_zilog: Remove unneeded tests for existence of the IR Tx function
        ...
      13a3cec8
  3. 21 Jan, 2011 36 commits