On Thu, May 14, 2020 at 05:19:18PM +0800, robbieko wrote: > From: Robbie Ko <robbieko@xxxxxxxxxxxx> > > When creating a snapshot, it takes a long time because > flush dirty data is required. > > But we have taken two resources as shown below: > 1. Destination directory inode lock > 2. Global subvol semaphore > > This will cause subvol destroy/create/setflag blocked, > until the snapshot is created. > > We fix by flush dirty data first to reduce the time of > the critical section, and then lock the relevant resources. A bit hard to follow what gets moved where but I got it in the end. Flushing data before snapshotting does not depend on the directory lock nor on the subvol semaphore so moving it out is fine. This should also speed up creating new subvolumes as they don't need any pre-flushing at all. Added to misc-next, thanks.
