3ffbe45a6d
We created a new fileset before stopping the folder during restart. When we create that fileset it loads the current metadata and sequence numbers from the database. But the folder may have time to update those before stopping, leaving the new fileset with bad data. This would cause wrong accounting (forgotten files) and potentially sequence reuse causing files not sent to other devices. This change reuses the fileset on restart, skipping the issue entirely. It also moves the creation of the fileset back under the lock so there should be no chance of concurrency issues here.