When accessing a local remote, shut down git-cat-file processes afterwards, to ensure that remotes on removable media can be unmounted. Closes: #758630
This does mean that eg, copying multiple files to a local remote will become slightly slower, since it now restarts git-cat-file after each copy. Should not be significant slowdown. The reason git-cat-file is run on the remote at all is to update its location log. In order to add an item to it, it needs to get the current content of the log. Finding a way to avoid needing to do that would be a good path to avoiding this slowdown if it does become a problem somehow. This commit was sponsored by Evan Deaubl.
This commit is contained in:
parent
83dc82c232
commit
96dc423e39
4 changed files with 23 additions and 1 deletions
|
@ -51,6 +51,7 @@ import qualified Remote.Helper.Ssh as Ssh
|
|||
import qualified Remote.GCrypt
|
||||
import Config.Files
|
||||
import Creds
|
||||
import Annex.CatFile
|
||||
|
||||
import Control.Concurrent
|
||||
import Control.Concurrent.MSampleVar
|
||||
|
@ -500,6 +501,8 @@ repairRemote r a = return $ do
|
|||
{- Runs an action from the perspective of a local remote.
|
||||
-
|
||||
- The AnnexState is cached for speed and to avoid resource leaks.
|
||||
- However, catFileStop is called to avoid git-cat-file processes hanging
|
||||
- around on removable media.
|
||||
-
|
||||
- The repository's git-annex branch is not updated, as an optimisation.
|
||||
- No caller of onLocal can query data from the branch and be ensured
|
||||
|
@ -520,7 +523,8 @@ onLocal r a = do
|
|||
cache st = Annex.changeState $ \s -> s
|
||||
{ Annex.remoteannexstate = M.insert (uuid r) st (Annex.remoteannexstate s) }
|
||||
go st a' = do
|
||||
(ret, st') <- liftIO $ Annex.run st a'
|
||||
(ret, st') <- liftIO $ Annex.run st $
|
||||
catFileStop `after` a'
|
||||
cache st'
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue