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

-bash: cd : mydirectory: Input/output error #178

Open
syed72 opened this issue Jun 13, 2023 · 1 comment
Open

-bash: cd : mydirectory: Input/output error #178

syed72 opened this issue Jun 13, 2023 · 1 comment

Comments

@syed72
Copy link

syed72 commented Jun 13, 2023

I am trying to mount and use hdfs using jnr-fuse. but iam getting below error.

-bash: cd: mydirectory: Input/output error

public class HdfsFuseWrapper extends FuseStubFS{

 @Override
public int getxattr(String path, String name, Pointer value, @size_t long size) {
    try {
        // Get the extended attribute from HDFS
        System.out.println("getxpath:"+path+" "+name);
        org.apache.hadoop.fs.FileStatus fileStatus = fileSystem.getFileStatus(new Path(path));
//        String attrValue = fileStatus.getExtendedAttribute(name);
        System.out.println("prin::"+fileStatus.toString());
        String attrValue = "abc";
        if (attrValue == null) {
            return -ErrorCodes.ENODATA(); // No data available error
        }

        // Convert the attribute value to bytes
        byte[] attrBytes = attrValue.getBytes();

        if (attrBytes.length > size) {
            return -ErrorCodes.ERANGE(); // Insufficient buffer error
        }

        // Copy the attribute value to the buffer
        value.put(0, attrBytes, 0, attrBytes.length);

        return attrBytes.length; // Return the length of the attribute value
    } catch (Exception e) {
        return -ErrorCodes.ENOENT(); // File not found error
    }
}

@Override
    public int getattr(String path, FileStat stat) {
        try {
            // Get the file status from HDFS
            org.apache.hadoop.fs.FileStatus fileStatus = fileSystem.getFileStatus(new Path(path));
        System.out.println("permis:"+fileStatus.getPermission());
        // Set the file attributes in the stat structure
            stat.st_mode.set(fileStatus.getPermission().toShort());
            stat.st_nlink.set(1); // Number of hard links
            stat.st_size.set(fileStatus.getLen());

            stat.st_atim.tv_sec.set(fileStatus.getAccessTime()/1000L);
            stat.st_mtim.tv_sec.set(fileStatus.getModificationTime()/1000L);
            //stat.st_mtime.set(fileStatus.getModificationTime() / 1000L); // Convert milliseconds to seconds
            //stat.st_ctime.set(fileStatus.getModificationTime() / 1000L);
            //stat.st_atime.set(fileStatus.getAccessTime() / 1000L);

            return 0; // Success
        } catch (Exception e) {
            return -ErrorCodes.ENOENT(); // File not found error
        }
    }
}

can someone help on this please?

@syed72
Copy link
Author

syed72 commented Jun 13, 2023

Mounting -
HdfsFuseWrapper wrapper = new HdfsFuseWrapper(hdfsUri);
wrapper.mount(Paths.get(mountPoint), true, true);

-- I tried changing permissions of mounted point in that machine. but not use.

Tried all the options, also checked the net no help from anywhere

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

No branches or pull requests

1 participant