Home | History | Annotate | Download | only in mount_psshfs
History log of /src/usr.sbin/puffs/mount_psshfs/node.c
RevisionDateAuthorComments
 1.66  16-Sep-2021  andvar fix typos in word "successfully", mainly s/succesfully/successfully/.
 1.65  07-Oct-2016  christos PR/514612: Mateusz Paszwa: When no more data, bail out (reading from empty
files) instead of stuck looping.
 1.64  20-Jan-2012  jakllsch branches: 1.64.22;
Ensure psshfs_node_read() completely reads all data before return.
Fixes file corruption in psshfs exposed with kernel MAXPHYS at 128KiB.
 1.63  12-Aug-2011  riastradh branches: 1.63.2;
Cache vattr in psshfs's setattr.

This means within the cache window, a setattr that wouldn't change the
remote file's attributes from our current view of them will not be
relayed to the server and wait for the server to answer. Thus, e.g., a
process with a periodic timer interrupt that calls open(2) in a loop
can make progress with much higher probability than without caching.

XXX The test case doesn't work, so it's currently disabled. It needs
to stop the child of sshd that is handling an sftp session, not sshd
itself, and it's not obvious how to do that.

ok pooka
 1.62  29-Oct-2010  pooka Make error message more userfriendly in cases where server does
not support sftp.
 1.61  01-Apr-2010  pooka In case we create a file, reclaim the vnode, and lookup the file
without the directory timeout expiring, we get vattr_null as the
attributes for that file. Ensure that we always report sane
attributes by getting them from the server if this is the case.
(also, sprinkle some const)

Fixes problem reported by dyoung. But wait! The bug's medallion
begins to glow! The bug looks much better! I crumble to dust.

There's probably another similar bug related to "lazy open". It
will trigger if we reclaim a node before the response to the open
arrives. Even the comments (typoless) know about this bug ...
But verifying it exists and fixing it will have to wait for another
day.
 1.60  07-Jan-2010  pooka Add -u and -g, which allow to remap one (local,remote) uidgid, i.e.
umapfs without the fuss.
 1.59  05-Nov-2009  pooka more lp64 it's-a-sign! fixes
 1.58  20-May-2009  pooka Copyright year management. no functional change (unless sarah disagrees)
 1.57  20-May-2009  pooka Introduce -c [12], which can be used to open 1 or 2 ssh connections
to the server. If "2" is specified, a separate connection is used
for data and directory operations. Using two connections can
significantly increase directory operation performance on a saturated
link, at least up to 30x faster.
 1.56  29-Mar-2009  pooka Save errno before descending to cleanup gehennom.
 1.55  01-Jan-2009  pooka branches: 1.55.2;
Track parent directory in cross-directory renames so that mv & rm
for the same file during a vnode's lifecycle works.

... rename fix .. it's going to be a good year ...
 1.54  12-Aug-2008  pooka branches: 1.54.4;
void * -> puffs_cookie_t
no functional change
 1.53  09-Dec-2007  pooka branches: 1.53.8;
When creating a node, do the server-dance before creating the local
data structure. This avoids a race between create and lookup, as
the kernel now unlock the directory before the create operation
returns.
 1.52  07-Dec-2007  pooka Don't use puffs_cc_getusermount()
 1.51  07-Dec-2007  pooka Get rid of a lot of extra complexity due to doing separate getattr
requests in readdir - just use the results from the readdir rpc.
 1.50  07-Dec-2007  pooka In case a node is created in lookup in the readdir path, initialize
attribute cache timestamp to be equal to that of the directory
cache timestamp.
 1.49  04-Dec-2007  pooka When scheduling waiters for re-run, remove them from the waitqueue
already when scheduling to make sure they're not scheduled more
than once.
 1.48  30-Nov-2007  pooka Rototill.

Ok, ok, a few more words about it: stop holding puffs_cc as a holy
value and passing it around to almost every possible place (popquiz:
which kernel variable does this remind you of?). Instead, pass
the natural choice, puffs_usermount, and fetch puffs_cc via
puffs_cc_getcc() only in routines which actually need it. This
not only simplifies code, but (thanks to the introduction of
puffs_cc_getcc()) enables constructs which weren't previously sanely
possible, say layering as a curious example.

There's still a little to do on this front, but this was the major
fs interface blast.
 1.47  30-Nov-2007  pooka Introduce the concept of lazyopens. This means that when a file
handle open is requested, it is waited for only if the node was
not previously succesfully opened. The actual wait for the file
handle happens only when the file handle is actually needed (read
or write). This in turn has the effect that reading cached files
will be quick instead of waiting for the file handle from the sftp
server first. The wait previously could be very long if there were
serveral hundred k of outstanding requests in a limited-bandwidth
link.

The code is in some need of serious handholding, but it works, so
I'll leave that as "future work".
 1.46  27-Nov-2007  pooka Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces. puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
 1.45  18-Nov-2007  pooka Don't bother tracking opencount and try to close file handles in
the close method - simply just wait for inactive and do it there.
 1.44  11-Nov-2007  pooka Don't overload "attributes last read" for the symlink cache,
use a separate variable.
 1.43  10-Nov-2007  pooka Cache readlink results similarly to attributes. Makes "cd" fast
for a slow connection if a symlink is along the path.

(this should be done elsewhere, but I want it for sshfs now)
 1.42  21-Oct-2007  pooka Use puffs_cc_schedule() (which is an exported interface) instead of
plugging directly to puffs_goto().
 1.41  20-Oct-2007  pooka Add option -r to specify maximum number of active read requests
for each node. Setting this to a small number can be used to
improve interactive performance on low-bandwidth links when performing
bulk data reads. Of course I could also open separate pipes for
bulk and other, but this was quicker and less intrusive and doesn't
require authenticating twice.
 1.40  16-Oct-2007  pooka Close file handles if opencount drops to zero instead of closing
them if it does not drop to zero, i.e. fix a pretty obvious bug.
 1.39  24-Aug-2007  pooka branches: 1.39.2;
If a node is forcibly reclaimed, close can be called more times
than open (or less, for the particular fs). So don't be uptight
about opencount.
 1.38  23-Aug-2007  pooka Prevent crash in case there is more than one reader for the same
directory concurrently. Might need to revisit the method used here
later, though.
 1.37  29-Jul-2007  pooka branches: 1.37.4;
make closehandles() void, because that's what it is
 1.36  27-Jul-2007  pooka Track memory mappings. Close file handles already in close() if there
are no active mappings, otherwise do the standard inactive() run.
 1.35  19-Jul-2007  pooka Oops, the cookies for nfs of course represent the *next* directory
entry offset, not the current one.
 1.34  16-Jul-2007  pooka If the target node exists in rename, do not try to issue a setback
to signal no references, as that is not currently supported for
node_rename(). The removed node will not immediately be reclaimed,
but we can live with that for now.

While here, factor the removal code a bit to share with remove and
rmdir.

fixes PR kern/36637 by reinoud
 1.33  02-Jul-2007  pooka adapt: inactive no longer comes with int *refcount (not that it was
used except for setting the default here anyway)
 1.32  01-Jul-2007  pooka adapt: **newnode etc. pointers -> struct puffs_newinfo
 1.31  01-Jul-2007  pooka adapt: pid -> const struct puffs_cid *
 1.30  06-Jun-2007  pooka Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
 1.29  18-May-2007  pooka remove obvious incorrect assert() from doreclaim() and remove the
whole PSN_NUKED bit - it's not very useful because of the noref setback.
 1.28  18-May-2007  pooka * use NOREF setback to prompt immediate (well, once the kernel
reference count goes to 0) reclaim of deleted nodes as opposed to
waiting for the system to start reclaiming the freelist
* combine some nodeflags from different variable to one status variable
 1.27  15-May-2007  pooka adapt to "step 3" of puffs_framebuf changes
 1.26  11-May-2007  pooka adapt to puffs_framebuf changes
 1.25  07-May-2007  pooka Use inactive-on-demand, set inactive request in open() to close
file handles when last reference is removed from the kernel.
 1.24  06-May-2007  pooka Open files in open and close them in inactive. This avoids the
silly and problematic chmod + open + "un"chmod in write, among
other things.
 1.23  06-May-2007  pooka Fire off FXP_CLOSE in create() and return immediately instead of
waiting for the result.
 1.22  05-May-2007  pooka Adapt to use puffs_framebuf. This gets rid of most of the duplicated
code between mount_psshfs and mount_9p and clarifies the code
structure.
 1.21  01-May-2007  pooka g/c forgotten printf
 1.20  19-Apr-2007  pooka use puffs_cc_getspecific() where puffs_usermount is not required
 1.19  17-Apr-2007  pooka use PUFFS_STORE_DCOOKIE
 1.18  12-Apr-2007  pooka Actually, we can't reclaim our memory image for nodes which have
been nodetofh translated even if they are not valid on the sftp
server anymore, because some nfs client might still be clinging on
to the file handle we are reclaiming now.
 1.17  12-Apr-2007  pooka Support nfs exporting.

Now, when I say support, I mean "support", due to the limitations
of the backend. File handles are valid only for one session, since
nodes can only be identified by pathnames and pathnames don't (all)
fit into the nfs file handle space. Additionally, we can't detect
if a pathname is completely replaced by another file (if it's done
via some other route that through our mount, of course). But then
again, that's an inherent problem with sshfs even without nfs.
 1.16  12-Apr-2007  pooka Hide struct puffs_usermount from the rest of the world and provide
accessors for interesting data in it. Namely, you can now get
pu->pu_privdata with puffs_getspecific(), pu->pu_pn_root with
puffs_set/getroot() and pu->pu_maxreqlen with puffs_getmaxreqlen().
 1.15  11-Apr-2007  pooka adapt to new readdir signature. no functional change
 1.14  09-Apr-2007  pooka fix another case of checking for return value from wrong variable
(that's what you get when you copypaste code, a cid with a pin
to burst your bubble, that's what you get for all your troubles, I'll
never copypaste again)

CID 4461
 1.13  09-Apr-2007  pooka Check for success from correct variable after allocnode()

CID 4460
 1.12  22-Mar-2007  pooka If we have to do a stat in lookup, update time of last stat for
the new node to avoid a most likely immediate stat from the server.
 1.11  22-Mar-2007  pooka In case lookup from the directory listing fails, try statting the
target before giving up. Makes it possible to access files from
-r+x directories.
 1.10  13-Mar-2007  pooka * don't require a directory entry to exist for a reclaimee node.
this can happen legally when a file is removed from backing
storage not using this sshfs instance, a readdir is executed for
the parent directory and only then the node gets reclaimed.
* now that there is a mechanism in place which does not require a
pcc to do an sftp transaction, do not yield() in operations where
the final transaction is something where we don't care about the
return value (e.g. close handle). speedup benefit for no cost.
 1.9  27-Feb-2007  pooka size_t -> uint32_t cleanup to make LP64 build

noticed by wiz
 1.8  15-Feb-2007  pooka Support reclaim. To support dotdot lookup, here we leave the
reclaimed nodes hanging until all their children have been reclaimed
and then reclaim everything we can as far up to root as possible.
This is because the file system structures are currently interlinked
in a fashion which would make dotdot lookup based on purely a path
instead of a in-memory node parent member pointer very difficult.
Yes, this deserves a closer look some day.
 1.7  10-Feb-2007  pooka Don't destroy puffs_nodes in success paths of remove and rmdir: the
kernel assumes that they will not be recycled until reclaim.
 1.6  09-Feb-2007  pooka Implement "superreaddir". This issues a getattr for all the
directory entries already in readdir and caches the results instead
of waiting for each individial getattr from the kernel. For
high-latency links the difference in "ls -l" is quite astounding
and even on my lan "ls -lR" is faster than for nfs in a normal
directory hierarchy (i.e. not one artifically setup to have thousands
of files per directory).

TODO: implement some sort of bandwidth/latency measurement in the
code and enable or disable this option based on than information
(and a command-line flag).
 1.5  15-Jan-2007  pooka * adapt to libpuffs path changes
* fix bug in rename
 1.4  11-Jan-2007  pooka Give nukenode a destroy flag. If given, it completely wipes out
the node and directory cache (for directories). Otherwise it just
nukes directory entry information. The latter case is used when
renaming.
 1.3  07-Jan-2007  pooka * Adapt to openssh standard of timestamps in file attributes. Maybe
should make this work with the IETF standard some day, also.
* kludge with writes and permissions a bit to be able to flush data
cached in ubc to files which are already with r/o permissions in
the backend
 1.2  01-Jan-2007  pooka SUSv3 says: should the implementation not support directory unlinking,
unlink shall fail with EPERM and the errno of the failure shall be EPERM
 1.1  29-Dec-2006  pooka puffs sshfs, an sshfs implementation built on top of the puffs
continuation framework
 1.37.4.2  29-Jul-2007  pooka make closehandles() void, because that's what it is
 1.37.4.1  29-Jul-2007  pooka file node.c was added on branch matt-mips64 on 2007-07-29 17:50:23 +0000
 1.39.2.2  09-Jan-2008  matt sync with HEAD
 1.39.2.1  06-Nov-2007  matt sync with HEAD
 1.53.8.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.54.4.1  16-Jan-2009  snj Pull up following revision(s) (requested by pooka in ticket #254):
usr.sbin/puffs/mount_psshfs/node.c: revision 1.55
Track parent directory in cross-directory renames so that mv & rm
for the same file during a vnode's lifecycle works.
... rename fix .. it's going to be a good year ...
 1.55.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.63.2.1  17-Apr-2012  yamt sync with head
 1.64.22.1  04-Nov-2016  pgoyette Sync with HEAD

RSS XML Feed