Author: tbm
Date: Fri Dec 29 14:41:30 2006
New Revision: 8054

Added:
   dists/sid/linux-2.6/debian/patches/bugfix/msync-enomem.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/9
Log:
* Revert mm/msync patches because they cause filesystem corruption
  (closes: #401006, #401980, #402707) ...
* ... and add an alternative msync patch from Hugh Dickins that
  doesn't depend on the mm changes (closes: #394392).


Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog        (original)
+++ dists/sid/linux-2.6/debian/changelog        Fri Dec 29 14:41:30 2006
@@ -5,6 +5,10 @@
   * arm/ixp4xx: Enable some more I2C sensor modules.
   * arm/ixp4xx: Enable CONFIG_USB_NET_RNDIS_HOST.
   * arm/footbridge: Enable CONFIG_NATSEMI.
+  * Revert mm/msync patches because they cause filesystem corruption
+    (closes: #401006, #401980, #402707) ...
+  * ... and add an alternative msync patch from Hugh Dickins that
+    doesn't depend on the mm changes (closes: #394392).
 
   [ Bastian Blank ]
   * Bump ABI to 4.

Added: dists/sid/linux-2.6/debian/patches/bugfix/msync-enomem.patch
==============================================================================
--- (empty file)
+++ dists/sid/linux-2.6/debian/patches/bugfix/msync-enomem.patch        Fri Dec 
29 14:41:30 2006
@@ -0,0 +1,124 @@
+From: Hugh Dickins <[EMAIL PROTECTED]>
+
+Fix 2.6.18 (or 2.6.17) sys_msync to report -ENOMEM as before when an
+unmapped area falls within its range, and not to overshoot: to satisfy
+LSB 3.1 tests and to fix Debian Bug#394392.  Took the 2.6.19 sys_msync
+as starting point (including its cleanup of repeated "current->mm"s),
+reintroducing the msync_interval and balance_dirty_pages_ratelimited_nr
+previously needed.
+
+Signed-off-by: Hugh Dickins <[EMAIL PROTECTED]>
+---
+
+ mm/msync.c |   66 
+++++++++++++++++++++++++++----------------------------------
+ 1 file changed, 30 insertions(+), 36 deletions(-)
+
+--- 2.6.18/mm/msync.c  2006-09-20 04:42:06.000000000 +0100
++++ linux/mm/msync.c   2006-12-26 23:52:58.000000000 +0000
+@@ -146,10 +146,10 @@ static int msync_interval(struct vm_area
+ asmlinkage long sys_msync(unsigned long start, size_t len, int flags)
+ {
+       unsigned long end;
++      struct mm_struct *mm = current->mm;
+       struct vm_area_struct *vma;
+       int unmapped_error = 0;
+       int error = -EINVAL;
+-      int done = 0;
+
+       if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC))
+               goto out;
+@@ -169,64 +169,58 @@ asmlinkage long sys_msync(unsigned long 
+        * If the interval [start,end) covers some unmapped address ranges,
+        * just ignore them, but return -ENOMEM at the end.
+        */
+-      down_read(&current->mm->mmap_sem);
+-      vma = find_vma(current->mm, start);
+-      if (!vma) {
+-              error = -ENOMEM;
+-              goto out_unlock;
+-      }
+-      do {
++      down_read(&mm->mmap_sem);
++      vma = find_vma(mm, start);
++      for (;;) {
+               unsigned long nr_pages_dirtied = 0;
+               struct file *file;
+ 
++              /* Still start < end. */
++              error = -ENOMEM;
++              if (!vma)
++                      goto out_unlock;
+               /* Here start < vma->vm_end. */
+               if (start < vma->vm_start) {
+-                      unmapped_error = -ENOMEM;
+                       start = vma->vm_start;
+-              }
+-              /* Here vma->vm_start <= start < vma->vm_end. */
+-              if (end <= vma->vm_end) {
+-                      if (start < end) {
+-                              error = msync_interval(vma, start, end, flags,
+-                                                      &nr_pages_dirtied);
+-                              if (error)
+-                                      goto out_unlock;
+-                      }
+-                      error = unmapped_error;
+-                      done = 1;
+-              } else {
+-                      /* Here vma->vm_start <= start < vma->vm_end < end. */
+-                      error = msync_interval(vma, start, vma->vm_end, flags,
+-                                              &nr_pages_dirtied);
+-                      if (error)
++                      if (start >= end)
+                               goto out_unlock;
++                      unmapped_error = -ENOMEM;
+               }
++              /* Here vma->vm_start <= start < vma->vm_end. */
++              error = msync_interval(vma, start, min(end, vma->vm_end),
++                                              flags, &nr_pages_dirtied);
++              if (error)
++                      goto out_unlock;
+               file = vma->vm_file;
+               start = vma->vm_end;
+               if ((flags & MS_ASYNC) && file && nr_pages_dirtied) {
+                       get_file(file);
+-                      up_read(&current->mm->mmap_sem);
++                      up_read(&mm->mmap_sem);
+                       balance_dirty_pages_ratelimited_nr(file->f_mapping,
+                                                       nr_pages_dirtied);
+                       fput(file);
+-                      down_read(&current->mm->mmap_sem);
+-                      vma = find_vma(current->mm, start);
++                      if (start >= end)
++                              goto out;
++                      down_read(&mm->mmap_sem);
++                      vma = find_vma(mm, start);
+               } else if ((flags & MS_SYNC) && file &&
+                               (vma->vm_flags & VM_SHARED)) {
+                       get_file(file);
+-                      up_read(&current->mm->mmap_sem);
++                      up_read(&mm->mmap_sem);
+                       error = do_fsync(file, 0);
+                       fput(file);
+-                      down_read(&current->mm->mmap_sem);
+-                      if (error)
+-                              goto out_unlock;
+-                      vma = find_vma(current->mm, start);
++                      if (error || start >= end)
++                              goto out;
++                      down_read(&mm->mmap_sem);
++                      vma = find_vma(mm, start);
+               } else {
++                      if (start >= end)
++                              goto out_unlock;
+                       vma = vma->vm_next;
+               }
+-      } while (vma && !done);
++      }
+ out_unlock:
+-      up_read(&current->mm->mmap_sem);
++      up_read(&mm->mmap_sem);
+ out:
+-      return error;
++      return error ? : unmapped_error;
+ }
+

Modified: dists/sid/linux-2.6/debian/patches/series/9
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/9 (original)
+++ dists/sid/linux-2.6/debian/patches/series/9 Fri Dec 29 14:41:30 2006
@@ -27,3 +27,10 @@
 + bugfix/sparc/isa-dev-no-reg.patch
 + bugfix/sparc/ehci-hub-contol-alignment.patch
 - bugfix/net-r8169-no_mac_adress_change.patch
+- features/mm-msync-cleanup.patch
+- features/mm-do_wp_page-fixup.patch
+- features/mm-install_page-cleanup.patch
+- features/mm-optimize-mprotect.patch
+- features/mm-balance-dirty-pages.patch
+- features/mm-tracking-shared-dirty-pages.patch
++ bugfix/msync-enomem.patch

_______________________________________________
Kernel-svn-changes mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/kernel-svn-changes

Reply via email to