Home | History | Annotate | Download | only in mount_psshfs
History log of /src/usr.sbin/puffs/mount_psshfs/subr.c
RevisionDateAuthorComments
 1.51  04-Nov-2012  christos include the headers you use
 1.50  01-Apr-2010  pooka branches: 1.50.6; 1.50.12;
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.49  17-Feb-2010  pooka Save "." attributes in readdir. This fixes the root link count
after readdir is called for the root dir the first time (yes,
there's still a window of wrong link count after the fs is mounted.
it's currently quite difficult to call sftp_readdir() from outside
the main loop).

Should fix "find /mnt" problem for a mountpoint with more than the
"guessed" amount of subdirectories, as reported by dyoung.
 1.48  07-Jan-2010  pooka Add -u and -g, which allow to remap one (local,remote) uidgid, i.e.
umapfs without the fuss.
 1.47  05-Nov-2009  pooka more lp64 it's-a-sign! fixes
 1.46  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.45  13-Dec-2007  pooka Record inode number in psshfs_dir also for already instantiated
nodes when doing readdir. This makes pwd work again for cases
where getcwd() actually has to do the "READDIR + compare inode
numbers" trick.

Yet another problem reported by jmmv.
 1.44  13-Dec-2007  pooka *blink*, remember to update comment too
 1.43  13-Dec-2007  pooka Do previous in a way which causes less waste of potential inode numbers.
 1.42  12-Dec-2007  pooka Fix lossage noticed by jmmv (mostly for -t 0 mounts) and make sure
a node always has the inode number set. And since I'm feeling
generous, sprinkle a few comments around the affected areas (mostly
so that I'd remember what in the world the code is trying to do).
 1.41  07-Dec-2007  pooka Don't use puffs_cc_getusermount()
 1.40  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.39  05-Dec-2007  pooka Invalidate namecache for a directory only if we've already read it
at least once.
 1.38  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.37  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.36  16-Nov-2007  pooka If a regular file was remotely updated and a readdir was done on
the directory which contained the file before a getattr on the file
itself, the locally cached mtime would be updated without invalidating
the kernel page cache. Thus incorrect data would be returned when
the node was read afterwards as the node size wouldn't match the
data length in the page cache.

Fix the problem by making all vattr-setting routines use the same code.

Problem noticed again by jmmv & atf (and again by running atf over
psshfs ... sometimes you're the windshield, sometimes you're the bug)
 1.35  16-Nov-2007  jmmv Drop trailing whitespace. On behalf of pooka.
 1.34  16-Nov-2007  pooka When checking if the file page cache should be invalidated, compare
against cached mtime instead of attrread - attrread can be reset
these days by sending SIGHUP.

Problem noticed by jmmv & atf (well.. namely by using atf through psshfs).
 1.33  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.32  08-Nov-2007  pooka Make it possible to force attribute/directory cache re-read by
sending SIGHUP to mount_psshfs.
 1.31  08-Nov-2007  pooka Make attribute & directory content caching timeout a command line
option. Use -t -1 to never expire, which is nifty on a high-latency
link where you know the server won't be modified from under you.
 1.30  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.29  08-Sep-2007  pooka Free longname in all error branches. CID: 4545
 1.28  25-Aug-2007  pooka branches: 1.28.2;
error branch management. CID 4503
 1.27  25-Aug-2007  pooka jump to correct error branch. CID 4500
 1.26  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.25  21-Jun-2007  pooka print warning if directory cache invalidation fails
 1.24  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.23  20-May-2007  pooka In case we are really tight on vnodes, the directory vnode might
be reclaimed from under while we are warming the getattr cache.
Shuffle some code to prevent the effects. Theoretically the race
is still possible, but I don't think it will happen in practice.
In any case, the code could benefit from some more dusting.
 1.22  20-May-2007  pooka Observe that when doing ls -l, the attributes of the first file
getattr are usually still outstanding when we already would like
the result. Instead of issueing another stat which will be serviced
only after all the other entries in the directory, record all the
outgoing readdir getattr buffers and if we encounter an outstanding
request when we need to fetch attrs, do a puffs_framev_framebuf_ccpromote()
wait for it instead of firing off the second query. This shaves
almost 10% off the time for ls -lR.

Also, get rid of the SUPERREADDIR conditional, since it has penetrated
the code quite a bit and the #ifdef SUPERREADDIRs were starting to
look like tagliatelle alla bolognese (n.b. I love how it looks,
but I wouldn't like it either if my tagliatelle alla bolognese
looked like psshfs code). Maybe it should be re-introduced in the
form of a switch?
 1.21  20-May-2007  pooka Implement SUPERREADDIR (like nfs readdirplus) getattr cache warming
a bit differently: when reading the directory, store all getattr
caching queries and fire off only when the directory read is
complete. That way the common sequence is not [readdir, lots of
async getattr requests, readdir EOF] but rather [readdir, readdir
EOF, lots of async getattr]. This speeds up ls -lR by about 25%
(on my LAN).
 1.20  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.19  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.18  16-May-2007  pooka Add error parameter to puffs_framev_cb to signal if there is a
result of if the function should just do resource cleanup.
 1.17  15-May-2007  pooka remember to free longname if getting vattr from the message fails

CID 4486
 1.16  15-May-2007  pooka adapt to "step 3" of puffs_framebuf changes
 1.15  11-May-2007  pooka adapt to puffs_framebuf changes
 1.14  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.13  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.12  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.11  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.10  27-Feb-2007  pooka one more size_t -> uint32_t
 1.9  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.8  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.7  15-Jan-2007  pooka * adapt to libpuffs path changes
* fix bug in rename
 1.6  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.5  09-Jan-2007  pooka Invalidate kernel name cache for a directory when (re-)reading
directory contents from the server.
 1.4  09-Jan-2007  pooka Mark invalid attributes as invalid. Fixes stuff such a cp'ing files
when cp uses mmap(). Also makes attributes appear correct.
 1.3  07-Jan-2007  pooka properly carry fileid for directory entries, fixes pwd
 1.2  07-Jan-2007  pooka fix link count calculation for directories
 1.1  29-Dec-2006  pooka puffs sshfs, an sshfs implementation built on top of the puffs
continuation framework
 1.28.2.2  09-Jan-2008  matt sync with HEAD
 1.28.2.1  06-Nov-2007  matt sync with HEAD
 1.50.12.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.50.6.1  16-Jan-2013  yamt sync with (a bit old) head

RSS XML Feed