Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 16 Jun 2004 19:20:43 +0400
From: Michael Tokarev <mjt@....msk.ru>
To: owl-users@...ts.openwall.com
Subject: Re: crash

Solar Designer wrote:
> On Wed, Jun 16, 2004 at 03:59:19PM +0400, Michael Tokarev wrote:
> 
>>Speaking of the patch... The following change, which is
>>in ow patches for quite some time, is rather questionable.
[]
> It's needed for booting off USB CD-ROMs where the device might not be
> detected by the time this code is reached.

Aha.  So how much time is needed for such an USB CD-ROM to became
ready?  1 secound?  10 secounds?  I guess looping for about 10
times max will do the trick -- IF it can't be done by checking
for other error codes as in the switch statement a bit earlier
in the code - here it is in full, after Owl patch:

static void __init mount_block_root(char *name, int flags)
{
         char *fs_names = __getname();
         char *p;

         get_fs_names(fs_names);
retry:
         for (p = fs_names; *p; p += strlen(p)+1) {
                 int err = sys_mount(name, "/root", p, flags, root_mount_data);
                 switch (err) {
                         case 0:
                                 goto out;
                         case -EACCES:
                                 flags |= MS_RDONLY;
                                 goto retry;
                         case -EINVAL:
                         case -EBUSY:
                                 continue;
                 }
                 /*
                  * Allow the user to distinguish between failed open
                  * and bad superblock on root device.
                  */
                 printk ("VFS: Cannot open root device \"%s\" or %s, "
                         "retrying in 1s.\n",
                         root_device_name, kdevname (ROOT_DEV));
                 set_current_state(TASK_UNINTERRUPTIBLE);
                 schedule_timeout(HZ);
                 goto retry;
         }
         panic("VFS: Unable to mount root fs on %s", kdevname(ROOT_DEV));
out:
         putname(fs_names);
         sys_chdir("/root");
         ROOT_DEV = current->fs->pwdmnt->mnt_sb->s_dev;
         printk("VFS: Mounted root (%s filesystem)%s.\n",
                 current->fs->pwdmnt->mnt_sb->s_type->name,
                 (current->fs->pwdmnt->mnt_sb->s_flags & MS_RDONLY) ? " readonly" : "");
}

(BTW, what will set_current_state(TASK_UNINTERRUPTIBLE) do
with the whole kernel in case SECOND retry will be successeful?
Shouldn't there be set_current_state(TASK_INTERRUPTIBLE) somewhere
too?)

> Thank you for pointing out the problem with this and also for sharing
> your approach to replacing kernels with owl-users.

Heh.  I think the approach is quite logical thing to do...
At least I was doing it that way for ages, and it saved
me numerous times in the past from all sorts of various
mistakes i'm doing all the time... ;)

> I agree that this needs to be fixed, but by enhancing this code to
> support a panic timeout rather than by reverting this change like you
> do now.  It will happen sooner if you submit a patch to do that. ;-)

Ok.  I think the attached 3-liner should do the trick,
but TASK_UNINTERRUPTABLE question remains.

/mjt

View attachment "do_mounts.diff" of type "text/plain" (486 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.