UBUNTU: ubuntu: iscsitarget -- re-instate copy_io_context
authorAndy Whitcroft <apw@canonical.com>
Thu, 9 Dec 2010 16:04:33 +0000 (16:04 +0000)
committerLeann Ogasawara <leann.ogasawara@canonical.com>
Mon, 28 Mar 2011 13:52:12 +0000 (06:52 -0700)
Signed-off-by: Andy Whitcroft <apw@canonical.com>

ubuntu/iscsitarget/wthread.c

index 997a3d6..f77138b 100644 (file)
@@ -59,6 +59,19 @@ static int cmnd_execute(struct iscsi_cmnd *cmnd)
        return target_type_array[type]->execute_cmnd(cmnd);
 }
 
+static void copy_io_context(struct io_context **pdst, struct io_context **psrc)
+{
+       struct io_context *src = *psrc;
+       struct io_context *dst = *pdst;
+
+       if (src) {
+               BUG_ON(atomic_long_read(&src->refcount) == 0);
+               atomic_long_inc(&src->refcount);
+               put_io_context(dst);
+               *pdst = src;
+       }
+}
+
 static int worker_thread(void *arg)
 {
        struct worker_thread *wt = (struct worker_thread *) arg;