From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: Re: FW: Re. Allocation of scatter gather table in __init_io Date: Mon, 9 Aug 2004 10:36:26 +0200 Sender: linux-scsi-owner@vger.kernel.org Message-ID: <20040809083625.GP10418@suse.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from ns.virtualhost.dk ([195.184.98.160]:7606 "EHLO virtualhost.dk") by vger.kernel.org with ESMTP id S266334AbUHIIhB (ORCPT ); Mon, 9 Aug 2004 04:37:01 -0400 Content-Disposition: inline In-Reply-To: List-Id: linux-scsi@vger.kernel.org To: "Govindan, Thiru" Cc: "'linux-scsi@vger.kernel.org'" On Mon, Aug 09 2004, Govindan, Thiru wrote: > Hi, > I'm running into an issue that seems to be caused by __init_io() > in scsi_merge.c. Apparently __init_io() is allocating the scatter > gather list before even merging the segments in the queue. In my > case the request nr_segments has a value of 2 and the scatter > gather table is allocated for 2 entries. But then the logic > merges the 2 segments into 1 and fills in one entry, my HBA driver > complains that one entry is invalid and panics. Can you clarify > how this works, I suppose getting mergeable segments in a request > is common and hence __init_io() must allocate the table after > having at least identified how may segments are really there. > > Is this a known issue and is there a patch that fixes this? It has to allocate the space for the table to hold all items, so it's expected. Sounds like you are not using the correct return value to check what segment count you should pass the hardware. -- Jens Axboe