Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

various fixes for /ipfs fuse code #4194

Merged
merged 4 commits into from
Sep 6, 2017
Merged

various fixes for /ipfs fuse code #4194

merged 4 commits into from
Sep 6, 2017

Conversation

whyrusleeping
Copy link
Member

Including:

  • allow mount to work when running the daemon in offline mode
  • allow /ipfs interface to handle raw nodes and sharded directories
  • fix an issue in the dagservice where we were returning a blockservice not-found error

@whyrusleeping
Copy link
Member Author

I had some hacking time on the plane yesterday. Yay.

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

switch nd := nd.(type) {
case *mdag.ProtoNode:
return &Node{Ipfs: s.Ipfs, Nd: nd}, nil
case *mdag.RawNode:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) you can just write (I think?):

switch nd := nd.(type) {
    case *mdag.ProtoNode, *mdag.RawNode:
        return &Node{Ipfs: s.Ipfs, Nd: nd}, nil
    default:
        // ...
}

done <- struct{}{}
}()

<-done
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a WaitGroup here while you're at it? This is a bit confusing at first glance.

a.Mode = 0444
a.Size = uint64(len(rawnd.RawData()))
a.Blocks = 1
a.Uid = uint32(os.Getuid()) // TODO: should probably cache these calls. No sense making multiple syscalls for each attr call here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not just claim that these files are owned by root (does fuse not let us do that)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, I guess that does work.

// will be expensive to query each child. However most shells call an
// additional 'stat' on each item in a directory listing, its probably
// okay.
entries = append(entries, fuse.Dirent{Name: n, Type: fuse.DT_File})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As someone who has written programs that rely on this being accurate... 😡. We may want to start inlining info like this into directories (but that's not very elegant).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if your argument is that most shells will call an additional stat, we might as well compute this up-front and cache it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, lets go ahead and do that.

switch err {
case bserv.ErrNotFound:
return nil, ErrNotFound
default:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing the case where err is nil (this is what's causing the segfaults in CI).

@Kubuxu Kubuxu self-requested a review September 1, 2017 07:42
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

n = link.Cid.String()
n = lnk.Cid.String()
}
// TODO: calling everything a DT_File here might cause issues. But it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer relevant.

}
}
default:
t = fuse.DT_Unknown
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put this up top (i.e., t := fuse.DT_Unknown). We have several cases where we just log errors but don't assign anything (I assume it will default to unknown but that's not immediately obvious).

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
@Stebalien
Copy link
Member

:shipit:

@whyrusleeping whyrusleeping merged commit 038430d into master Sep 6, 2017
@whyrusleeping whyrusleeping deleted the feat/fuse-fixes branch September 6, 2017 21:52
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Apr 7, 2022
various fixes for /ipfs fuse code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants