Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
8ed61dc3
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8ed61dc3
编写于
11月 09, 2017
作者:
M
Miklos Szeredi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ovl: split out ovl_get_workdir() from ovl_fill_super()
Signed-off-by:
N
Miklos Szeredi
<
mszeredi@redhat.com
>
上级
21a3b317
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
60 addition
and
51 deletion
+60
-51
fs/overlayfs/super.c
fs/overlayfs/super.c
+60
-51
未找到文件。
fs/overlayfs/super.c
浏览文件 @
8ed61dc3
...
...
@@ -912,6 +912,63 @@ static int ovl_get_upper(struct ovl_fs *ufs, struct path *upperpath)
return
0
;
}
static
int
ovl_get_workdir
(
struct
super_block
*
sb
,
struct
ovl_fs
*
ufs
,
struct
path
*
workpath
)
{
struct
dentry
*
temp
;
int
err
;
ufs
->
workdir
=
ovl_workdir_create
(
sb
,
ufs
,
workpath
->
dentry
,
OVL_WORKDIR_NAME
,
false
);
if
(
!
ufs
->
workdir
)
return
0
;
/*
* Upper should support d_type, else whiteouts are visible. Given
* workdir and upper are on same fs, we can do iterate_dir() on
* workdir. This check requires successful creation of workdir in
* previous step.
*/
err
=
ovl_check_d_type_supported
(
workpath
);
if
(
err
<
0
)
return
err
;
/*
* We allowed this configuration and don't want to break users over
* kernel upgrade. So warn instead of erroring out.
*/
if
(
!
err
)
pr_warn
(
"overlayfs: upper fs needs to support d_type.
\n
"
);
/* Check if upper/work fs supports O_TMPFILE */
temp
=
ovl_do_tmpfile
(
ufs
->
workdir
,
S_IFREG
|
0
);
ufs
->
tmpfile
=
!
IS_ERR
(
temp
);
if
(
ufs
->
tmpfile
)
dput
(
temp
);
else
pr_warn
(
"overlayfs: upper fs does not support tmpfile.
\n
"
);
/*
* Check if upper/work fs supports trusted.overlay.* xattr
*/
err
=
ovl_do_setxattr
(
ufs
->
workdir
,
OVL_XATTR_OPAQUE
,
"0"
,
1
,
0
);
if
(
err
)
{
ufs
->
noxattr
=
true
;
pr_warn
(
"overlayfs: upper fs does not support xattr.
\n
"
);
}
else
{
vfs_removexattr
(
ufs
->
workdir
,
OVL_XATTR_OPAQUE
);
}
/* Check if upper/work fs supports file handles */
if
(
ufs
->
config
.
index
&&
!
ovl_can_decode_fh
(
ufs
->
workdir
->
d_sb
))
{
ufs
->
config
.
index
=
false
;
pr_warn
(
"overlayfs: upper fs does not support file handles, falling back to index=off.
\n
"
);
}
return
0
;
}
static
int
ovl_get_lowerstack
(
struct
super_block
*
sb
,
struct
ovl_fs
*
ufs
,
struct
path
**
stackp
,
unsigned
int
*
stacklenp
)
{
...
...
@@ -1041,57 +1098,9 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
sb
->
s_time_gran
=
ufs
->
upper_mnt
->
mnt_sb
->
s_time_gran
;
ufs
->
workdir
=
ovl_workdir_create
(
sb
,
ufs
,
workpath
.
dentry
,
OVL_WORKDIR_NAME
,
false
);
/*
* Upper should support d_type, else whiteouts are visible.
* Given workdir and upper are on same fs, we can do
* iterate_dir() on workdir. This check requires successful
* creation of workdir in previous step.
*/
if
(
ufs
->
workdir
)
{
struct
dentry
*
temp
;
err
=
ovl_check_d_type_supported
(
&
workpath
);
if
(
err
<
0
)
goto
out_put_workdir
;
/*
* We allowed this configuration and don't want to
* break users over kernel upgrade. So warn instead
* of erroring out.
*/
if
(
!
err
)
pr_warn
(
"overlayfs: upper fs needs to support d_type.
\n
"
);
/* Check if upper/work fs supports O_TMPFILE */
temp
=
ovl_do_tmpfile
(
ufs
->
workdir
,
S_IFREG
|
0
);
ufs
->
tmpfile
=
!
IS_ERR
(
temp
);
if
(
ufs
->
tmpfile
)
dput
(
temp
);
else
pr_warn
(
"overlayfs: upper fs does not support tmpfile.
\n
"
);
/*
* Check if upper/work fs supports trusted.overlay.*
* xattr
*/
err
=
ovl_do_setxattr
(
ufs
->
workdir
,
OVL_XATTR_OPAQUE
,
"0"
,
1
,
0
);
if
(
err
)
{
ufs
->
noxattr
=
true
;
pr_warn
(
"overlayfs: upper fs does not support xattr.
\n
"
);
}
else
{
vfs_removexattr
(
ufs
->
workdir
,
OVL_XATTR_OPAQUE
);
}
/* Check if upper/work fs supports file handles */
if
(
ufs
->
config
.
index
&&
!
ovl_can_decode_fh
(
ufs
->
workdir
->
d_sb
))
{
ufs
->
config
.
index
=
false
;
pr_warn
(
"overlayfs: upper fs does not support file handles, falling back to index=off.
\n
"
);
}
}
err
=
ovl_get_workdir
(
sb
,
ufs
,
&
workpath
);
if
(
err
)
goto
out_put_workdir
;
}
err
=
-
ENOMEM
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录