From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io0-f177.google.com ([209.85.223.177]) by ewsd; Tue Feb 13 18:31:48 EST 2018 Received: by mail-io0-f177.google.com with SMTP id k80so11805164ioe.13 for <9front@9front.org>; Tue, 13 Feb 2018 15:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sphericalharmony-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version; bh=7so1TwcMf7ywg6jDTazgJEq1LTDa/ynyy3cahrBwDUc=; b=wMM0YY7jkY1Ejx9P9nOEhlyB0b8jOdnD9RwkNjK4V5gG4LDzg9bGeK0Up7JyMIl/P3 rvW1gb2tIHAo2K4B++H+TUtCMPb5qCkZtYd+k1dc6WLJc/ZHqDGIe0wCfwQmz17Cccwc 7GC6i1rxGqDcyanBIhGJgKGQSVO8d5C8vJIM5ajClVLCRGYAPYabOxBdRX8HmgeN0kSx IQ/B2DGDOIj9f+T8nC2DHXLvGqlpHNMRRoqf61kiyDipSw5kkHCkGWgY43hV6udyxdjy 8SS/2G78lhCA8cjPOawJMxblFDCDBXWHZrRoUFsOaSWYNV9l30Ye5vk1OJA2IPgUxUQc dqsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:to:subject:mime-version; bh=7so1TwcMf7ywg6jDTazgJEq1LTDa/ynyy3cahrBwDUc=; b=uToUpCc4+0P2gnTM6GJu4RpR7dJJOz/Sw3XsHoOWyzdtsJDNO7xxSa73pY/Gnqgvf5 cWLXDArjp3/TVHBXTw/yAr/oB8sHu6AW8d2Qy2lhiacqIdvGJ8368X0eYiVIMX5RX4sQ nNxALG9ShyP1ETiMXPye6UaCHspzQWTq554Mip5hH3WtERJFuYodM1a/MshWlnvJbCjL ky8kD7i2+rbVI1y7uxoiN1CrS2MDzOmOesyXaafFxi+QlZGsXGPRQ0vU2NZwLls2yKXG R62dkWmzI5rP/dlKUFBCjRZ4qUQLZOg/b6Omn657DdmkKOYidKKZ2ZxksIqntBbIIQVD SDUg== X-Gm-Message-State: APf1xPCBDrA/UC83ycQMfDBQGwaCGcgOVX72y9DNqjWo6/8zD+GdNAre jQDVvJ2QAxu2PQ17ZLKvjNxirufA X-Google-Smtp-Source: AH8x227zZf6L0mSV73mgIhMsfKKgLgf1NrZ+sFJkJ1gxcL0ue9eQ7Twy25tyKd9i70vNUsNoeBoyWA== X-Received: by 10.107.242.14 with SMTP id q14mr3241412ioh.211.1518564706502; Tue, 13 Feb 2018 15:31:46 -0800 (PST) Return-Path: Received: from x240.Home (h184-61-51-222.burkwi.dedicated.static.tds.net. [184.61.51.222]) by smtp.gmail.com with ESMTPSA id k91sm90613iod.6.2018.02.13.15.31.45 for <9front@9front.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Feb 2018 15:31:45 -0800 (PST) From: mycroftiv@sphericalharmony.com X-Google-Original-From: glenda@sphericalharmony.com Message-ID: <81013C066FD281C66F83CFD036E9B48E@sphericalharmony.com> Date: Tue, 13 Feb 2018 23:31:37 +0000 To: 9front@9front.org Subject: fixed(?) ftpfs cache patch MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-wrjqyydzcuchniewgaimpgzajr" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: encrypted encrypted WEB2.0 over ORM map/reduce callback optimizer This is a multi-part message in MIME format. --upas-wrjqyydzcuchniewgaimpgzajr Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Last patch was junk. Changes: * Only exempt directories from caching, static file transfers require it * Change -h flag to -c * Don't interfere with caching of top VM and VMS directories * Remove redundancy Thanks cinap for pointing out the problems. -mycroftiv --upas-wrjqyydzcuchniewgaimpgzajr Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit --- /sys/src/cmd/ip/ftpfs/ftpfs.c Sat Dec 31 17:31:22 2016 +++ ftpfs.c Tue Feb 13 16:02:46 2018 @@ -85,6 +85,7 @@ char *nosuchfile = "file does not exist"; char *keyspec = ""; +int docache = 0; void usage(void) @@ -149,6 +150,9 @@ case 'q': quiet = 1; break; + case 'c': + docache = 1; + break; } ARGEND if(argc != 1) usage(); @@ -464,7 +468,8 @@ if(readfile(f->node) < 0) return errstring; } - CACHED(f->node); + if(docache || ((f->node->d->qid.type & QTDIR) == 0)) + CACHED(f->node); } } @@ -537,7 +542,8 @@ if(!ISCACHED(f->node)) if(readfile(f->node) < 0) return errstring; - CACHED(f->node); + if(docache || ((f->node->d->qid.type & QTDIR) == 0)) + CACHED(f->node); rv = fileread(f->node, (char*)mbuf, off, cnt); if(rv < 0) return errstring; @@ -617,7 +623,8 @@ if(!ISCACHED(p)){ invalidate(p); readdir(p); - CACHED(p); + if(docache || ((f->node->d->qid.type & QTDIR) == 0)) + CACHED(p); } if(!ISVALID(f->node)) return nosuchfile; --upas-wrjqyydzcuchniewgaimpgzajr Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit --- /sys/man/4/ftpfs Tue Jan 17 18:13:59 2012 +++ ftpfs.man Tue Feb 13 16:36:05 2018 @@ -4,7 +4,7 @@ .SH SYNOPSIS .B ftpfs [ -.B -/dqnt +.B -/dqntc ] [ .B -m @@ -90,6 +90,10 @@ To see all messages from the server use option .BR -d . .PP +By default ftpfs does not cache directories from the remote server. The +.BR -c +flag enables directory caching, but this may result in an outdated view of remote files available. +.PP Some systems will hangup an ftp connection that has no activity for a given period. The .BR -K @@ -183,13 +187,9 @@ However, walking to any valid directory on that machine will succeed and cause that directory entry to appear under the mount point. .PP -.I Ftpfs -caches files and directories. A directory will fall from the cache -after 5 quiescent minutes or if the local user changes the -directory by writing or removing a file. -Otherwise, remote +If caching is active, remote changes to the directory that occur after the directory has -been cached might not be immediately visible. +been cached will not be visible. Attempting to walk to .IB directory /.flush.ftpfs will flush --upas-wrjqyydzcuchniewgaimpgzajr--