]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
[PATCH] v9fs: make copy of the transport prototype instead of using it directly
authorLatchesar Ionkov <lucho@ionkov.net>
Fri, 23 Sep 2005 04:43:51 +0000 (21:43 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 23 Sep 2005 05:17:33 +0000 (22:17 -0700)
When a new session is created it uses a template object of the specified
transport type to instantiate its own copy.  The code for the making a copy of
the template object was lost, and the object itself is attached to the v9fs
session.  This leads to many sessions using the same transport instead of
having their own copy.

The patch puts back the code that makes a copy of the template object.

Signed-off-by: Latchesar Ionkov <lucho@ionkov.net>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/9p/v9fs.c

index 13bdbbab4387a38809b512efb9241a2d71fd05df..82303f3bf76f786f4a939d47c60ba0cd73649a1e 100644 (file)
@@ -303,7 +303,13 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
                goto SessCleanUp;
        };
 
-       v9ses->transport = trans_proto;
+       v9ses->transport = kmalloc(sizeof(*v9ses->transport), GFP_KERNEL);
+       if (!v9ses->transport) {
+               retval = -ENOMEM;
+               goto SessCleanUp;
+       }
+
+       memmove(v9ses->transport, trans_proto, sizeof(*v9ses->transport));
 
        if ((retval = v9ses->transport->init(v9ses, dev_name, data)) < 0) {
                eprintk(KERN_ERR, "problem initializing transport\n");