bugGNU GRUB - Bugs: bug #30221, Disk cache is not working properly

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #30221: Disk cache is not working properly

Submitter:  Ales Nesrsta <starous>
Submitted:  Tue 22 Jun 2010 07:43:33 PM UTC
   
 
Category:  Disk & Partition Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name:  starous
Open/Closed:  Closed Release:  Bazaar - trunk
Release:  Reproducibility:  Intermittent
Planned Release:  None

Jump to the original submission

Tue 20 Jul 2010 02:16:17 PM UTC, comment #6: 

committed a while ago

Vladimir Serbinenko <phcoder>
Group administrator
Thu 08 Jul 2010 09:20:12 PM UTC, comment #5: 

Hi Vladimir,

could you commit your patch into usb (at least; better it will be commit patch into trunk also) and close this bug?
(Newly added hot-plugging needs it for correct work.)

Regards, Ales

Ales Nesrsta <starous>
Group Member
Mon 05 Jul 2010 05:17:04 PM UTC, comment #4: 

Hi Vladimir,

my simple patch has probably problem with alignment of DWORD on some architectures. It can be simply changed into safer code - but your patch is more systematic solution and it works fine on both my testing machines - thanks for it.

Regards, Ales

Ales Nesrsta <starous>
Group Member
Sat 03 Jul 2010 08:32:21 PM UTC, comment #3: 

Try attached patch please

(file #20888)

Vladimir Serbinenko <phcoder>
Group administrator
Sat 03 Jul 2010 08:31:18 PM UTC, comment #2: 

Your patch has multiple problems including crash on RISC platforms

(file #20887)

Vladimir Serbinenko <phcoder>
Group administrator
Fri 25 Jun 2010 09:22:54 PM UTC, comment #1: 

Hi,

I probably found why disk cache is not working properly.
It seems to be related to scsi.c module - it does not set disk->id to be unique for each scsi disk.

This patch

diff -urB ./usb/disk/scsi.c ./usb_patched/disk/scsi.c
--- ./usb/disk/scsi.c 2010-06-25 23:06:58.000000000 +0200
+++ ./usb_patched/disk/scsi.c 2010-06-25 22:59:46.000000000 +0200
@@ -379,7 +379,7 @@
       if (p->open (name, scsi))
  continue;
 
-      disk->id = (unsigned long) "scsi"; /* XXX */
+      disk->id = ((unsigned long)&name[len-4]); /* XXX: Must be unique for each disk for disk cache ! */
       disk->data = scsi;
       scsi->dev = p;
       scsi->lun = lun;

should simply correct this problem.

Does anybody have also this problem and can test this patch ?
Or does anybody some better idea how to set disk->id ?

Regards
Ales

Ales Nesrsta <starous>
Group Member
Tue 22 Jun 2010 07:43:33 PM UTC, original submission:  

Hi,

when I made some experiments with more USB devices connected at one time, I found some disk cache related problem.

Behavior is:

If I connect more than one USB disk (or multi-LUN device), then very often happens following error after first time use of "ls (usbx,y)/" command, specially if x>0:
grub> insmod uhci
grub> insmod usbms
grub> ls
(usb0) (usb0, msdos1) (usb1) (usb1, msdos1) ...

grub> ls (usb1,1)/
error: unknown filesystem

If I try the same command second time, it is working normally.

From USB side is not indicated any error.

I tried to disable cache via simple stupid change in disk.c in function grub_disk_read:
...
      /* Fetch the cache.  */
      /* data = grub_disk_cache_fetch (disk->dev->id, disk->id, start_sector); */
      data = NULL;
      if (data)
...
and in this case "ls" is working normally every time (but, of course,  slowly...).

So, it looks like in disk cache is some bug.
(It probably appears only if more disks with more partitions are used, I think it is not related to USB disks only.)

I found this problem in experimental branch "usb" but "trunk" has the same behavior (official release 1.98 I did not test).

Best regards
Ales

Ales Nesrsta <starous>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #20888:  scsi.diff added by phcoder (8KiB - text/x-diff)
file #20887:  scsi.diff added by phcoder (8KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by phcoder (Updated the item)
  • -email is unavailable- added by starous (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-20 phcoder StatusNone Fixed
        Open/ClosedOpen Closed
    2010-07-03 phcoder Attached File- Added scsi.diff, #20888
    2010-07-03 phcoder Attached File- Added scsi.diff, #20887

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code