Package: user-mode-linux
Tags: patch
Followup-For: Bug #442108

This bug is fixed in 2.6.23. I just backport it.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.22.2-rt (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
Shell: /bin/sh linked to /bin/bash

Versions of packages user-mode-linux depends on:
ii  uml-utilities                 20070815-1 User-mode Linux (utility programs)

user-mode-linux recommends no packages.

-- debconf-show failed
diff --git a/debian/changelog b/debian/changelog
index 8925f60..838359d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+user-mode-linux (2.6.22-1um-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * UBD fix (Closes: #442108)
+
+ -- Alexander V. Inyukhin <[EMAIL PROTECTED]>  Tue, 30 Oct 2007 23:54:51 +0300
+
 user-mode-linux (2.6.22-1um-1) unstable; urgency=low
 
   * New upstream release (Closes: #436388).
diff --git a/debian/patches/00list b/debian/patches/00list
index 09a8197..77115e0 100644
--- a/debian/patches/00list
+++ b/debian/patches/00list
@@ -1,3 +1,4 @@
 02_x-terminal-emulator.dpatch
 03_uml_switch.diff
 04_restructure-do_aio.patch
+99_ubd.patch
diff --git a/debian/patches/99_ubd.patch b/debian/patches/99_ubd.patch
new file mode 100644
index 0000000..8ff4387
--- /dev/null
+++ b/debian/patches/99_ubd.patch
@@ -0,0 +1,75 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 99_ubd - Alexander V. Inyukhin <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: UBD fixes from 2.6.23
+
[EMAIL PROTECTED]@
+
+# Author: shurick
+# Status: none
+
+diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
+index 2e09f16..0eabe73 100644
+--- a/arch/um/drivers/ubd_kern.c
++++ b/arch/um/drivers/ubd_kern.c
+@@ -469,7 +469,7 @@ __uml_help(fakehd,
+ "    Change the ubd device name to \"hd\".\n\n"
+ );
+ 
+-static void do_ubd_request(request_queue_t * q);
++static void do_ubd_request(struct request_queue * q);
+ 
+ /* Only changed by ubd_init, which is an initcall. */
+ int thread_fd = -1;
+@@ -612,6 +612,8 @@ static int ubd_open_dev(struct ubd *ubd_dev)
+       ubd_dev->fd = fd;
+ 
+       if(ubd_dev->cow.file != NULL){
++              blk_queue_max_sectors(ubd_dev->queue, 8 * sizeof(long));
++
+               err = -ENOMEM;
+               ubd_dev->cow.bitmap = (void *) vmalloc(ubd_dev->cow.bitmap_len);
+               if(ubd_dev->cow.bitmap == NULL){
+@@ -1079,11 +1081,11 @@ static void prepare_request(struct request *req, 
struct io_thread_req *io_req,
+ }
+ 
+ /* Called with dev->lock held */
+-static void do_ubd_request(request_queue_t *q)
++static void do_ubd_request(struct request_queue *q)
+ {
+       struct io_thread_req *io_req;
+       struct request *req;
+-      int n;
++      int n, last_sectors;
+ 
+       while(1){
+               struct ubd *dev = q->queuedata;
+@@ -1099,9 +1101,11 @@ static void do_ubd_request(request_queue_t *q)
+               }
+ 
+               req = dev->request;
++              last_sectors = 0;
+               while(dev->start_sg < dev->end_sg){
+                       struct scatterlist *sg = &dev->sg[dev->start_sg];
+ 
++                      req->sector += last_sectors;
+                       io_req = kmalloc(sizeof(struct io_thread_req),
+                                        GFP_ATOMIC);
+                       if(io_req == NULL){
+@@ -1113,6 +1117,7 @@ static void do_ubd_request(request_queue_t *q)
+                                       (unsigned long long) req->sector << 9,
+                                       sg->offset, sg->length, sg->page);
+ 
++                      last_sectors = sg->length >> 9;
+                       n = os_write_file(thread_fd, &io_req,
+                                         sizeof(struct io_thread_req *));
+                       if(n != sizeof(struct io_thread_req *)){
+@@ -1124,7 +1129,6 @@ static void do_ubd_request(request_queue_t *q)
+                               return;
+                       }
+ 
+-                      req->sector += sg->length >> 9;
+                       dev->start_sg++;
+               }
+               dev->end_sg = 0;

Reply via email to