提交 0783a25b 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

retry on concurrent create

上级 0b4a7695
......@@ -227,6 +227,7 @@ create(char *path, short type, short major, short minor)
struct inode *ip, *dp;
char name[DIRSIZ];
retry:
if((dp = nameiparent(path, name)) == 0)
return 0;
if(dp->type != T_DIR)
......@@ -257,8 +258,13 @@ create(char *path, short type, short major, short minor)
panic("create dots");
}
if(dirlink(dp, name, ip->inum) < 0)
panic("create: dirlink");
if(dirlink(dp, name, ip->inum) < 0) {
// create race
ip->nlink--;
iunlockput(ip);
iput(dp);
goto retry;
}
//nc_insert(dp, name, ip);
iput(dp);
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论