Skip to content

ns.GetNS sometimes report error 'unknown FS magic'  #69

@ldnvnbl

Description

@ldnvnbl

My program use ns pkg to set other container route, and my program is run in container with privileged and mount host /var/run dir.

But when my program run a period of time, my program will report error:

unknown FS magic on "/var/run/docker/netns/3b51597626b6": 1021994

so, how do I fix this?

other:

go version

go version go1.8.3 linux/amd64

report error code:

func IsNSorErr(nspath string) error {
	stat := syscall.Statfs_t{}
	if err := syscall.Statfs(nspath, &stat); err != nil {
		if os.IsNotExist(err) {
			err = NSPathNotExistErr{msg: fmt.Sprintf("failed to Statfs %q: %v", nspath, err)}
		} else {
			err = fmt.Errorf("failed to Statfs %q: %v", nspath, err)
		}
		return err
	}

	switch stat.Type {
	case PROCFS_MAGIC, NSFS_MAGIC:
		return nil
	default:
		return NSPathNotNSErr{msg: fmt.Sprintf("unknown FS magic on %q: %x", nspath, stat.Type)}
	}
}

report error stat type

#define TMPFS_MAGIC		0x01021994

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions