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

Submitted by:  Ales Nesrsta <starous>
Submitted on:  Tue 22 Jun 2010 07:43:33 PM UTC  
 
Category: Disk & PartitionSeverity: Major
Priority: 5 - NormalItem Group: Software Error
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: starous
Open/Closed: ClosedRelease: 
Release: Bazaar - trunkReproducibility: Intermittent
Planned Release: None

(Jump to the original submission Jump to the original submission)

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

committed a while ago

Vladimir Serbinenko <phcoder>
Project 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>
Project 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>
Project Member
Sat 03 Jul 2010 08:32:21 PM UTC, comment #3:

Try attached patch please

(file #20888)

Vladimir Serbinenko <phcoder>
Project 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>
Project 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>
Project 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>
Project Member

 

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
  • -unavailable- added by phcoder (Updated the item)
  • -unavailable- added by starous (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 20 Jul 2010 02:16:17 PM UTCphcoderStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sat 03 Jul 2010 08:32:21 PM UTCphcoderAttached File-=>Added scsi.diff, #20888
    Sat 03 Jul 2010 08:31:18 PM UTCphcoderAttached File-=>Added scsi.diff, #20887

    Back to the top


    Powered by Savane 3.1-cleanup1