Opened 14 years ago

Closed 13 years ago

#6305 closed bug (fixed)

Problem with ext3 volumes

Reported by: jackburton Owned by: korli
Priority: normal Milestone: R1
Component: File Systems/ext2 Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Since some time (I can't tell from which revision, since I don't use Haiku daily), trying to read from ext3 volumes causes some problems. From tracker, trying to descend into more than 3 levels of subdirectories causes a crash (backtrace attached). From the terminal, some commands fail in a weird way (ls | less causes a "cannot find less") or something like this). Actually I think there are 2 problems here:

  1. The ext2/3 fs module passes some weird data
  2. Tracker shouldn't crash when it receives weird data from the fs modules

Filing into general for now. Gcc2 hybrid, hrev37487.

Attachments (3)

crash.txt (5.2 KB ) - added by jackburton 14 years ago.
Backtrace of the crash
htree_update.patch (38.9 KB ) - added by jvff 14 years ago.
This is an updated patch of the same code. I'm not sure it fixes the crash, but it will output more information to help find the cause.
ext3.log (410.1 KB ) - added by jackburton 14 years ago.
tail -f /var/log/syslog from mounting to crash

Download all attachments as: .zip

Change History (29)

by jackburton, 14 years ago

Attachment: crash.txt added

Backtrace of the crash

comment:1 by jackburton, 14 years ago

I guess the culprit could be hrev37295.

comment:2 by korli, 14 years ago

Component: - GeneralFile Systems/ext2
Owner: changed from nobody to korli
Status: newassigned

To be honest, I only remind of having tested with one level of directories. I'm unsure what can be exactly failing from the crash trace.

by jvff, 14 years ago

Attachment: htree_update.patch added

This is an updated patch of the same code. I'm not sure it fixes the crash, but it will output more information to help find the cause.

comment:3 by jvff, 14 years ago

patch: 01

by jackburton, 14 years ago

Attachment: ext3.log added

tail -f /var/log/syslog from mounting to crash

comment:4 by jackburton, 14 years ago

This is with the patch applied, of course.

comment:5 by jvff, 14 years ago

I'm sorry, I'm still confused about what's causing this =(. Could you tell me how to reproduce this error? Do you think it's possible to narrow down to what is causing the crash? A specific file or directory? Is there a test image you could send me so I can try to figure it out? Thank you.

comment:6 by korli, 14 years ago

Stefano, is the problem still here without hrev37295? I ask because attribute support was also added a few months ago.

in reply to:  6 comment:7 by jackburton, 14 years ago

Replying to korli:

Stefano, is the problem still here without hrev37295? I ask because attribute support was also added a few months ago.

Sorry for the late reply. I'll try hrev37294 and report back.

comment:8 by jackburton, 14 years ago

hrev37294 confirmed to work fine. hrev37295 and later crash.

in reply to:  5 comment:9 by jackburton, 14 years ago

Replying to jvff:

I'm sorry, I'm still confused about what's causing this =(. Could you tell me how to reproduce this error? Do you think it's possible to narrow down to what is causing the crash? A specific file or directory? Is there a test image you could send me so I can try to figure it out? Thank you.

Unfortunately the only ext3 partition I have is the one with my personal data, so I can't send the image to you. As I said, the crash happens as soon as I descend to the 3rd level of directories:

  1. Root
  2. Home
  3. Stefano (my username in linux)

comment:10 by jackburton, 14 years ago

By the way, Coverity says there's an array overrun in /src/add-ons/kernel/file_systems/ext2/HTree.cpp, line 250, since the array contains 4 elements, and the loop tries to access the 6th.

in reply to:  10 comment:11 by jvff, 14 years ago

Replying to jackburton:

By the way, Coverity says there's an array overrun in /src/add-ons/kernel/file_systems/ext2/HTree.cpp, line 250, since the array contains 4 elements, and the loop tries to access the 6th.

IIRC, that's already fixed in the patch I posted =). Thank you for the heads up though!

comment:12 by korli, 14 years ago

Stefano, could you please check with hrev38573? Thanks

in reply to:  12 comment:13 by jackburton, 14 years ago

Replying to korli:

Stefano, could you please check with hrev38573? Thanks

Will do later when I get home.

comment:14 by jackburton, 14 years ago

I tested briefly, and Tracker still crashes just like before. Doing any operations in the ext3 volume from Terminal works, though. I'll try to do more testing in the next days to see if I can give more info.

comment:15 by korli, 14 years ago

Looking again at the stacktrace it looks the same as in #4037

I had a look at BContainerWindow::AddMimeTypesToMenu(BMenu *menu), to me it looks like it forgets to check the BPath sanity.

Could you try something like this ?

        // Add MIME type in case we're a default query type window
        if (TargetModel() != NULL) {
                BPath path;
                TargetModel()->GetPath(&path);
                if (path.InitCheck() == B_OK 
                        && strstr(path.Path(), "/" kQueryTemplates "/") != NULL) {
                        // demangle MIME type name
                        BString name(TargetModel()->Name());
                        name.ReplaceFirst('_', '/');

                        PoseView()->AddMimeType(name.String());
                }
        }

comment:16 by humdinger, 14 years ago

Isn't this more of a Tracker issue? Navigating in Terminal works.

comment:17 by aldeck, 14 years ago

Owner: changed from korli to aldeck
Status: assignedin-progress

I can't tell clearly from the comments if there was indeed an FS issue and if it's still there. In any case i'm looking at the Tracker issue :)

comment:18 by aldeck, 14 years ago

I can reproduce each time, going deeper than 3 dirs fails, with BPath::SetTo(entry_ref) misbehaving. The ref is valid though (everything else appears to be working except where Tracker relies on the BPath) thus maybe explaining why Terminal is unafected.

So it seems the problem is on the fs side, failing in _kern_entry_ref_to_path().

Still i will add checks with alerts in Tracker although a proper fs error/user feedback strategy has yet to be implemented.

in reply to:  18 comment:19 by korli, 14 years ago

Replying to aldeck:

I can reproduce each time, going deeper than 3 dirs fails, with BPath::SetTo(entry_ref) misbehaving. The ref is valid though (everything else appears to be working except where Tracker relies on the BPath) thus maybe explaining why Terminal is unafected.

So it seems the problem is on the fs side, failing in _kern_entry_ref_to_path().

Could you be more specific on the failure (error code for instance) ? Because I'm still clueless. Thanks.

comment:20 by aldeck, 14 years ago

Ok, sorry, here is a small test.

#include <Entry.h>
#include <Path.h>

#include <stdio.h>
#include <string.h>


int 
main(int argc, char **argv)
{
	BEntry entry("/unnamed volume/home/alex/.bashrc");

	status_t err = entry.InitCheck();
	printf("entry.InitCheck() == %li (%s)\n", err, strerror(err));		
	
	BPath path;		
	err = entry.GetPath(&path);
	printf("entry.GetPath() == %li (%s)\n", err, strerror(err));		
	
	err = path.InitCheck();
	printf("path.InitCheck() == %li (%s) path.Path() == '%s'\n", err, strerror(err), path.Path());		
	
	return 0;
}

Output:

entry.InitCheck() == 0 (No error)
entry.GetPath() == -2147459069 (No such file or directory)
path.InitCheck() == -2147459069 (No such file or directory) path.Path() == '(null)'

Output for one level up ie: "/unnamed volume/home/alex"

entry.InitCheck() == 0 (No error)
entry.GetPath() == 0 (No error)
path.InitCheck() == 0 (No error) path.Path() == '/unnamed volume/home/alex'

comment:21 by aldeck, 14 years ago

Owner: changed from aldeck to korli
Status: in-progressassigned

I'd like to work on other things, i'll wait for progress on the fs issue. (which is out of my league, if i need to precise :))

comment:22 by korli, 13 years ago

Could you please try again with a current revision? Thanks.

comment:23 by aldeck, 13 years ago

My test above still fails on hrev39530. Btw shouldn't entry.InitCheck() return an error when entry.GetPath() fails?

comment:24 by korli, 13 years ago

I reproduced and commit a fix in hrev39809. Please validate.

comment:25 by humdinger, 13 years ago

It's fixed for me! Thank you, thank you, thank you!

comment:26 by jackburton, 13 years ago

Resolution: fixed
Status: assignedclosed

Fixed for me too.

Note: See TracTickets for help on using tickets.