Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
b9cb88b0
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b9cb88b0
编写于
8月 02, 2011
作者:
A
Aneesh Kumar K.V
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hw/9pfs: mark directories also as un-reclaimable on unlink
Signed-off-by:
N
Aneesh Kumar K.V
<
aneesh.kumar@linux.vnet.ibm.com
>
上级
95f65511
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
38 addition
and
35 deletion
+38
-35
hw/9pfs/virtio-9p.c
hw/9pfs/virtio-9p.c
+38
-35
未找到文件。
hw/9pfs/virtio-9p.c
浏览文件 @
b9cb88b0
...
...
@@ -235,6 +235,27 @@ static size_t v9fs_string_size(V9fsString *str)
return
str
->
size
;
}
/*
* returns 0 if fid got re-opened, 1 if not, < 0 on error */
static
int
v9fs_reopen_fid
(
V9fsState
*
s
,
V9fsFidState
*
f
)
{
int
err
=
1
;
if
(
f
->
fid_type
==
P9_FID_FILE
)
{
if
(
f
->
fs
.
fd
==
-
1
)
{
do
{
err
=
v9fs_co_open
(
s
,
f
,
f
->
open_flags
);
}
while
(
err
==
-
EINTR
);
}
}
else
if
(
f
->
fid_type
==
P9_FID_DIR
)
{
if
(
f
->
fs
.
dir
==
NULL
)
{
do
{
err
=
v9fs_co_opendir
(
s
,
f
);
}
while
(
err
==
-
EINTR
);
}
}
return
err
;
}
static
V9fsFidState
*
get_fid
(
V9fsState
*
s
,
int32_t
fid
)
{
int
err
;
...
...
@@ -249,34 +270,17 @@ static V9fsFidState *get_fid(V9fsState *s, int32_t fid)
* in open later.
*/
f
->
ref
++
;
/*
* check whether we need to reopen the
* file. We might have closed the fd
* while trying to free up some file
* descriptors.
*/
if
(
f
->
fid_type
==
P9_FID_FILE
)
{
if
(
f
->
fs
.
fd
==
-
1
)
{
do
{
err
=
v9fs_co_open
(
s
,
f
,
f
->
open_flags
);
}
while
(
err
==
-
EINTR
);
if
(
err
<
0
)
{
f
->
ref
--
;
return
NULL
;
}
}
}
else
if
(
f
->
fid_type
==
P9_FID_DIR
)
{
if
(
f
->
fs
.
dir
==
NULL
)
{
do
{
err
=
v9fs_co_opendir
(
s
,
f
);
}
while
(
err
==
-
EINTR
);
err
=
v9fs_reopen_fid
(
s
,
f
);
if
(
err
<
0
)
{
f
->
ref
--
;
return
NULL
;
}
}
}
/*
* Mark the fid as referenced so that the LRU
* reclaim won't close the file descriptor
...
...
@@ -490,11 +494,9 @@ static int v9fs_mark_fids_unreclaim(V9fsState *s, V9fsString *str)
if
(
!
strcmp
(
fidp
->
path
.
data
,
str
->
data
))
{
/* Mark the fid non reclaimable. */
fidp
->
flags
|=
FID_NON_RECLAIMABLE
;
/* reopen the file if already closed */
if
(
fidp
->
fs
.
fd
==
-
1
)
{
do
{
err
=
v9fs_co_open
(
s
,
fidp
,
fidp
->
open_flags
);
}
while
(
err
==
-
EINTR
);
/* reopen the file/dir if already closed */
err
=
v9fs_reopen_fid
(
s
,
fidp
);
if
(
err
<
0
)
{
return
-
1
;
}
...
...
@@ -503,6 +505,7 @@ static int v9fs_mark_fids_unreclaim(V9fsState *s, V9fsString *str)
* the list could have got updated when
* switched to the worker thread
*/
if
(
err
==
0
)
{
fidp
=
&
head_fid
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录