linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "BERTRAND Joël" <joel.bertrand@systella.fr>
To: blackmagic02881@gmail.com
Cc: linux-raid@vger.kernel.org, sparclinux@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	iscsitarget-devel@lists.sourceforge.net,
	Bill Davidsen <davidsen@tmr.com>
Subject: Re: [BUG] Raid1/5 over iSCSI trouble
Date: Mon, 29 Oct 2007 11:40:05 +0100	[thread overview]
Message-ID: <4725B885.8070705@systella.fr> (raw)
In-Reply-To: <1193519604.4060.10.camel@localhost.localdomain>

Ming Zhang wrote:
> off topic, could you resubmit the alignment issue patch to list and see
> if tomof accept. he needs a patch inlined in email. it is found and
> fixed by you, so had better you post it (instead of me). thx.

diff -u kernel.old/iscsi.c kernel/iscsi.c
--- kernel.old/iscsi.c  2007-10-29 09:49:16.000000000 +0100
+++ kernel/iscsi.c      2007-10-17 11:19:14.000000000 +0200
@@ -726,13 +726,26 @@
         case READ_10:
         case WRITE_10:
         case WRITE_VERIFY:
-               *off = be32_to_cpu(*(u32 *)&cmd[2]);
+               *off = be32_to_cpu((((u32) cmd[2]) << 24) |
+                       (((u32) cmd[3]) << 16) |
+                       (((u32) cmd[4]) << 8) |
+                       cmd[5]);
                 *len = (cmd[7] << 8) + cmd[8];
                 break;
         case READ_16:
         case WRITE_16:
-               *off = be64_to_cpu(*(u64 *)&cmd[2]);
-               *len = be32_to_cpu(*(u32 *)&cmd[10]);
+               *off = be32_to_cpu((((u64) cmd[2]) << 56) |
+                       (((u64) cmd[3]) << 48) |
+                       (((u64) cmd[4]) << 40) |
+                       (((u64) cmd[5]) << 32) |
+                       (((u64) cmd[6]) << 24) |
+                       (((u64) cmd[7]) << 16) |
+                       (((u64) cmd[8]) << 8) |
+                       cmd[9]);
+               *len = be32_to_cpu((((u32) cmd[10]) << 24) |
+                       (((u32) cmd[11]) << 16) |
+                       (((u32) cmd[12]) << 8) |
+                       cmd[13]);
                 break;
         default:
                 BUG();
diff -u kernel.old/target_disk.c kernel/target_disk.c
--- kernel.old/target_disk.c    2007-10-29 09:49:16.000000000 +0100
+++ kernel/target_disk.c        2007-10-17 16:04:06.000000000 +0200
@@ -66,13 +66,15 @@
         unsigned char geo_m_pg[] = {0x04, 0x16, 0x00, 0x00, 0x00, 0x40, 
0x00, 0x
00,
                                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x
00,
                                     0x00, 0x00, 0x00, 0x00, 0x3a, 0x98, 
0x00, 0x
00};
-       u32 ncyl, *p;
+       u32 ncyl;
+       u32 n;

         /* assume 0xff heads, 15krpm. */
         memcpy(ptr, geo_m_pg, sizeof(geo_m_pg));
         ncyl = sec >> 14; /* 256 * 64 */
-       p = (u32 *)(ptr + 1);
-       *p = *p | cpu_to_be32(ncyl);
+       memcpy(&n,ptr+1,sizeof(u32));
+       n = n | cpu_to_be32(ncyl);
+       memcpy(ptr+1, &n, sizeof(u32));
         return sizeof(geo_m_pg);
  }

@@ -249,7 +251,10 @@
         struct iet_volume *lun;
         int rest, idx = 0;

-       size = be32_to_cpu(*(u32 *)&req->scb[6]);
+       size = be32_to_cpu((((u32) req->scb[6]) << 24) |
+                       (((u32) req->scb[7]) << 16) |
+                       (((u32) req->scb[8]) << 8) |
+                       req->scb[9]);
         if (size < 16)
                 return -1;

	Regards,

	JKB

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

  reply	other threads:[~2007-10-29 10:40 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-16 13:24 [BUG] Raid5 trouble BERTRAND Joël
2007-10-17 14:32 ` BERTRAND Joël
2007-10-17 14:58   ` Dan Williams
2007-10-17 15:40     ` Dan Williams
2007-10-17 16:44       ` BERTRAND Joël
2007-10-18  0:46         ` Dan Williams
2007-10-18  8:29           ` BERTRAND Joël
2007-10-19  2:55       ` Bill Davidsen
2007-10-19  8:04         ` BERTRAND Joël
2007-10-19 15:51           ` Dan Williams
2007-10-19 16:03             ` BERTRAND Joël
     [not found]             ` <4718DE66.8000905@tmr.com>
2007-10-19 20:42               ` BERTRAND Joël
2007-10-19 20:49                 ` [BUG] Raid1/5 over iSCSI trouble BERTRAND Joël
2007-10-19 21:02                   ` [Iscsitarget-devel] " Ross S. W. Walker
2007-10-19 21:06                     ` BERTRAND Joël
2007-10-19 21:10                       ` Ross S. W. Walker
2007-10-20  7:45                         ` BERTRAND Joël
2007-10-19 21:11                       ` [Iscsitarget-devel] " Scott Kaelin
2007-10-19 21:04                   ` BERTRAND Joël
2007-10-19 21:08                     ` Ross S. W. Walker
2007-10-19 21:12                     ` Dan Williams
2007-10-20  8:05                       ` BERTRAND Joël
2007-10-24  7:12                         ` BERTRAND Joël
2007-10-24 20:10                           ` Bill Davidsen
2007-10-24 23:49                           ` Dan Williams
2007-10-25  0:03                             ` David Miller
2007-10-27 13:29                             ` BERTRAND Joël
2007-10-27 18:27                               ` Dan Williams
2007-10-27 19:35                                 ` BERTRAND Joël
2007-10-27 21:13                               ` Ming Zhang
2007-10-29 10:40                                 ` BERTRAND Joël [this message]
2007-10-19 21:19                     ` Ming Zhang
2007-10-19 23:50                     ` Bill Davidsen
2007-10-19 23:58                       ` Bill Davidsen
2007-10-20  7:52                       ` BERTRAND Joël
2007-10-17 16:07     ` [BUG] Raid5 trouble BERTRAND Joël

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4725B885.8070705@systella.fr \
    --to=joel.bertrand@systella.fr \
    --cc=blackmagic02881@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=davidsen@tmr.com \
    --cc=iscsitarget-devel@lists.sourceforge.net \
    --cc=linux-raid@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).