diff options
author | Joey Hess <joey@kitenet.net> | 2012-06-15 12:22:28 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-06-15 12:22:28 -0400 |
commit | a95149ac0f05d462edceac867b66b6498f1c7474 (patch) | |
tree | e76c6caf0b4e01467c891b634e0e969174d1f48b | |
parent | 37a13de8ff931574174a7b64ba6a487b6ef2f754 (diff) |
quarantine idea to avoid repeated lsof calls
-rw-r--r-- | doc/design/assistant/inotify.mdwn | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/design/assistant/inotify.mdwn b/doc/design/assistant/inotify.mdwn index 9d8857ab6..baa420b4e 100644 --- a/doc/design/assistant/inotify.mdwn +++ b/doc/design/assistant/inotify.mdwn @@ -19,6 +19,19 @@ There is a `watch` branch in git that adds the command. * Somehow track or detect if a file is open for write by any processes. `lsof` could be used, although it would be a little slow. + + Here's one way to avoid the slowdown: When a file is being added, + set it read-only, and hard-link it into a quarantine directory, + remembering both filenames. + Then use the batch change mode code to detect batch adds and bundle + them together. + Just before committing, lsof the quarantine directory. Any files in + it that are still open for write can just have their write bit turned + back on and be deleted from quarantine, to be handled when their writer + closes. Files that pass quarantine get added as usual. This avoids + repeated lsof calls slowing down adds, but does add a constant factor + overhead (0.25 seconds lsof call) before any add gets committed. + * Or, when possible, making a copy on write copy before adding the file would avoid this. * Or, as a last resort, make an expensive copy of the file and add that. |