Commit Graph

1194 Commits (master)

Author SHA1 Message Date
Vitaliy Filippov 5a991e1fcb Do not try to ZDR_DECODE bytes into a preallocated buffer (it also segfaults) 2022-02-12 14:09:40 +03:00
Vitaliy Filippov 338e176320 Fix rpc_read_from_socket (no idea how it worked before) 2022-02-12 13:57:31 +03:00
Ronnie Sahlberg 1703d4479d
Merge pull request #374 from vitalif/master
Add an opaque pointer argument to service_proc
2022-02-06 11:37:42 +10:00
Vitaliy Filippov 45430b3c38 Add an opaque pointer argument to service_proc
Without this argument it's impossible to pass an object instance to procedure
callbacks which basically forces users to either use global variables or to
write additional boilerplate code and find object instances from rpc_context
pointer values.
2022-02-06 02:29:39 +03:00
Ronnie Sahlberg 4785ab7eae multithreading/ptread: gettid() is not available in all versions
gettid() is not guaranteed to be universally available
so replace this with calling the syscall directly for
building on Linux with Multithreading enabled.

Windows already use a native call for this so it should be unaffected
but other unix-like systems with pthread support will need to have
a replacement function here as well.
This is todo for later for non-linux pthread platforms.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-02-03 17:26:26 +10:00
Ronnie Sahlberg 2772c70be6 New version 5.0.1
Fixes non-pthread build

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-02-01 03:31:37 +10:00
Ronnie Sahlberg 32349ab58b update README.multithreading
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-29 14:23:06 +10:00
Ronnie Sahlberg beaf4cd769 update README.multithreading
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-29 14:16:17 +10:00
Ronnie Sahlberg c33e0c3825 configure.ac: fix typo for ENABLE_PTHREAD
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-29 13:30:51 +10:00
Ronnie Sahlberg 382905495f
Merge pull request #372 from heitbaum/5.0.0-fixes
fix multithreading mutex
2022-01-29 09:40:14 +10:00
heitbaum fe62199737 utils/nfs-ls: dont use nfs_mt_service_thread_ if not built with HAVE_MULTITHREADING 2022-01-28 23:38:04 +00:00
heitbaum 680ceb8d2c nfsv4: fix nfs4_op_release_lockowner defined but not used 2022-01-28 23:33:07 +00:00
heitbaum 7b7648e0d8 nfsv3: fix multithreading mutex 2022-01-28 23:28:54 +00:00
heitbaum 26133258fd nfsv4: fix multithreading mutex 2022-01-28 23:21:34 +00:00
Ronnie Sahlberg a48f019e05 New version 5.0.0
Multithread support for Linux and Windows
Fix NFS4 behavior of chmod/chown/utimes
Add marshalling / unmarshalling of various NFSv4.1 structures (but not 4.1 support)
PS3 support
PS2 EE support
Support escaped characters in the URL
Fix MINGW build

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-28 10:50:38 +10:00
Ronnie Sahlberg 29b4cea00f multithreading: make nfs_get_error() work for multithreaded applications
This mostly consists of creating one slave nfs_context  for each nfs
thread to track the error-string.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-28 10:38:32 +10:00
Ronnie Sahlberg f85c21755e nfs4: Use RELEASE_LOCKOWNER when we close a file
We create a new lock_owner for every open(), to reduce pressure on the
servers lock_owner cache  we can tell it that this lock_owner will not
be used again and it can drop it from the cache.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-05 16:41:34 +10:00
Ronnie Sahlberg 0550a5c83f nfs4 multithreading: create a new lock_owner for every single open()
This allows us to perform unlimited concurrent opens as we are longer
bound by rfc3530  8.1.5 which limits to only one active OPEN command
per lock_owner

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-05 16:18:11 +10:00
Ronnie Sahlberg 61e5863e46 nfsv4: fix multithreading for nfsv4
Some multi-stage operations in nfs v4 can not be interleaved
so add mutex to prevent them from running concurrently.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-05 13:10:16 +10:00
Ronnie Sahlberg 4ca1e05f4e rpcgen: fix compilation of nfs header file
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-05 13:10:06 +10:00
Ronnie Sahlberg 1716b14104 Write PDUs straight to the wire when the queue is empty
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-05 13:10:00 +10:00
Ronnie Sahlberg 630a80c056 WIN32: add multithreading support for windows 2022-01-02 13:02:31 +10:00
Ronnie Sahlberg 1648cd8393 remove strndup call
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-12-31 11:53:33 +10:00
Ronnie Sahlberg efa9085cfa add support for nfsv3 getacl
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-12-31 11:42:48 +10:00
Ronnie Sahlberg c851f458a0 multithreading: fix race for waking blocked worker threads
We must make sure that we prepare and process all the returned data
before we wake the thread that is waiting for the i/o to complete
or else we will have a race between waking the thread and copying
the returned data in the service thread.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-12-31 08:28:20 +10:00
Ronnie Sahlberg 20b39fd251 PS2_EE: update to compile on latest ps2 sdk
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-10-15 18:14:18 +10:00
Ronnie Sahlberg 52c7bd7bc5 multithreading: return default error string when multithreading is
enabled

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-10-14 16:31:42 +10:00
Ronnie Sahlberg f55637619e initial pthread support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-10-14 16:31:26 +10:00
Ronnie Sahlberg 81f4609076
Merge pull request #365 from vitalif/master
Don't try to ZDR_DECODE strings into a pre-existing pointer
2021-10-11 21:39:24 +10:00
Vitaliy Filippov d1999dc956 Don't try to ZDR_DECODE strings into a pre-existing pointer
Otherwise it segfaults inside any string decoding inside rpc_process_call()
as it doesn't zero the allocated memory, so libnfs_zdr_string() may receive
non-zero *strp which is very easy to reproduce by writing a simple NFS server
example using libnfs :-)
2021-10-11 00:55:14 +03:00
Ronnie Sahlberg 4fa3b79569
Merge pull request #364 from Daniel-Abrecht/strndup
Fix mingw build: add strndup implementation to win32_compat.c
2021-10-04 16:43:21 +10:00
Daniel Abrecht 939814826f Fix mingw build: add strndup implementation to win32_compat.c 2021-10-03 12:51:42 +00:00
Ronnie Sahlberg b1fbe322be
Merge pull request #363 from rhynec/master
Fix PS3 Build - Include nfs4 files in compilation.
2021-10-03 06:12:29 +10:00
rhynec f6a3b0147d
Fix PS3 Build - Include nfs4 files in compilation.
Compilation failed due to changes introduced in cdb377532a. This is a test patch to see if compilation succeeds with this minor change.
2021-10-02 12:32:42 -05:00
Ronnie Sahlberg f965ec74cf ps2ee: PS2 EE support
Initial support for building a library for PS2 EmotionEngine

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-09-17 07:27:44 +10:00
Ronnie Sahlberg f88cca547d nfsv4: fix inode in readdir and nulltermination of readlink
Reported-by: Hemambara Kurma <hemambara.kurma@rubrik.com>
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-09-08 10:27:57 +10:00
Ronnie Sahlberg fca28fe112 url: add support for using escaped characters in the url.
We need to allow users to specify escaped characters as part of the 'path'
field of a URL.
For example, '?' is used to separate the part and the optional list of
arguments.
IF 'path' contains a '?' character then that must be escaped as %3F.
So that libnfs will be able to tell it apart from the '?' separator.

I.e.
nfs://127.0.0.1/my?path/?version=4
must be escaped as
nfs://127.0.0.1/my%3Fpath/?version=4
before passed to any of the URL parsing functions.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-09-01 08:17:23 +10:00
Ronnie Sahlberg 820dc73e32 nfsv3: fix crash when performing very large reads
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-08-11 06:12:06 +10:00
Ronnie Sahlberg 965b1914ef Allow setting max read/write size from the api
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-08-10 16:29:42 +10:00
Ronnie Sahlberg af90dbfbcf nfs4: update the makefile to do the c++ tweaks automatically
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-20 19:07:36 +10:00
Ronnie Sahlberg d1494d41de nfs4: tweak the raw headerfile for c++
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-20 18:16:41 +10:00
Ronnie Sahlberg 752cb4134d url: add support for server:port syntax in the url
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-18 07:46:09 +10:00
Ronnie Sahlberg cdb377532a acl: add support and helpers to read nfsv4 acls
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-17 20:11:56 +10:00
Ronnie Sahlberg 1cdc8657de nfs-io: stat, print sStT bits properly
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-17 20:11:46 +10:00
Ronnie Sahlberg be437aa102 utils: add a nfs-stat utility
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-17 20:11:37 +10:00
Ronnie Sahlberg a7c6637980
Merge pull request #336 from Daniel-Abrecht/master
Define u_int in libnfs-zdr.h for mingw again
2020-11-28 06:58:55 +10:00
Daniel Abrecht 4ae2f12b74 Define u_int in libnfs-zdr.h for mingw again
The typedef for u_int was removed in 172f46756e,
assuming that sys/types.h defines it. This doesn't seam to be the case on mingw.
2020-11-27 20:43:43 +01:00
Ronnie Sahlberg 9a10e17800
Merge pull request #330 from bucanero/master
sys/time.h include clean-up (PS3 PPU)
2020-08-18 11:38:20 +10:00
Damian 901d4a0040 sys/time.h include clean-up (PS3 PPU) 2020-08-17 21:14:30 -03:00
Ronnie Sahlberg bbb9c337b5
Merge pull request #329 from bucanero/master
Rename to avoid linking issues
2020-08-18 07:22:14 +10:00