1. 25 1月, 2011 1 次提交
  2. 24 1月, 2011 2 次提交
    • R
      Make CIFS mount work in a container. · f1d0c998
      Rob Landley 提交于
      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: NRob Landley <rlandley@parallels.com>
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      f1d0c998
    • J
      CIFS: Remove pointless variable assignment in cifs_dfs_do_automount() · 3f391c79
      Jesper Juhl 提交于
      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: NJesper Juhl <jj@chaosbits.net>
      Signed-off-by: NSteve French <sfrench@us.ibm.com>
      3f391c79
  3. 23 1月, 2011 1 次提交
  4. 21 1月, 2011 25 次提交
  5. 20 1月, 2011 10 次提交
  6. 18 1月, 2011 1 次提交
    • S
      GFS2: Fix error path in gfs2_lookup_by_inum() · 24d9765f
      Steven Whitehouse 提交于
      In the (impossible, except if there is fs corruption) error path
      in gfs2_lookup_by_inum() if the call to gfs2_inode_refresh()
      fails, it was leaving the function by calling iput() rather
      than iget_failed(). This would cause future lookups of the same
      inode to block forever.
      
      This patch fixes the problem by moving the call to gfs2_inode_refresh()
      into gfs2_inode_lookup() where iget_failed() is part of the error path
      already. Also this cleans up some unreachable code and makes
      gfs2_set_iop() static.
      Signed-off-by: NSteven Whitehouse <swhiteho@redhat.com>
      24d9765f