1. 24 Sep, 2008 4 commits
    • Tejun Heo's avatar
      9p-trans_fd: don't do fs segment mangling in p9_fd_poll() · ec3c68f2
      Tejun Heo authored
      
      
      p9_fd_poll() is never called with user pointers and f_op->poll()
      doesn't expect its arguments to be from userland.  There's no need to
      set kernel ds before calling f_op->poll() from p9_fd_poll().  Remove
      it.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      ec3c68f2
    • Tejun Heo's avatar
      9p-trans_fd: clean up p9_conn_create() · 571ffeaf
      Tejun Heo authored
      
      
      * Use kzalloc() to allocate p9_conn and remove 0/NULL initializations.
      
      * Clean up error return paths.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      571ffeaf
    • Tejun Heo's avatar
      9p-trans_fd: fix trans_fd::p9_conn_destroy() · 7dc5d24b
      Tejun Heo authored
      
      
      p9_conn_destroy() first kills all current requests by calling
      p9_conn_cancel(), then waits for the request list to be cleared by
      waiting on p9_conn->equeue.  After that, polling is stopped and the
      trans is destroyed.  This sequence has a few problems.
      
      * Read and write works were never cancelled and the p9_conn can be
        destroyed while the works are running as r/w works remove requests
        from the list and dereference the p9_conn from them.
      
      * The list emptiness wait using p9_conn->equeue wouldn't trigger
        because p9_conn_cancel() always clears all the lists and the only
        way the wait can be triggered is to have another task to issue a
        request between the slim window between p9_conn_cancel() and the
        wait, which isn't safe under the current implementation with or
        without the wait.
      
      This patch fixes the problem by first stopping poll, which can
      schedule r/w works, first and cancle r/w works which guarantees that
      r/w works are not and will not run from that point and then calling
      p9_conn_cancel() and do the rest of destruction.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      7dc5d24b
    • Tejun Heo's avatar
      9p: implement proper trans module refcounting and unregistration · 72029fe8
      Tejun Heo authored
      
      
      9p trans modules aren't refcounted nor were they unregistered
      properly.  Fix it.
      
      * Add 9p_trans_module->owner and reference the module on each trans
        instance creation and put it on destruction.
      
      * Protect v9fs_trans_list with a spinlock.  This isn't strictly
        necessary as the list is manipulated only during module loading /
        unloading but it's a good idea to make the API safe.
      
      * Unregister trans modules when the corresponding module is being
        unloaded.
      
      * While at it, kill unnecessary EXPORT_SYMBOL on p9_trans_fd_init().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      72029fe8
  2. 24 Jul, 2008 1 commit
    • Ulrich Drepper's avatar
      flag parameters: socket and socketpair · a677a039
      Ulrich Drepper authored
      
      
      This patch adds support for flag values which are ORed to the type passwd
      to socket and socketpair.  The additional code is minimal.  The flag
      values in this implementation can and must match the O_* flags.  This
      avoids overhead in the conversion.
      
      The internal functions sock_alloc_fd and sock_map_fd get a new parameters
      and all callers are changed.
      
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      #include <fcntl.h>
      #include <stdio.h>
      #include <unistd.h>
      #include <netinet/in.h>
      #include <sys/socket.h>
      
      #define PORT 57392
      
      /* For Linux these must be the same.  */
      #define SOCK_CLOEXEC O_CLOEXEC
      
      int
      main (void)
      {
        int fd;
        fd = socket (PF_INET, SOCK_STREAM, 0);
        if (fd == -1)
          {
            puts ("socket(0) failed");
            return 1;
          }
        int coe = fcntl (fd, F_GETFD);
        if (coe == -1)
          {
            puts ("fcntl failed");
            return 1;
          }
        if (coe & FD_CLOEXEC)
          {
            puts ("socket(0) set close-on-exec flag");
            return 1;
          }
        close (fd);
      
        fd = socket (PF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0);
        if (fd == -1)
          {
            puts ("socket(SOCK_CLOEXEC) failed");
            return 1;
          }
        coe = fcntl (fd, F_GETFD);
        if (coe == -1)
          {
            puts ("fcntl failed");
            return 1;
          }
        if ((coe & FD_CLOEXEC) == 0)
          {
            puts ("socket(SOCK_CLOEXEC) does not set close-on-exec flag");
            return 1;
          }
        close (fd);
      
        int fds[2];
        if (socketpair (PF_UNIX, SOCK_STREAM, 0, fds) == -1)
          {
            puts ("socketpair(0) failed");
            return 1;
          }
        for (int i = 0; i < 2; ++i)
          {
            coe = fcntl (fds[i], F_GETFD);
            if (coe == -1)
              {
                puts ("fcntl failed");
                return 1;
              }
            if (coe & FD_CLOEXEC)
              {
                printf ("socketpair(0) set close-on-exec flag for fds[%d]\n", i);
                return 1;
              }
            close (fds[i]);
          }
      
        if (socketpair (PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds) == -1)
          {
            puts ("socketpair(SOCK_CLOEXEC) failed");
            return 1;
          }
        for (int i = 0; i < 2; ++i)
          {
            coe = fcntl (fds[i], F_GETFD);
            if (coe == -1)
              {
                puts ("fcntl failed");
                return 1;
              }
            if ((coe & FD_CLOEXEC) == 0)
              {
                printf ("socketpair(SOCK_CLOEXEC) does not set close-on-exec flag for fds[%d]\n", i);
                return 1;
              }
            close (fds[i]);
          }
      
        puts ("OK");
      
        return 0;
      }
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarUlrich Drepper <drepper@redhat.com>
      Acked-by: default avatarDavide Libenzi <davidel@xmailserver.org>
      Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a677a039
  3. 14 May, 2008 7 commits
  4. 28 Mar, 2008 1 commit
    • Andrew Morton's avatar
      net/9p/trans_fd.c:p9_trans_fd_init(): module_init functions should return 0 on success · 3387b804
      Andrew Morton authored
      
      
      Mar 23 09:06:31 opensuse103 kernel: Installing 9P2000 support
      Mar 23 09:06:31 opensuse103 kernel: sys_init_module: '9pnet_fd'->init suspiciously returned 1, it should follow 0/-E convention
      Mar 23 09:06:31 opensuse103 kernel: sys_init_module: loading module anyway...
      Mar 23 09:06:31 opensuse103 kernel: Pid: 5323, comm: modprobe Not tainted 2.6.25-rc6-git7-default #1
      Mar 23 09:06:31 opensuse103 kernel:  [<c013c253>] sys_init_module+0x172b/0x17c9
      Mar 23 09:06:31 opensuse103 kernel:  [<c0108a6a>] sys_mmap2+0x62/0x77
      Mar 23 09:06:31 opensuse103 kernel:  [<c01059c4>] sysenter_past_esp+0x6d/0xa9
      Mar 23 09:06:31 opensuse103 kernel:  =======================
      
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Cc: Eric Van Hensbergen <ericvh@opteron.(none)>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: <devzero@web.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3387b804
  5. 22 Mar, 2008 1 commit
  6. 05 Mar, 2008 1 commit
  7. 19 Feb, 2008 1 commit
  8. 17 Feb, 2008 1 commit
  9. 06 Feb, 2008 8 commits
  10. 04 Feb, 2008 2 commits
    • Rusty Russell's avatar
      virtio: explicit enable_cb/disable_cb rather than callback return. · 18445c4d
      Rusty Russell authored
      
      
      It seems that virtio_net wants to disable callbacks (interrupts) before
      calling netif_rx_schedule(), so we can't use the return value to do so.
      
      Rename "restart" to "cb_enable" and introduce "cb_disable" hook: callback
      now returns void, rather than a boolean.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      18445c4d
    • Rusty Russell's avatar
      virtio: simplify config mechanism. · a586d4f6
      Rusty Russell authored
      
      
      Previously we used a type/len pair within the config space, but this
      seems overkill.  We now simply define a structure which represents the
      layout in the config space: the config space can now only be extended
      at the end.
      
      The main driver-visible changes:
      1) We indicate what fields are present with an explicit feature bit.
      2) Virtqueues are explicitly numbered, and not in the config space.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      a586d4f6
  11. 31 Jan, 2008 1 commit
  12. 06 Nov, 2007 2 commits
  13. 23 Oct, 2007 2 commits
  14. 19 Oct, 2007 1 commit
  15. 17 Oct, 2007 4 commits
    • Eric Van Hensbergen's avatar
      9p: remove sysctl · 982c37cf
      Eric Van Hensbergen authored
      
      
      A sysctl method was added to enable and disable debugging levels.  After
      further review, it was decided that there are better approaches to doing this
      and the sysctl methodology isn't really desirable.  This patch removes the
      sysctl code from 9p.
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
        
      982c37cf
    • Eric Van Hensbergen's avatar
      9p: fix bad kconfig cross-dependency · fb0466c3
      Eric Van Hensbergen authored
      
      
      This patch moves transport dynamic registration and matching to the net
      module to prevent a bad Kconfig dependency between the net and fs 9p modules.
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      fb0466c3
    • Latchesar Ionkov's avatar
      9p: attach-per-user · ba17674f
      Latchesar Ionkov authored
      
      
      The 9P2000 protocol requires the authentication and permission checks to be
      done in the file server. For that reason every user that accesses the file
      server tree has to authenticate and attach to the server separately.
      Multiple users can share the same connection to the server.
      
      Currently v9fs does a single attach and executes all I/O operations as a
      single user. This makes using v9fs in multiuser environment unsafe as it
      depends on the client doing the permission checking.
      
      This patch improves the 9P2000 support by allowing every user to attach
      separately. The patch defines three modes of access (new mount option
      'access'):
      
      - attach-per-user (access=user) (default mode for 9P2000.u)
       If a user tries to access a file served by v9fs for the first time, v9fs
       sends an attach command to the server (Tattach) specifying the user. If
       the attach succeeds, the user can access the v9fs tree.
       As there is no uname->uid (string->integer) mapping yet, this mode works
       only with the 9P2000.u dialect.
      
      - allow only one user to access the tree (access=<uid>)
       Only the user with uid can access the v9fs tree. Other users that attempt
       to access it will get EPERM error.
      
      - do all operations as a single user (access=any) (default for 9P2000)
       V9fs does a single attach and all operations are done as a single user.
       If this mode is selected, the v9fs behavior is identical with the current
       one.
      Signed-off-by: default avatarLatchesar Ionkov <lucho@ionkov.net>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      ba17674f
    • Eric Van Hensbergen's avatar
      9p: Make transports dynamic · a80d923e
      Eric Van Hensbergen authored
      
      
      This patch abstracts out the interfaces to underlying transports so that
      new transports can be added as modules.  This should also allow kernel
      configuration of transports without ifdef-hell.
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      a80d923e
  16. 23 Aug, 2007 2 commits
  17. 31 Jul, 2007 1 commit