Commit Graph

721 Commits (9cb49494c7b5ef25ccd9ae5e2e5ddc57e4d0c1cd)

Author SHA1 Message Date
Peter Lieven cf420d32d0 socket: use FIONREAD ioctl only for UDP
under Linux poll might return POLLIN even if there are no bytes available for read.
See select(2) manpage for surious readiness under BUGS.

As a consequence we start dropping TCP connections which are still alive.

Signed-off-by: Peter Lieven <pl@kamp.de>

Conflicts:
	lib/socket.c
2015-06-19 13:45:03 +02:00
Peter Lieven 99ae3c01c4 add some debug output
Signed-off-by: Peter Lieven <pl@kamp.de>
2015-06-19 13:43:55 +02:00
Ronnie Sahlberg 68b0298102 Add missing NULLing of data->continue_data for READDIR
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-26 19:50:00 -07:00
Ronnie Sahlberg d8ba04d9c6 READDIRPLUS: use lookup on entries where the server did not return any attr
Some servers sometimes do not return attrivbutes for files in the RDP
replies. So we need to fallback to using LOOKUPs for these entries
just like we always have to do in the READDIR case.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-25 16:53:56 -07:00
Ronnie Sahlberg 7121bc3b89 Merge branch 'master' of github.com:sahlberg/libnfs 2015-05-24 07:51:00 -07:00
Ronnie Sahlberg 08ea9a3138 UTILS: move nfs-cp from examples to utils
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-24 07:50:43 -07:00
Ronnie Sahlberg eadef4f724 UTILS: move nfs-cp from examples to utils
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-24 07:49:09 -07:00
Ronnie Sahlberg ec3a3afeae EXAMPLES: convert remaining nfs_[f]stat to nfs_[f]stat64
The old nfs_[f]stat calls are deprecated. Convert to the newer
nfs_[f]stat64 call that takes struct nfs_stat_64

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-24 07:38:17 -07:00
Ronnie Sahlberg 6f2727468d FUSE: use nfs_stat64() not nfs_stat()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-24 07:19:01 -07:00
Ronnie Sahlberg 32633fc3af Merge branch 'master' of github.com:sahlberg/libnfs 2015-05-24 07:05:38 -07:00
Ronnie Sahlberg 4b1de15bb5 UTILS: add nfs-cat utility
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-24 07:05:20 -07:00
Ronnie Sahlberg 77e3d80f26 Merge pull request #114 from rosslagerwall/licenses
Include the BSD license text in a separate file
2015-03-30 09:48:33 -07:00
Ross Lagerwall 6741cd7b55 Include the BSD license text in a separate file
The BSD license requires that it is included with binary distributions.
Including the text in a separate file makes it easier for distros to do
this.

Also include the license files in the source tarball.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2015-03-29 15:02:10 +01:00
Ronnie Sahlberg 63d40b1737 Revert "Remove unused variable from socket.c"
This reverts commit d74a938775.
2015-03-12 20:52:52 -07:00
Ronnie Sahlberg 471aa1b1af Merge pull request #113 from MilhouseVH/unused-variables
[Cosmetic]: Remove unused variables and eliminate  [-Wunused-variable] warnings
2015-03-12 20:51:22 -07:00
MilhouseVH d74a938775 Remove unused variable from socket.c 2015-03-12 05:29:56 +00:00
MilhouseVH 221df2245e Removed unused variables from nfs-ls.c 2015-03-12 05:20:18 +00:00
MilhouseVH 7b853063c9 Remove unused variables from raw (generated) files 2015-03-12 05:15:55 +00:00
Ronnie Sahlberg 617cfba5b5 configure is hard. now it looks like --enable-werror works
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-03-11 21:22:43 -07:00
Ronnie Sahlberg d01e75de8a configure: only add -Werror id --enable-werror is used
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-03-11 20:32:04 -07:00
Ronnie Sahlberg 4d318527ea Merge branch 'master' of github.com:sahlberg/libnfs 2015-03-10 21:09:00 -07:00
Ronnie Sahlberg 84607f4821 Add -Wall -Werror and friends
Update the configure to add some sanity -W arguments.
A good start is probably :
  -Wall -Werror -Wshadow -Wno-write-strings -Wstrict-prototypes
  -Wpointer-arith -Wcast-align -Wno-strict-aliasing

Fixup the paces in the code that triggers.
(one of which is readahead code which is perhaps broken?)

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-03-10 21:06:38 -07:00
Ronnie Sahlberg 6da5bc1cc7 Merge pull request #109 from agraf/master
fuse_nfs: Disable multithreading
2015-02-16 15:29:48 -08:00
Alexander Graf a5042b9857 fuse_nfs: Disable multithreading
If we blindly spawn new threads based on existing open NFS shares, all
threads will concurrently still run on the same file descriptors for NFS
traffic, colliding sooner or later.

This is what happens with the fuse-nfs example program. To steer us back
into safety, we can just tell fuse to not do multi-threading which this
patch does.

This patch fixes random connection aborts with fuse_nfs for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-02-15 01:49:23 +01:00
Ronnie Sahlberg e775160243 new version 1.9.7
- Auto-traverse mounts. With this option (default to on) libnfs will
   autodiscover and handle any nested submounts.
 - Remove nfs_get_current_offset. Applications should use seek instead of this function.
 - Add umask() support.
 - Change set_tcp_sockopt() to be static.
 - Android fix for nfs-ls
 - Make S_IFLNK available on windows.
 - Fix a use after free.
 - Fix a bug where truncate() treated offset as 32bit.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-02-09 19:16:56 -08:00
Ronnie Sahlberg 732a297884 Merge pull request #107 from rosslagerwall/invalid-free
libnfs: Fix use after free
2015-02-02 20:32:08 -08:00
Ross Lagerwall bf52e348ad libnfs: Fix use after free
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2015-02-02 23:32:32 +00:00
Ronnie Sahlberg f6e7505baa libnfs: make continue_int 64 bit to avoid sign extension bug for truncate()
Make the continue_int field we use through the internal callbacks a uint64_t
instead of an int.
This fixes a bug for the truncate function where we pass the offset to truncate
to via this field.

The bug is that otherwise we first truncate the field to an int and then
in the callback we cast this int back to a uint64_t again.

If the user called truncate with an offset that is >= 2^31
then :
IF the 1<<31 bit is cleared then we would truncate to (offset & 0xffffffff)
IF the 1<<31 bit is set, we would instead truncate to (offset | 0xffffffff00000000)

Reported-by: doktorstick at github
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-26 17:11:10 -08:00
Ronnie Sahlberg 8e991ffbdd Merge pull request #105 from rosslagerwall/submount-opendir
opendir_cb: Retrieve attributes for a top-level submount correctly
2015-01-18 14:43:32 -08:00
Ross Lagerwall 368ee352a6 opendir_cb: Retrieve attributes for a top-level submount correctly
Fix retrieving the attributes for a submount in nfs_opendir when
the submount is an entry of '/'.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2015-01-18 22:18:18 +00:00
Ronnie Sahlberg d1c2c47ff0 Add auto-traverse-mount URL argument and default it to TRUE
Add a URL argument to enable/disable the use of automatic traversal of nested
mounts for a libnfs context. Default it to enabled.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-17 11:49:08 -08:00
Ronnie Sahlberg 1eea1c4647 opendir_cb: use attributes from the nested mount in opendir
When opendir_cb encounters an entry that refers to a nested mount, then
replace the attributes with those attributes we collected for this export
during the mount and return those instead.

This makes traversing a director that crosses into a different filesystem
on the server transparent to the client.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-17 11:32:31 -08:00
Ronnie Sahlberg 27348486f6 nfs_lookuppath_async: replace path components with nested mount filehandles
Durng nfs_lookuppath_async, check if the requested path traverses into
a nested mountpoint and if so, skip resolving that part of thre path and just
use the filehandle for the nested mount.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-17 11:29:14 -08:00
Ronnie Sahlberg c7190d3078 nested_mounts: collect fattr3 data for all nested mounts
During the mount process, once we have connected to NFSd we need to collect
the file attributes for all the filehandles that are associated with
nested mounts.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-17 11:24:17 -08:00
Ronnie Sahlberg 08ad1b80c0 nested_mounts: collect filehandles for all nested mounts during nfs_mount()
During the mount process, call MOUNT3 EXPORT and collect a list of all
exports on the server. For any export that is a nested mount to the current
directory we are trying to mount call out to MOUNT3 MNT and collect the
filehandle for those mounts.

Track all nested mounts and their filehandles in a list from the nfs_context.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-17 11:19:13 -08:00
Ronnie Sahlberg 7378a13fa6 nfs_mount: rename nfs_mount_10/9/8_cb to nfs_mount_11/10/9_cb
Rename these callback functions to make space for two new functions
nfs_mount_7/8_cb which we will be using to collect information about
nested mounts in a later patch.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-17 11:09:37 -08:00
Ronnie Sahlberg 63d893575c opendir_cb: use a fattr3 pointer instead of dereferencing every time
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-17 11:00:48 -08:00
Ronnie Sahlberg 9a02f775a8 nfs-ls: S_IFLNK is now avbailable under windows. No need for ifdef
We no longer need to ifdef out the S_IFLNK use in nfs-ls since this define
is now also available on windows.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-12 20:32:38 -08:00
Ronnie Sahlberg 7b46c2bc3e READDIR: Bake the file type into the mode we return
NFS reports type in a separate to mode, where mode only contains
the protection bits. This makes it inconvenient to use when porting programs
since under posix the type is supposed to be part of the mode bits (S_IFMT)

When unmarshalling the directory entries into a nfsdirent structure, bake
the S_IF* file type into where the S_IFMT bits would be.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-12 20:32:29 -08:00
Ronnie Sahlberg a5119185cb win32: add define for S_IFLNK
Add a define for S_IFLNK to win32. Even if windows does not have this
file type locally, it can still encounter them from an nfs server.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-01-12 20:32:19 -08:00
Ronnie Sahlberg df137c4ac9 Merge branch 'master' of github.com:sahlberg/libnfs 2015-01-08 07:39:57 -08:00
Ronnie Sahlberg 54f9ae78e9 Merge pull request #101 from wsnipex/droid-fix
fix building on android
2015-01-08 07:39:26 -08:00
Ronnie Sahlberg d18b335622 Merge branch 'master' of github.com:sahlberg/libnfs 2015-01-08 07:29:35 -08:00
Ronnie Sahlberg 812c0c5e51 Merge pull request #103 from cuinutanix/master
set_tcp_sockopt should be static
2015-01-08 07:29:21 -08:00
Mike Cui ac76768170 set_tcp_sockopt should be static, otherwise it prevents linking with libiscsi
which has function of the same name, also not static.

Same fix needs to go in to libiscsi.
2015-01-05 09:25:27 -08:00
wsnipex d814d1f785 fix building nfs-ls on android 2014-12-30 14:00:53 +01:00
Ronnie Sahlberg 0c1a5c464c libnfs.c: add support for nfs_umask
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-09 14:00:15 -08:00
Ronnie Sahlberg b53cd4d76c libnfs.c: remove function nfs_get_current_offset
Remove this function (that no one uses) since this is what
lseek(SEEK_CUR, 0) does.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-09 13:41:28 -08:00
Ronnie Sahlberg 9c1d38488e DOCS: document the readahead url argument
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-05 08:52:17 -08:00
Ronnie Sahlberg 5f6442d1b2 libnfs.c: fix typo, it is readahead not readahaed
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-12-05 08:44:15 -08:00