xapi-project / xenopsd

XCP toolstack domain manager
Other
15 stars 68 forks source link

CA-258444: Fix a race when removing files from the filesystem #754

Closed robhoes closed 3 years ago

robhoes commented 3 years ago

If two threads are simultaneously trying to remove "foo/bar1" and "foo/bar2" from the FileFS module, each thread will try to remove ["foo/bar{1,2}"; "foo"], deciding whether it's a directory or file by stating them. There was logic to catch the ENOTEMPTY when the first one tries to rm foo, but if both threads remove their "bar"s before either tries to remove the "foo", the first will rm "foo" successfully but the second would get an error trying to stat the file. This c/s fixes that exception.

Signed-off-by: Jon Ludlam jonathan.ludlam@citrix.com (cherry picked from commit 0833dda968c95243ae5ffee2e7bb3f4baf2622a1)