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

Folder content is not shown if there 100 or more catalogs in one catalog #20

Closed
AleksandrIakhnev opened this issue Feb 24, 2021 · 4 comments · Fixed by #24 or #25
Closed

Folder content is not shown if there 100 or more catalogs in one catalog #20

AleksandrIakhnev opened this issue Feb 24, 2021 · 4 comments · Fixed by #24 or #25

Comments

@AleksandrIakhnev
Copy link

AleksandrIakhnev commented Feb 24, 2021

Easy to reproduce like:

for i in range(1,100):
    os.makedirs(f'broken_catalog/sub_catalog_{i:03}', exist_ok=True)

broken_catalog content will be empty for a NFS client, a similar issue exists for many files in one catalog.

@willscott
Copy link
Owner

Are you running this across a network? what client are you using to mount the share?
Any errors you see on either side?

Likely this has to do with fragmentation. On a local machine, i made a directory with 200 files with long names, and was able to view and work with it without problems. However, the mac client made the directory read request specifying it could handle a large response size of 32k bytes so the entire response was provided in one response. You likely have a case where the requested response size results in cursor fragmentation. It would be helpful to know what client that is.

@AleksandrIakhnev
Copy link
Author

@willscott I do the tests locally on Ubuntu 20.04.2 LTS, just mount with command like sudo mount -o port=39263,mountport=39263,nfsvers=3,noacl,tcp -t nfs localhost:/mount /mnt/goserver

Checked in the debugger that directory content obtained successfully on server, so probably something in response handling/size.

@AleksandrIakhnev
Copy link
Author

AleksandrIakhnev commented Mar 2, 2021

How to reproduce with Docker:

Dockerfile

FROM python:3.9.1-buster

RUN apt update && apt install git wget nfs-common -y

RUN wget https://golang.org/dl/go1.16.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.16.linux-amd64.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"

RUN  git clone https://github.com/willscott/go-nfs.git
# patch to provide port
COPY main.go /go-nfs/example/osview/main.go
RUN cat /go-nfs/example/osview/main.go

RUN mkdir /go-nfs/1K/ && python -c "import os; [os.makedirs(f'broken_catalog/sub_catalog_{i:03}', exist_ok=True) for i in range(1000)]"

RUN cd /go-nfs && go get && cd /go-nfs/example/osview && go build
WORKDIR /go-nfs

RUN mkdir /mnt/goserver
CMD ./example/osview/osview . 39263

Then run docker run -it --rm --name=gonfs --privileged=true gonfs

Try to mount:
docker exec -it gonfs bash mount -t nfs -o port=39263,mountport=39263,nolock,nfsvers=3,noacl,tcp localhost:39263:/mount /mnt/goserver

So ls /mnt/goserver works.

But for ls /mnt/goserver/1K I see ls: reading directory '1K': Input/output error

@AleksandrIakhnev
Copy link
Author

@willscott It seems that issue still presents, after the fix #24 now I see in server logs messages like 2021/03/11 12:02:45 call to 0x5fb7a0 failed: Cookie is Stale when accessing directory with 1K files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants