提交 a7a1343b 编写于 作者: V vcbchang

fix: pipecommon_open/close操作时进行usecount++/--操作时未进行加锁处理

【背景】在测试fork通过fifo进行进程间通信时,进程同时进行open操作时会出现close失败的情况.

【修改方案】
pipecommon_close/open函数中在进行vnode->usecount++/--时没有进行加锁和解锁处理,会造成读出数据错误的情况,现在给予修正。

re #I41PBB
Signed-off-by: Nvcbchang <vcbchang@qq.com>
Change-Id: Ie944769617042c4d85e7cc52f5e4e341471d7d99
上级 d72396f0
......@@ -281,9 +281,9 @@ int pipecommon_open(struct file *filep)
(void)pipecommon_close(filep);
}
}
VnodeHold();
vnode->useCount++;
VnodeDrop();
return ret;
}
......@@ -378,9 +378,9 @@ int pipecommon_close(struct file *filep)
dev->d_nwriters = 0;
dev->d_nreaders = 0;
}
VnodeHold();
vnode->useCount--;
VnodeDrop();
sem_post(&dev->d_bfsem);
return OK;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册