Author: thomas
Date: Sat Feb 17 23:12:31 2007
New Revision: 122200

Added:
   
packages/cooker/kernel-linus/current/SOURCES/01_fix-missing-critical-phys_to_virt-in-lib_swiotlb.patch
   
packages/cooker/kernel-linus/current/SOURCES/02_ieee1394-video1394-DMA-fix.patch
   
packages/cooker/kernel-linus/current/SOURCES/03_ieee1394-fix-host-device-registering-when-nodemgr-disabled.patch
   
packages/cooker/kernel-linus/current/SOURCES/04_fix-oops-in-xfrm_audit_log.patch
   packages/cooker/kernel-linus/current/SOURCES/05_md-raid5-fix-crash.patch
   
packages/cooker/kernel-linus/current/SOURCES/06_md-raid5-fix-export-blk_recount_segments.patch
Modified:
   packages/cooker/kernel-linus/current/SPECS/kernel-linus.spec

Log:
- add bugfixes from upcoming 2.6.20.1 (will be removed when it's released)
  01_fix-missing-critical-phys_to_virt-in-lib_swiotlb.patch
  02_ieee1394-video1394-DMA-fix.patch
  03_ieee1394-fix-host-device-registering-when-nodemgr-disabled.patch
  04_fix-oops-in-xfrm_audit_log.patch
  05_md-raid5-fix-crash.patch
  06_md-raid5-fix-export-blk_recount_segments.patch



Added: 
packages/cooker/kernel-linus/current/SOURCES/01_fix-missing-critical-phys_to_virt-in-lib_swiotlb.patch
==============================================================================
--- (empty file)
+++ 
packages/cooker/kernel-linus/current/SOURCES/01_fix-missing-critical-phys_to_virt-in-lib_swiotlb.patch
      Sat Feb 17 23:12:31 2007
@@ -0,0 +1,32 @@
+Date: Sun, 04 Feb 2007 13:39:40 -0500
+From: David Moore <[EMAIL PROTECTED]>
+
+Adds missing call to phys_to_virt() in the
+lib/swiotlb.c:swiotlb_sync_sg() function.  Without this change, a kernel
+panic will always occur whenever a SWIOTLB bounce buffer from a
+scatter-gather list gets synced.
+
+Signed-off-by: David Moore <[EMAIL PROTECTED]>
+Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
+---
+
+This is a fraction of patch "[IA64] swiotlb bug fixes" in 2.6.20-git#,
+commit cde14bbfb3aa79b479db35bd29e6c083513d8614.  Unlike its heading
+suggests, it is also important for EM64T.
+
+Example crashes caused by swiotlb_sync_sg:
+http://lists.opensuse.org/opensuse-bugs/2006-12/msg02943.html
+http://qa.mandriva.com/show_bug.cgi?id=28224
+http://www.pchdtv.com/forum/viewtopic.php?t=2063&sid=a959a14a4c2db0eebaab7b0df56103ce
+
+--- linux-2.6.20.orig/lib/swiotlb.c    2007-02-04 13:18:41.000000000 -0500
++++ linux-2.6.20/lib/swiotlb.c 2007-02-04 13:19:43.000000000 -0500
+@@ -750,7 +750,7 @@ swiotlb_sync_sg(struct device *hwdev, st
+ 
+       for (i = 0; i < nelems; i++, sg++)
+               if (sg->dma_address != SG_ENT_PHYS_ADDRESS(sg))
+-                      sync_single(hwdev, (void *) sg->dma_address,
++                      sync_single(hwdev, phys_to_virt(sg->dma_address),
+                                   sg->dma_length, dir, target);
+ }
+ 

Added: 
packages/cooker/kernel-linus/current/SOURCES/02_ieee1394-video1394-DMA-fix.patch
==============================================================================
--- (empty file)
+++ 
packages/cooker/kernel-linus/current/SOURCES/02_ieee1394-video1394-DMA-fix.patch
    Sat Feb 17 23:12:31 2007
@@ -0,0 +1,49 @@
+Date: Sat, 03 Feb 2007 03:09:09 -0500
+From: David Moore <[EMAIL PROTECTED]>
+
+This together with the phys_to_virt fix in lib/swiotlb.c::swiotlb_sync_sg
+fixes video1394 DMA on machines with DMA bounce buffers, especially Intel
+x86-64 machines with > 3GB RAM.
+
+Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
+Signed-off-by: David Moore <[EMAIL PROTECTED]>
+Tested-by: Nicolas Turro <[EMAIL PROTECTED]>
+---
+ drivers/ieee1394/video1394.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+same as commit a5782010b4e75cba571357efaa27df22a89427c2 in linux-2.6.20-git#
+
+Index: linux-2.6.20/drivers/ieee1394/video1394.c
+===================================================================
+--- linux-2.6.20.orig/drivers/ieee1394/video1394.c
++++ linux-2.6.20/drivers/ieee1394/video1394.c
+@@ -489,6 +489,9 @@ static void wakeup_dma_ir_ctx(unsigned l
+                       reset_ir_status(d, i);
+                       d->buffer_status[d->buffer_prg_assignment[i]] = 
VIDEO1394_BUFFER_READY;
+                       
do_gettimeofday(&d->buffer_time[d->buffer_prg_assignment[i]]);
++                      dma_region_sync_for_cpu(&d->dma,
++                              d->buffer_prg_assignment[i] * d->buf_size,
++                              d->buf_size);
+               }
+       }
+ 
+@@ -1096,6 +1099,8 @@ static long video1394_ioctl(struct file 
+                       DBGMSG(ohci->host->id, "Starting iso transmit DMA 
ctx=%d",
+                              d->ctx);
+                       put_timestamp(ohci, d, d->last_buffer);
++                      dma_region_sync_for_device(&d->dma,
++                              v.buffer * d->buf_size, d->buf_size);
+ 
+                       /* Tell the controller where the first program is */
+                       reg_write(ohci, d->cmdPtr,
+@@ -1111,6 +1116,9 @@ static long video1394_ioctl(struct file 
+                                     "Waking up iso transmit dma ctx=%d",
+                                     d->ctx);
+                               put_timestamp(ohci, d, d->last_buffer);
++                              dma_region_sync_for_device(&d->dma,
++                                      v.buffer * d->buf_size, d->buf_size);
++
+                               reg_write(ohci, d->ctrlSet, 0x1000);
+                       }
+               }

Added: 
packages/cooker/kernel-linus/current/SOURCES/03_ieee1394-fix-host-device-registering-when-nodemgr-disabled.patch
==============================================================================
--- (empty file)
+++ 
packages/cooker/kernel-linus/current/SOURCES/03_ieee1394-fix-host-device-registering-when-nodemgr-disabled.patch
    Sat Feb 17 23:12:31 2007
@@ -0,0 +1,72 @@
+Date: Tue, 6 Feb 2007 02:34:45 +0100 (CET)
+From: Stefan Richter <[EMAIL PROTECTED]>
+
+Since my commit 8252bbb1363b7fe963a3eb6f8a36da619a6f5a65 in 2.6.20-rc1,
+host devices have a dummy driver attached.  Alas the driver was not
+registered before use if ieee1394 was loaded with disable_nodemgr=1.
+
+This resulted in non-functional FireWire drivers or kernel lockup.
+http://bugzilla.kernel.org/show_bug.cgi?id=7942
+
+Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
+---
+ drivers/ieee1394/nodemgr.c |   24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+same as commit 91efa462054d44ae52b0c6c8325ed5e899f2cd17 in linux-2.6.20-git#
+
+(Side note:  The parameter disable_nodemgr=1 is merely an optional
+tuning parameter for people who know what they are doing and who don't
+need device discovery and bus management.)
+
+Index: linux-2.6.20/drivers/ieee1394/nodemgr.c
+===================================================================
+--- linux-2.6.20.orig/drivers/ieee1394/nodemgr.c
++++ linux-2.6.20/drivers/ieee1394/nodemgr.c
+@@ -274,7 +274,6 @@ static struct device_driver nodemgr_mid_
+ struct device nodemgr_dev_template_host = {
+       .bus            = &ieee1394_bus_type,
+       .release        = nodemgr_release_host,
+-      .driver         = &nodemgr_mid_layer_driver,
+ };
+ 
+ 
+@@ -1889,22 +1888,31 @@ int init_ieee1394_nodemgr(void)
+ 
+       error = class_register(&nodemgr_ne_class);
+       if (error)
+-              return error;
+-
++              goto fail_ne;
+       error = class_register(&nodemgr_ud_class);
+-      if (error) {
+-              class_unregister(&nodemgr_ne_class);
+-              return error;
+-      }
++      if (error)
++              goto fail_ud;
+       error = driver_register(&nodemgr_mid_layer_driver);
++      if (error)
++              goto fail_ml;
++      /* This driver is not used if nodemgr is off (disable_nodemgr=1). */
++      nodemgr_dev_template_host.driver = &nodemgr_mid_layer_driver;
++
+       hpsb_register_highlevel(&nodemgr_highlevel);
+       return 0;
++
++fail_ml:
++      class_unregister(&nodemgr_ud_class);
++fail_ud:
++      class_unregister(&nodemgr_ne_class);
++fail_ne:
++      return error;
+ }
+ 
+ void cleanup_ieee1394_nodemgr(void)
+ {
+       hpsb_unregister_highlevel(&nodemgr_highlevel);
+-
++      driver_unregister(&nodemgr_mid_layer_driver);
+       class_unregister(&nodemgr_ud_class);
+       class_unregister(&nodemgr_ne_class);
+ }

Added: 
packages/cooker/kernel-linus/current/SOURCES/04_fix-oops-in-xfrm_audit_log.patch
==============================================================================
--- (empty file)
+++ 
packages/cooker/kernel-linus/current/SOURCES/04_fix-oops-in-xfrm_audit_log.patch
    Sat Feb 17 23:12:31 2007
@@ -0,0 +1,113 @@
+
+From: Joy Latten <[EMAIL PROTECTED]>
+Date: Mon, 12 Feb 2007 11:44:30 -0600
+
+> This is similar to another bug reported last month.
+> Here is the patch I sent out then. Please let me know
+> how it goes.
+> 
+> Signed-off-by: Joy Latten <[EMAIL PROTECTED]>
+
+This whole interface is a complete mess.
+
+Calling xfrm_audit_log() without the proper object being non-NULL
+should be a bug.  And that's exactly what you fixed in the xfrm_user
+case, so there is zero reason to silently allow this condition, we
+should just BUG() on it.
+
+But the logging function has this "result" thing, that in some cases
+is set to 1 if "xp" or "x" is not-NULL by the callers, this is just
+silly.
+
+You can't log the event if the proper object is NULL, so the "result"
+parameter and log information is useless in those cases.
+
+Also, you missed the same exact identical bug in the AF_KEY code.
+
+Thus, below is the patch I will use to fix this bug:
+
+1) Calling xfrm_audit_log() with a NULL object is a BUG()
+2) Setting "result" based upon NULL'ness of the object makes no
+   sense, either set it to "1" in these cases or use an appropriate
+   error check.
+
+How does this look to others?
+
+diff --git a/net/key/af_key.c b/net/key/af_key.c
+index f3a026f..1c58204 100644
+--- a/net/key/af_key.c
++++ b/net/key/af_key.c
+@@ -2297,16 +2297,17 @@ static int pfkey_spddelete(struct sock *sk, struct 
sk_buff *skb, struct sadb_msg
+                                  &sel, tmp.security, 1);
+       security_xfrm_policy_free(&tmp);
+ 
+-      xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
+-                     AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, NULL);
+-
+       if (xp == NULL)
+               return -ENOENT;
+ 
+-      err = 0;
++      err = security_xfrm_policy_delete(xp);
+ 
+-      if ((err = security_xfrm_policy_delete(xp)))
++      xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
++                     AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
++
++      if (err)
+               goto out;
++
+       c.seq = hdr->sadb_msg_seq;
+       c.pid = hdr->sadb_msg_pid;
+       c.event = XFRM_MSG_DELPOLICY;
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
+index a24f385..c394b41 100644
+--- a/net/xfrm/xfrm_policy.c
++++ b/net/xfrm/xfrm_policy.c
+@@ -1997,9 +1997,14 @@ void xfrm_audit_log(uid_t auid, u32 sid, int type, int 
result,
+       if (audit_enabled == 0)
+               return;
+ 
++      BUG_ON((type == AUDIT_MAC_IPSEC_ADDSA ||
++              type == AUDIT_MAC_IPSEC_DELSA) && !x);
++      BUG_ON((type == AUDIT_MAC_IPSEC_ADDSPD ||
++              type == AUDIT_MAC_IPSEC_DELSPD) && !xp);
++
+       audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, type);
+       if (audit_buf == NULL)
+-      return;
++              return;
+ 
+       switch(type) {
+       case AUDIT_MAC_IPSEC_ADDSA:
+diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
+index d55436d..2567453 100644
+--- a/net/xfrm/xfrm_user.c
++++ b/net/xfrm/xfrm_user.c
+@@ -1273,10 +1273,6 @@ static int xfrm_get_policy(struct sk_buff *skb, struct 
nlmsghdr *nlh,
+               xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security, 
delete);
+               security_xfrm_policy_free(&tmp);
+       }
+-      if (delete)
+-              xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
+-                             AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, NULL);
+-
+       if (xp == NULL)
+               return -ENOENT;
+ 
+@@ -1292,8 +1288,14 @@ static int xfrm_get_policy(struct sk_buff *skb, struct 
nlmsghdr *nlh,
+                                             MSG_DONTWAIT);
+               }
+       } else {
+-              if ((err = security_xfrm_policy_delete(xp)) != 0)
++              err = security_xfrm_policy_delete(xp);
++
++              xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
++                             AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
++
++              if (err != 0)
+                       goto out;
++
+               c.data.byid = p->index;
+               c.event = nlh->nlmsg_type;
+               c.seq = nlh->nlmsg_seq;

Added: packages/cooker/kernel-linus/current/SOURCES/05_md-raid5-fix-crash.patch
==============================================================================
--- (empty file)
+++ packages/cooker/kernel-linus/current/SOURCES/05_md-raid5-fix-crash.patch    
Sat Feb 17 23:12:31 2007
@@ -0,0 +1,125 @@
+
+On Sunday February 11, [EMAIL PROTECTED] wrote:
+> Greetings,
+> 
+> I've been running md on my server for some time now and a few days ago one of
+> the (3) drives in the raid5 array starting giving read errors. The result was
+> usually system hangs and this was with kernel 2.6.17.13. I upgraded to the
+> latest production 2.6.20 kernel and experienced the same behaviour. 
+
+System hangs suggest a problem with the drive controller.  However
+this "kernel BUG" is something newly introduced in 2.6.20 which should
+be fixed in 2.6.20.1.  Patch is below.
+
+If you still get hangs with this patch installed, then please report
+detail, and probably copy to [EMAIL PROTECTED]
+
+NeilBrown
+
+
+Fix various bugs with aligned reads in RAID5.
+
+It is possible for raid5 to be sent a bio that is too big
+for an underlying device.  So if it is a READ that we
+pass stright down to a device, it will fail and confuse
+RAID5.
+
+So in 'chunk_aligned_read' we check that the bio fits within the
+parameters for the target device and if it doesn't fit, fall back
+on reading through the stripe cache and making lots of one-page
+requests.
+
+Note that this is the earliest time we can check against the device
+because earlier we don't have a lock on the device, so it could change
+underneath us.
+
+Also, the code for handling a retry through the cache when a read
+fails has not been tested and was badly broken.  This patch fixes that
+code.
+
+Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
+
+### Diffstat output
+ ./drivers/md/raid5.c |   42 +++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 39 insertions(+), 3 deletions(-)
+
+diff .prev/drivers/md/raid5.c ./drivers/md/raid5.c
+--- .prev/drivers/md/raid5.c   2007-02-07 10:22:22.000000000 +1100
++++ ./drivers/md/raid5.c       2007-02-06 19:19:01.000000000 +1100
+@@ -2570,7 +2570,7 @@ static struct bio *remove_bio_from_retry
+       }
+       bi = conf->retry_read_aligned_list;
+       if(bi) {
+-              conf->retry_read_aligned = bi->bi_next;
++              conf->retry_read_aligned_list = bi->bi_next;
+               bi->bi_next = NULL;
+               bi->bi_phys_segments = 1; /* biased count of active stripes */
+               bi->bi_hw_segments = 0; /* count of processed stripes */
+@@ -2619,6 +2619,27 @@ static int raid5_align_endio(struct bio 
+       return 0;
+ }
+ 
++static int bio_fits_rdev(struct bio *bi)
++{
++      request_queue_t *q = bdev_get_queue(bi->bi_bdev);
++
++      if ((bi->bi_size>>9) > q->max_sectors)
++              return 0;
++      blk_recount_segments(q, bi);
++      if (bi->bi_phys_segments > q->max_phys_segments ||
++          bi->bi_hw_segments > q->max_hw_segments)
++              return 0;
++
++      if (q->merge_bvec_fn)
++              /* it's too hard to apply the merge_bvec_fn at this stage,
++               * just just give up
++               */
++              return 0;
++
++      return 1;
++}
++
++
+ static int chunk_aligned_read(request_queue_t *q, struct bio * raid_bio)
+ {
+       mddev_t *mddev = q->queuedata;
+@@ -2665,6 +2686,13 @@ static int chunk_aligned_read(request_qu
+               align_bi->bi_flags &= ~(1 << BIO_SEG_VALID);
+               align_bi->bi_sector += rdev->data_offset;
+ 
++              if (!bio_fits_rdev(align_bi)) {
++                      /* too big in some way */
++                      bio_put(align_bi);
++                      rdev_dec_pending(rdev, mddev);
++                      return 0;
++              }
++
+               spin_lock_irq(&conf->device_lock);
+               wait_event_lock_irq(conf->wait_for_stripe,
+                                   conf->quiesce == 0,
+@@ -3055,7 +3083,9 @@ static int  retry_aligned_read(raid5_con
+       last_sector = raid_bio->bi_sector + (raid_bio->bi_size>>9);
+ 
+       for (; logical_sector < last_sector;
+-           logical_sector += STRIPE_SECTORS, scnt++) {
++           logical_sector += STRIPE_SECTORS,
++                   sector += STRIPE_SECTORS,
++                   scnt++) {
+ 
+               if (scnt < raid_bio->bi_hw_segments)
+                       /* already done this stripe */
+@@ -3071,7 +3101,13 @@ static int  retry_aligned_read(raid5_con
+               }
+ 
+               set_bit(R5_ReadError, &sh->dev[dd_idx].flags);
+-              add_stripe_bio(sh, raid_bio, dd_idx, 0);
++              if (!add_stripe_bio(sh, raid_bio, dd_idx, 0)) {
++                      release_stripe(sh);
++                      raid_bio->bi_hw_segments = scnt;
++                      conf->retry_read_aligned = raid_bio;
++                      return handled;
++              }
++
+               handle_stripe(sh, NULL);
+               release_stripe(sh);
+               handled++;

Added: 
packages/cooker/kernel-linus/current/SOURCES/06_md-raid5-fix-export-blk_recount_segments.patch
==============================================================================
--- (empty file)
+++ 
packages/cooker/kernel-linus/current/SOURCES/06_md-raid5-fix-export-blk_recount_segments.patch
      Sat Feb 17 23:12:31 2007
@@ -0,0 +1,24 @@
+On Monday February 12, [EMAIL PROTECTED] wrote:
+> 
+> Thanks for the quick response Neil unfortunately the kernel doesn't build 
with
+> this patch due to a missing symbol:
+> 
+> WARNING: "blk_recount_segments" [drivers/md/raid456.ko] undefined!
+> 
+> Is that in another file that needs patching or within raid5.c?
+
+Yes.  I keep forgetting about that bit. Sorry.
+
+
+diff -puN 
block/ll_rw_blk.c~md-fix-various-bugs-with-aligned-reads-in-raid5-fix 
block/ll_rw_blk.c
+--- a/block/ll_rw_blk.c~md-fix-various-bugs-with-aligned-reads-in-raid5-fix
++++ a/block/ll_rw_blk.c
+@@ -1264,7 +1264,7 @@ new_hw_segment:
+       bio->bi_hw_segments = nr_hw_segs;
+       bio->bi_flags |= (1 << BIO_SEG_VALID);
+ }
+-
++EXPORT_SYMBOL(blk_recount_segments);
+ 
+ static int blk_phys_contig_segment(request_queue_t *q, struct bio *bio,
+                                  struct bio *nxt)

Modified: packages/cooker/kernel-linus/current/SPECS/kernel-linus.spec
==============================================================================
--- packages/cooker/kernel-linus/current/SPECS/kernel-linus.spec        
(original)
+++ packages/cooker/kernel-linus/current/SPECS/kernel-linus.spec        Sat Feb 
17 23:12:31 2007
@@ -165,6 +165,15 @@
 Source10:       
ftp://ftp.kernel.org/pub/linux/kernel/v%{kernelversion}.%{patchlevel}/patch-%{kversion}.bz2.sign
 %endif
 
+### Patches from upcoming 2.6.20.1, will be removed when that version is out...
+Patch101:      01_fix-missing-critical-phys_to_virt-in-lib_swiotlb.patch
+Patch102:      02_ieee1394-video1394-DMA-fix.patch
+Patch103:      
03_ieee1394-fix-host-device-registering-when-nodemgr-disabled.patch
+Patch104:      04_fix-oops-in-xfrm_audit_log.patch
+Patch105:      05_md-raid5-fix-crash.patch
+Patch106:      06_md-raid5-fix-export-blk_recount_segments.patch
+               
+
 #END
 ####################################################################
 
@@ -473,6 +482,15 @@
 %if %kstable
 %patch1 -p1
 %endif
+
+### Patches from upcoming 2.6.20.1, will be removed when that version is out...
+%patch101 -p1
+%patch102 -p1
+%patch103 -p1
+%patch104 -p1
+%patch105 -p1
+%patch106 -p1
+
 popd
 
 # PATCH END
@@ -1061,7 +1079,14 @@
   introduce kernel-linus-(smp-)headers(-latest) rpms to build 3rdparty 
   drivers against (survives test: make mrproper oldconfig prepare scripts)
   kernel-linus-source rpm does not include any autoconf stuff anymore
-
+- add bugfixes from upcoming 2.6.20.1 (will be removed when it's released)
+  01_fix-missing-critical-phys_to_virt-in-lib_swiotlb.patch
+  02_ieee1394-video1394-DMA-fix.patch
+  03_ieee1394-fix-host-device-registering-when-nodemgr-disabled.patch
+  04_fix-oops-in-xfrm_audit_log.patch
+  05_md-raid5-fix-crash.patch
+  06_md-raid5-fix-export-blk_recount_segments.patch
+  
 * Mon Feb  5 2007 Thomas Backlund <[EMAIL PROTECTED]> 2.6.20-1mdv
 - update to kernel.org 2.6.20 final
 

Reply via email to