Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party NuttX
提交
b0d7b906
T
Third Party NuttX
项目概览
OpenHarmony
/
Third Party NuttX
大约 1 年 前同步成功
通知
5
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party NuttX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b0d7b906
编写于
12月 29, 2021
作者:
O
openharmony_ci
提交者:
Gitee
12月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
!105 [LTS-3.0]修复在NFS上执行一次程序后在服务端修改程序可能引起错误的BUG
Merge pull request !105 from Far/cherry-pick-1640053555
上级
51587396
5dd91c31
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
63 addition
and
5 deletion
+63
-5
fs/nfs/nfs_adapter.c
fs/nfs/nfs_adapter.c
+60
-3
fs/nfs/nfs_node.h
fs/nfs/nfs_node.h
+1
-1
fs/nfs/nfs_util.c
fs/nfs/nfs_util.c
+2
-1
未找到文件。
fs/nfs/nfs_adapter.c
浏览文件 @
b0d7b906
...
...
@@ -321,7 +321,8 @@ static int vfs_nfs_stat_internal(struct nfsmount *nmp, struct nfsnode *nfs_node)
/* Extract time values as type time_t in units of seconds */
fxdr_nfsv3time
(
&
attr_reply
.
attr
.
fa_mtime
,
&
ts
);
nfs_node
->
n_mtime
=
ts
.
tv_sec
;
nfs_node
->
n_timestamp
.
tv_sec
=
ts
.
tv_sec
;
nfs_node
->
n_timestamp
.
tv_nsec
=
ts
.
tv_nsec
;
fxdr_nfsv3time
(
&
attr_reply
.
attr
.
fa_atime
,
&
ts
);
nfs_node
->
n_atime
=
ts
.
tv_sec
;
...
...
@@ -910,12 +911,12 @@ int vfs_nfs_stat(struct Vnode *node, struct stat *buf)
buf
->
st_size
=
(
off_t
)
nfs_node
->
n_size
;
buf
->
st_blksize
=
0
;
buf
->
st_blocks
=
0
;
buf
->
st_mtime
=
nfs_node
->
n_
mtime
;
buf
->
st_mtime
=
nfs_node
->
n_
timestamp
.
tv_sec
;
buf
->
st_atime
=
nfs_node
->
n_atime
;
buf
->
st_ctime
=
nfs_node
->
n_ctime
;
/* Adapt to kstat member "long tv_sec" */
buf
->
__st_mtim32
.
tv_sec
=
(
long
)
nfs_node
->
n_
mtime
;
buf
->
__st_mtim32
.
tv_sec
=
(
long
)
nfs_node
->
n_
timestamp
.
tv_sec
;
buf
->
__st_atim32
.
tv_sec
=
(
long
)
nfs_node
->
n_atime
;
buf
->
__st_ctim32
.
tv_sec
=
(
long
)
nfs_node
->
n_ctime
;
...
...
@@ -3071,6 +3072,61 @@ errout_with_mutex:
return
-
error
;
}
static
int
nfs_check_timestamp
(
struct
timespec
*
origin
,
struct
timespec
*
new
)
{
return
(
origin
->
tv_sec
==
new
->
tv_sec
)
&&
(
origin
->
tv_nsec
==
new
->
tv_nsec
);
}
static
int
vfs_nfs_open
(
struct
file
*
filep
)
{
int
ret
;
struct
timespec
ts
;
struct
rpc_call_fs
attr_call
;
struct
rpc_reply_getattr
attr_reply
;
struct
Vnode
*
node
=
filep
->
f_vnode
;
struct
nfsnode
*
nfs_node
=
NULL
;
struct
nfsmount
*
nmp
=
(
struct
nfsmount
*
)(
node
->
originMount
->
data
);
struct
file_handle
parent_fhandle
=
{
0
};
nfs_mux_take
(
nmp
);
nfs_node
=
(
struct
nfsnode
*
)
node
->
data
;
attr_call
.
fs
.
fsroot
.
length
=
txdr_unsigned
(
nfs_node
->
n_fhsize
);
memcpy_s
(
&
(
attr_call
.
fs
.
fsroot
.
handle
),
sizeof
(
nfsfh_t
),
&
(
nfs_node
->
n_fhandle
),
sizeof
(
nfsfh_t
));
ret
=
nfs_request
(
nmp
,
NFSPROC_GETATTR
,
&
attr_call
,
sizeof
(
struct
file_handle
),
&
attr_reply
,
sizeof
(
struct
rpc_reply_getattr
));
if
(
ret
!=
OK
)
{
if
(
ret
==
NFSERR_STALE
)
{
/* If the file handle is stale, update it */
OsFileCacheRemove
(
&
(
node
->
mapping
));
parent_fhandle
.
length
=
((
struct
nfsnode
*
)
node
->
parent
->
data
)
->
n_fhsize
;
memcpy_s
(
&
(
parent_fhandle
.
handle
),
parent_fhandle
.
length
,
&
(((
struct
nfsnode
*
)
node
->
parent
->
data
)
->
n_fhandle
),
((
struct
nfsnode
*
)
node
->
parent
->
data
)
->
n_fhsize
);
ret
=
nfs_fileupdate
(
nmp
,
nfs_node
->
n_name
,
&
parent_fhandle
,
nfs_node
);
}
nfs_mux_release
(
nmp
);
return
ret
;
}
/* Extract time values as timestamp */
fxdr_nfsv3time
(
&
attr_reply
.
attr
.
fa_mtime
,
&
ts
);
if
(
!
nfs_check_timestamp
(
&
(
nfs_node
->
n_timestamp
),
&
ts
))
{
OsFileCacheRemove
(
&
(
node
->
mapping
));
nfs_node
->
n_timestamp
.
tv_sec
=
ts
.
tv_sec
;
nfs_node
->
n_timestamp
.
tv_nsec
=
ts
.
tv_nsec
;
}
nfs_mux_release
(
nmp
);
return
OK
;
}
struct
MountOps
nfs_mount_operations
=
{
.
Mount
=
vfs_nfs_mount
,
...
...
@@ -3100,6 +3156,7 @@ struct VnodeOps nfs_vops =
struct
file_operations_vfs
nfs_fops
=
{
.
open
=
vfs_nfs_open
,
.
seek
=
vfs_nfs_seek
,
.
write
=
vfs_nfs_write
,
.
read
=
vfs_nfs_read
,
...
...
fs/nfs/nfs_node.h
浏览文件 @
b0d7b906
...
...
@@ -83,8 +83,8 @@ struct nfsnode
uint8_t
n_flags
;
/* Node flags */
uint16_t
n_mode
;
/* File mode for fstat() */
time_t
n_atime
;
/* File access time */
time_t
n_mtime
;
/* File modification time */
time_t
n_ctime
;
/* File creation time */
struct
timespec
n_timestamp
;
/* Timestamp (modification time) */
nfsfh_t
n_fhandle
;
/* NFS File Handle */
nfsfh_t
n_pfhandle
;
/* NFS File Handle of parent */
uint64_t
n_size
;
/* Current size of file */
...
...
fs/nfs/nfs_util.c
浏览文件 @
b0d7b906
...
...
@@ -563,7 +563,8 @@ void nfs_attrupdate(struct nfsnode *np, struct nfs_fattr *attributes)
np
->
n_size
=
fxdr_hyper
(
&
attributes
->
fa_size
);
fxdr_nfsv3time
(
&
attributes
->
fa_mtime
,
&
ts
);
np
->
n_mtime
=
ts
.
tv_sec
;
np
->
n_timestamp
.
tv_sec
=
ts
.
tv_sec
;
np
->
n_timestamp
.
tv_nsec
=
ts
.
tv_nsec
;
fxdr_nfsv3time
(
&
attributes
->
fa_ctime
,
&
ts
);
np
->
n_ctime
=
ts
.
tv_sec
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录