upas/fs: handle cwfs "file is locked" error message

This commit is contained in:
cinap_lenrek 2014-11-14 23:36:18 +01:00
parent f51f73bdca
commit 52c1f712ec

View file

@ -182,11 +182,13 @@ retry:
fd = open(mb->path, OREAD); fd = open(mb->path, OREAD);
if(fd < 0){ if(fd < 0){
rerrstr(err, sizeof(err)); rerrstr(err, sizeof(err));
if(strstr(err, "exclusive lock") != 0 && n++ < 20){ if(strstr(err, "file is locked") != nil
sleep(500); /* wait for lock to go away */ || strstr(err, "exclusive lock") != nil)
goto retry; if(n++ < 20){
} sleep(500); /* wait for lock to go away */
if(strstr(err, "exist") != 0){ goto retry;
}
if(strstr(err, "exist") != nil){
tmp = s_copy(mb->path); tmp = s_copy(mb->path);
s_append(tmp, ".tmp"); s_append(tmp, ".tmp");
if(sysrename(s_to_c(tmp), mb->path) == 0){ if(sysrename(s_to_c(tmp), mb->path) == 0){