Git Product home page Git Product logo

fuse-nfs's People

Contributors

agraf avatar andyw-dh avatar billziss-gh avatar daniel-abrecht avatar davidgaleano avatar kchiu avatar mercycratos avatar mheijkoop avatar sahlberg avatar smaillan avatar unkn0w avatar zeppelinen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fuse-nfs's Issues

NFSv4 issue

Hello Team,

Using this lib, we are trying to mount NFSv4 protocol based server directory into local. But getting below exception.
Failed to mount nfs share : nfs_service failed ERR libnfs error: rpc_service: socket error Connection timed out(110).

please could you confirm is this issue is related to protocol version or something else.

/home/app/bin/fuse-nfs -n "nfs://x.x.x.x/workspace/workspace?uid=10110&gid=10111&version=4" -m /home/app/nfs

Regards
Lingesh M

Failing to compile

I'm trying to compile/install the project on a setup which has no connection to the internet. (I succeeded with downloading the project and the relevant libraries with different methods). But when I reach the "make", I get some errors like:

make[2]: Entering directory '/home/ubuntu/fuse-nfs/doc'
test -z "/usr/bin/xsltproc" || /usr/bin/xsltproc -o fuse-nfs.1 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl fuse-nfs.xml
error : Resource temporarily unavailable
warning: failed to load external entity "http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
cannot parse http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl

Is it not possible to compile without internet connection ? (I get that it seems there's no point in installing it without internet, but I'm trying something else).

Thanks

Readme Markdown Document has error in option part

I found that the README document states that the "umask" option is specified with "-U", but the source code handles the "umask" option with "-K"

READNE.md

[-U UMASK|--umask=UMASK]
		Override the permission bits in st_mode set by the filesystem. 
		The resulting permission bits are the ones missing from the given umask value.  
		The value is given in octal representation.

fuse-nfs.c

case 'K':
			snprintf(fuse_Umask_arg, sizeof(fuse_Umask_arg), "-oumask=%s", optarg);
			fuse_nfs_argv[fuse_nfs_argc++] = fuse_Umask_arg;
			break;

Print help also has same error

data write issue with v4 mounts in latest fuse-nfs

I can consistently reproduce this issue manually and in our test automation. Seems like there is some problem in the v4 code path, particularly having to do with data writes:

root@8cb85777-ed10-4e6a-5e5f-651c612dade9:/tmp/build/5bbc57d5# fuse-nfs -a -n "nfs://testnfsserver.gorgophone.cf-app.com/export2/certs?gid=2000&uid=2000&version=4" -m /tmp/volumes/nfs-volume-name --multithread=1
root@8cb85777-ed10-4e6a-5e5f-651c612dade9:/tmp/build/5bbc57d5# 
root@8cb85777-ed10-4e6a-5e5f-651c612dade9:/tmp/build/5bbc57d5# touch /tmp/volumes/nfs-volume-name/grak
root@8cb85777-ed10-4e6a-5e5f-651c612dade9:/tmp/build/5bbc57d5# echo "food" > !$
echo "food" > /tmp/volumes/nfs-volume-name/grak
bash: echo: write error: Numerical result out of range

?uid=x&gid=x only sort of works

We've been looking into the possibility of using fuse-nfs with the uid/gid flags in order to set the effective user for a mount to be different from the currently running user. What we've found is that it doesn't work very well unless the currently running user is root.

The reason is that while it works fine for write operations--the file owner information is sent as the specified arbitrary uid/gid, for list/stat operations, the uid/gid is not translated back to the uid of the running user.

So, if as a non-root user, I mount a volume with some other uid/gid:
fuse-nfs -n "nfs://127.0.0.1/export/share1?uid=2000&gid=2000" -m ./mymount2

I can write new files to the volume, but then, because the client OS doesn't think the resulting files are owned by the current user, I cannot edit them:

vcap@vagrant-ubuntu-trusty-64:/home/vagrant/mymount2$ echo "strange" > strangeness
vcap@vagrant-ubuntu-trusty-64:/home/vagrant/mymount2$ cat strangeness
strange
vcap@vagrant-ubuntu-trusty-64:/home/vagrant/mymount2$ echo "strange" >> strangeness
bash: strangeness: Permission denied
vcap@vagrant-ubuntu-trusty-64:/home/vagrant/mymount2$ cat strangeness
strange

We found that we can resolve this by just adding a check to fuse_nfs_getattr() to test if the file is owned by the UID set in the mount URL, and set the current user UID into stbuf instead, but we are wondering if this is really a bug, or if we are just misunderstanding the intent of putting UID and GID in as options to begin with.

lock() & flock() methods not implemented

One of our users pointed out to us that flock applied on fuse-nfs mounts doesn't enforce locking between different clients. After confirming that

  1. It's true and
  2. kernel NFS mounts do enforce flock locks between clients
    We took a look at the fuse-nfs implementation and noticed that fuse-nfs just treats lock() and flock() as no-ops.

So, we are wondering if you left the locking implementation out because you didn't get to it, or if you left it out because NFS locking is flaky and inconsistent between servers and could cause stuff to hang or fail or is otherwise a bad idea.

If it is the former, are you open to a PR to include a locking implementation? And if so do you have an opinion about where the synchronous implementation of rpc_nlm4_lock_async() should live? (presumably either in libnfs or in fuse-nfs)

Cygwin should not use Winsock2

As a follow up to sahlberg/libnfs@e35a44e the same problem exists on fuse-nfs: it appears that the winsock2 library is erroneously included by the configure.ac script.

From https://github.com/sahlberg/fuse-nfs/blob/master/configure.ac#L54-L59:

OLD_LIBS=$LIBS
LIBS+=" -lws2"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]], [[gethostbyname ("");]])], [], [LIBS=$OLD_LIBS])
OLD_LIBS=$LIBS
LIBS+=" -lws2_32"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]], [[gethostbyname ("");]])], [], [LIBS=$OLD_LIBS])

I am not well versed in autoconf, but looking at config.log this checks if this minimal program compiles:

#include <winsock2.h>
int main()
{
    gethostbyname ("");
    return 0;
}

Unfortunately this program does compile on Cygwin (at least on my machine), which results in Cygwin picking up the -lws2_32 option, which is erroneous as discussed in sahlberg/libnfs@e35a44e.

I have a crude patch that just comments out this section, but perhaps a better solution would be to not do this test at all on Cygwin. Unfortunately my knowledge of autoconf is not enough to competently produce a patch here, but I am happy to test if someone else does.


UPDATE

My gcc compiler reports the following as include directories:

$ gcc -E -Wp,-v - </dev/null
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/lib/../lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include
 /usr/include
 /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/../include/w32api
End of search list.
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"

The /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/../include/w32api is really /usr/include/w32api, which contains the Win32 headers (including winsock2.h).

I am under the impression that the /usr/include/w32api directory should not be included in the default header searches, so this may be a change with recent Cygwin.

Android: stat struct [patch]?

In fuse/fuse-nfs.c: function fuse_nfs_getattr
You use st_atim, but this member structure isn't defined in the android header files.

I've changed st_atim.tv_sec to st_atime and st_atim.tv_nsec to st_atime_nsec. It compiled and tested it on my device and worked (could mount nfs on my phone). I know not only there need to be tests but it must compile on all the platforms you support. So I don't know if this "solution" doesn't break on your main platforms.

In any case, this works(?) when using the cross compiler for android:

diff --git a/fuse/fuse-nfs.c b/fuse/fuse-nfs.c
index fb5457b..29e0db6 100644
--- a/fuse/fuse-nfs.c
+++ b/fuse/fuse-nfs.c
@@ -50,12 +50,12 @@ static int fuse_nfs_getattr(const char *path, struct stat *stbuf)
        stbuf->st_size         = nfs_st.nfs_size;
        stbuf->st_blksize      = nfs_st.nfs_blksize;
        stbuf->st_blocks       = nfs_st.nfs_blocks;
-       stbuf->st_atim.tv_sec  = nfs_st.nfs_atime;
-       stbuf->st_atim.tv_nsec = nfs_st.nfs_atime_nsec;
-       stbuf->st_mtim.tv_sec  = nfs_st.nfs_mtime;
-       stbuf->st_mtim.tv_nsec = nfs_st.nfs_mtime_nsec;
-       stbuf->st_ctim.tv_sec  = nfs_st.nfs_ctime;
-       stbuf->st_ctim.tv_nsec = nfs_st.nfs_ctime_nsec;
+       stbuf->st_atime        = nfs_st.nfs_atime;
+       stbuf->st_atime_nsec   = nfs_st.nfs_atime_nsec;
+       stbuf->st_mtime        = nfs_st.nfs_mtime;
+       stbuf->st_mtime_nsec   = nfs_st.nfs_mtime_nsec;
+       stbuf->st_ctime        = nfs_st.nfs_ctime;
+       stbuf->st_ctime_nsec   = nfs_st.nfs_ctime_nsec;

        return ret;
 }

Unable to build

Hey there,

We grabbed your code today and tried building it but ran into the following issue:-

root@vagrant-ubuntu-trusty-64:/home/vagrant/fuse-nfs# make
make  all-recursive
make[1]: Entering directory `/home/vagrant/fuse-nfs'
Making all in doc
make[2]: Entering directory `/home/vagrant/fuse-nfs/doc'
test -z "/usr/bin/xsltproc" || /usr/bin/xsltproc -o fuse-nfs.1 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl fuse-nfs.xml
/bin/bash: /usr/bin/xsltproc: No such file or directory
make[2]: [fuse-nfs.1] Error 127 (ignored)
make[2]: Leaving directory `/home/vagrant/fuse-nfs/doc'
Making all in fuse
make[2]: Entering directory `/home/vagrant/fuse-nfs/fuse'
gcc -DHAVE_CONFIG_H -I. -I..     -g -O2 -D_FILE_OFFSET_BITS=64 -MT fuse-nfs.o -MD -MP -MF .deps/fuse-nfs.Tpo -c -o fuse-nfs.o fuse-nfs.c
fuse-nfs.c: In function ‘fuse_nfs_getattr’:
fuse-nfs.c:40:21: error: storage size of ‘nfs_st’ isn’t known
  struct nfs_stat_64 nfs_st;
                     ^
fuse-nfs.c: In function ‘main’:
fuse-nfs.c:384:7: warning: assignment makes pointer from integer without a cast [enabled by default]
  urls = nfs_parse_url_dir(nfs, url);
       ^
fuse-nfs.c:391:27: error: dereferencing pointer to incomplete type
  ret = nfs_mount(nfs, urls->server, urls->path);
                           ^
fuse-nfs.c:391:41: error: dereferencing pointer to incomplete type
  ret = nfs_mount(nfs, urls->server, urls->path);
                                         ^
make[2]: *** [fuse-nfs.o] Error 1
make[2]: Leaving directory `/home/vagrant/fuse-nfs/fuse'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/vagrant/fuse-nfs'
make: *** [all] Error 2

Focussing on just fuse-nfs.c:40:21: error: storage size of ‘nfs_st’ isn’t known we saw this snippet during configure:-

...
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
./configure: line 12355: PKG_PROG_PKG_CONFIG: command not found
checking whether to enable assertions... yes
checking fuse.h usability... yes
checking fuse.h presence... no
configure: WARNING: fuse.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: fuse.h: proceeding with the compiler's result
checking for fuse.h... yes
checking nfsc/libnfs.h usability... yes
checking nfsc/libnfs.h presence... yes
checking for nfsc/libnfs.h... yes
...

Any clues?

Much appreciated

Can't connect to remote NFS drive

I have a server in Finland (Linux) which NFS connects to successfully.
I am now trying to connect to my Windows 10 Pro, I write
fuse-nfs -n nfs://Server_IPv4:/mnt/storage?version=4 -m J:

But I get no output, no errors. I can successfully connect my drive to other Linux machines but it doesn't work on Windows, I just get an empty output. Any ideas?

Use the poll polyfill from win32/win32_compat.h from libnfs for windows builds

Poll isn't available on windows, but the usage of the async apis needs it. libnfs has win32/win32_compat.{h,c} compatiblity files which provide a poll implementation. I've already checked that they would indeed work. The problem is, the win32/win32_compat.h header isn't included in libnfs.h, and it isn't in the "include/" folder in libnfs either. What would the best course of action be here? One possibillity would be to move win32/win32_compat.h to "include/win32/win32_compat.h" and include it in fuse-nfs.c. Another possibillity would be to include it in libnfs.h directly. An in either case, poll.h doesn't exist in windows, so an additional ifndef check should be added to fuse-nfs.c.

I can make pull requests for these changes, but I need to know what the prefered way to resolve this problem would be.

EFS NFS Mount - Input/output error

I have successfully connected to an AWS EFS mount. However, after a short period any attempt to use the mount reports a generic "Input/output error".

I connect successfully using this command:

fuse-nfs -a -n "nfs://1.2.3.4/?version=4" -m /data/

I cannot work out how to debug this or get a more meaningful error.

Using killall fuse-nfs stops the error and returns an empty directory again.

I have built this on Ubuntu 20.04 using the supplied instructions in the README file.

Not able to write to mounted system

I am using fuse-nfs to mount NFS version 4 shares in an Apptainer container running on Rocky Linux 8. I can read the data on mounted directory but cannot write. The remote file server is running CentOS 6 and has this line in /etc/exports:

/data1 10.11.12.13(rw,no_root_squash,sync,insecure)

On the container I am running this command:

fuse-nfs -a -n "nfs://172.28.50.50/data1/?version=4" -m /data1

All the mounted directories are shown as being owned by root : root , but even if the directory permission is 777 it is not writable.

Failed to mount nfs share : mount_cb: RPC error: Mount failed with error MNT3ERR_ACCES(13) Permission denied(13)

Failed to mount nfs share : mount_cb: RPC error: Mount failed with error MNT3ERR_ACCES(13) Permission denied(13)

rpcinfo -p 192.168.0.98
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 20048 mountd
100005 1 tcp 20048 mountd
100005 2 udp 20048 mountd
100005 2 tcp 20048 mountd
100005 3 udp 20048 mountd
100005 3 tcp 20048 mountd
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 39647 nlockmgr
100021 3 tcp 39647 nlockmgr
100021 4 tcp 39647 nlockmgr
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 56298 nlockmgr
100021 3 udp 56298 nlockmgr
100021 4 udp 56298 nlockmgr
fuse-nfs -n nfs://192.168.0.98/media/usbhd-sdb1 -m /mnt/work1
Failed to mount nfs share : mount_cb: RPC error: Mount failed with error MNT3ERR_ACCES(13) Permission denied(13)

cat exports
/media/usbhd-sdb1 *(rw,no_root_squash,sync,insecure)

Mac Support

I have managed to compile the library for macos with a few changes, but it doesn't run properly.
This was tested on an M2 mac.

When I try to mount I get this message:

xadmin@r131-20 ~ % sudo fuse-nfs -S -i -n 'nfs://my-server?version=4' -m Fairy
Failed to mount nfs share : nfs_service failed

This is probably an issue with libnfs but I want to raise it here as I was using fuse-nfs. Libnfs mentions it was working on 10.4 but this is now 13.4.
If you need any further information I would love to provide it.

Besides, is there an option to pass arguments to osxfuse? The original reason why I was trying out this library is that there has been an issue with the builtin nfs client and I wanted to try the "local" option to get it working, which has worked with bindfs which is another fuse file system.

fuse-nfs.c:39:21: error: storage size of ‘nfs_st’ isn’t known

Compilation issue:

Making all in doc
make[1]: Entering directory /home/ali/git/fuse-nfs/doc' test -z "/usr/bin/xsltproc" || /usr/bin/xsltproc -o fuse-nfs.1 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl fuse-nfs.xml /bin/bash: /usr/bin/xsltproc: No such file or directory make[1]: [fuse-nfs.1] Error 127 (ignored) make[1]: Leaving directory/home/ali/git/fuse-nfs/doc'
Making all in fuse
make[1]: Entering directory /home/ali/git/fuse-nfs/fuse' gcc -DPACKAGE_NAME=\"fuse-nfs\" -DPACKAGE_TARNAME=\"fuse-nfs\" -DPACKAGE_VERSION=\"1.0.0\" -DPACKAGE_STRING=\"fuse-nfs\ 1.0.0\" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"\" -DPACKAGE=\"fuse-nfs\" -DVERSION=\"1.0.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -I. -g -O2 -D_FILE_OFFSET_BITS=64 -MT fuse-nfs.o -MD -MP -MF .deps/fuse-nfs.Tpo -c -o fuse-nfs.o fuse-nfs.c fuse-nfs.c: In function ‘fuse_nfs_getattr’: fuse-nfs.c:39:21: error: storage size of ‘nfs_st’ isn’t known struct nfs_stat_64 nfs_st; ^ make[1]: *** [fuse-nfs.o] Error 1 make[1]: Leaving directory/home/ali/git/fuse-nfs/fuse'
make: *** [all-recursive] Error 1

Mount goes OK, but first access results in "Software caused connection abort" error

Hello,

# fuse-nfs -n 'nfs://REDACTED/REDACTED/REDACTED/?if=venet0&version=4' -m /mnt2
   -> Shows no messages, exit status ($?) is 0 

# ls /mnt2
   ls: reading directory /mnt2: Software caused connection abort

# ls /mnt2
   ls: cannot open directory /mnt2: Transport endpoint is not connected

I'm running in an old platform (RHEL6 with kernel 2.6.32, and I can't upgrade, please don't ask why) but all other FUSE filesystems (ENCFS, etc) works OK.

There's no other output, including syslog and dmesg. I can see no "--verbose" or equivalent options for this module.

How can I debug this?

Thanks in advance.

Multi-threaded support

Hey Guys,
I am newbie to fuse world and would like to explore multi-threading for this fuse-nfs client.
Multi-threading will make it usable in environments with higher throughput.
Could you please share your thoughts if it's feasible and worth doing it?
Thanks & Regards,
Deepak

SIGSEGV in fuse_nfs_readdir due to permission denied on NFS server

I am trying to port this fuse-nfs to Crossmeta FUSE on Windows https://github.com/crossmeta/cxfuse and amazingly in less than a hour, I could have the program running.
While testing I encountered this problem with fuse_nfs_readdir() when it tried to read directory with no permission and it received NFS error 13. But in the code I do not see check for status and instead start filling the directory entries and accessed NULL nfsdir pointer.

diff --git a/fuse/fuse-nfs.c b/fuse/fuse-nfs.c
index 0bddb30..fa4ef90 100755
--- a/fuse/fuse-nfs.c
+++ b/fuse/fuse-nfs.c
@@ -303,6 +303,8 @@ fuse_nfs_readdir(const char *path, void *buf, fuse_fill_dir_
                return ret;
        }
        wait_for_nfs_reply(nfs, &cb_data);
+       if (cb_data.status)
+               return cb_data.status;
 
        nfsdir = cb_data.return_data;
        while ((nfsdirent = nfs_readdir(nfs, nfsdir)) != NULL) {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.