Ronnie Sahlberg [Sun, 31 Jul 2011 00:59:46 +0000 (10:59 +1000)]
Initialize the rootfh handle when creating the nfs context or else
we will try to free a wild pointer if the mount failed
and we proceed to call nfs_destroy_context();
Ronnie Sahlberg [Sun, 31 Jul 2011 00:46:34 +0000 (10:46 +1000)]
Add automatic reconnect after TCP session failure for the sync interface.
Once a NFS TCP connection has been idle for a very long time, say
10-15 minutes, it is common that NFS servers will tear down the TCP connection.
So add code to re-connect to the NFS server and re-issue any i/o that might have been in flight (unlikely unless the server has hung)
While it is sufficient to just reconnect to tcp port 2049, it was much simplet to just utilize the nfs_mount() function.
This means that instead of just reconnecting TCP port 2049, we do a full blown
nfs mount via portmapper and mountd protocols.
Ronnie Sahlberg [Sat, 9 Jul 2011 22:39:54 +0000 (08:39 +1000)]
On OSX and other systems where we have sockaddr_in, SIOCGIFCONF returns a packed list of ifreq structures, so we can not just index them as (struct ifreq *)[i]
Instead we have to compute the offset into the buffer for where the next record starts (this offset might or might not be sizeof(struct ifreq)
Ronnie Sahlberg [Sat, 2 Jul 2011 02:16:37 +0000 (12:16 +1000)]
With broadcast PDUs we can receive multiple replies so must make sure we
delete the previuous unmarshalling buffer when we start over and
process the second pdu to the initial call.
Or else we will leak memory very slowly when processing broadcast RPC replies
Ronnie Sahlberg [Sat, 25 Jun 2011 02:13:11 +0000 (12:13 +1000)]
handle the case where we try a multi-read that is completely beyond the end of file.
when a multi-read was completely beyond the end of file, this caused us to invoke the callback with a 'read-count' of <0 which the callback would treat as a failure.
This would then cause the callback to treat the data pointer as an error string and try to use it for nfs_set_error().
Since the data pointer was actually a real binary databuffer and not an error string this would cause the NFS error string to look like it contained garbage data.
In this case, where the multi-read fails to read any data at all since it if fully beyond end of file, make sure to invoke the callback with a read-count of 0
Ronnie Sahlberg [Sat, 25 Jun 2011 01:06:53 +0000 (11:06 +1000)]
fix crash in mount/export
need to check that status is OK before we start dereferencing the 'export' pointers or else we will segv.
this could happen if trying to pull the list of exports from a host that does not have mountd running, or if we can not connect at all to the host.
Ronnie Sahlberg [Tue, 21 Jun 2011 08:33:50 +0000 (18:33 +1000)]
Add a very subtle bug in nfs_set_error()
when nfs_set_error is called with error_string being the result of a lower layer
problem so it is passed as "rpc_get_error()"
This meant that since free that nfs->rpc->error_string before we reference it a few lines further down in the vasprintf(..., error_string,
adn memory corruption triggers.
Ronnie Sahlberg [Sat, 18 Jun 2011 22:43:28 +0000 (08:43 +1000)]
Add support in read/pread to be aware of the Maximum Read size that the server
suggested.
When a read/pread operation that is 'oversize' is issued, the read/pread command will internally chop this up into smaller chunsk and send then concurrently to the server.
As replies come back from the server we add the data to a reassembly buffer
and as soon as all replies have been received we invoke the callback and pass the reassembly buffer back to the application.
Memphis [Wed, 8 Jun 2011 15:19:32 +0000 (17:19 +0200)]
- add configure option for disabling the call to ldconfig on make install
- this is needed because we use a prefix which is writable by the user - calling ldconfig
would need root rights which we have to avoid...
Memphiz [Tue, 7 Jun 2011 22:23:04 +0000 (00:23 +0200)]
- honor @cc@,@CLFAGS@ and @LDFLAGS@ which is important for cross compilation
- use a more generic regexp for renaming the generated rpc header includes - because the include is without subpath on darwin/ios
- make linkerstuff and so names dynamic according to @is_darwin@
- create install directorys if they don't exist
- use $(prefix) instead of $(DESTDIR) for installation
- build examples only if @ENABLE_EXAMPLES@ is set (default is on)
- rm -rf bin on clean because darwin adds directories here on compilation
- use u_int64_t for rpcgen on darwin instead of unsigned hyper (it is not known to the darwin rpcgen...)