Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
61822ab5
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
61822ab5
编写于
12月 05, 2006
作者:
T
Trond Myklebust
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
NFS: Ensure we only call set_page_writeback() under the page lock
Signed-off-by:
N
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
上级
e261f51f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
15 deletion
+30
-15
fs/nfs/file.c
fs/nfs/file.c
+1
-5
fs/nfs/write.c
fs/nfs/write.c
+28
-10
include/linux/nfs_fs.h
include/linux/nfs_fs.h
+1
-0
未找到文件。
fs/nfs/file.c
浏览文件 @
61822ab5
...
...
@@ -307,14 +307,10 @@ static int nfs_commit_write(struct file *file, struct page *page, unsigned offse
static
void
nfs_invalidate_page
(
struct
page
*
page
,
unsigned
long
offset
)
{
loff_t
range_start
,
range_end
;
if
(
offset
!=
0
)
return
;
/* Cancel any unstarted writes on this page */
range_start
=
page_offset
(
page
);
range_end
=
range_start
+
(
loff_t
)(
PAGE_CACHE_SIZE
-
1
);
nfs_sync_mapping_range
(
page
->
mapping
,
range_start
,
range_end
,
FLUSH_INVALIDATE
);
nfs_wb_page_priority
(
page
->
mapping
->
host
,
page
,
FLUSH_INVALIDATE
);
}
static
int
nfs_release_page
(
struct
page
*
page
,
gfp_t
gfp
)
...
...
fs/nfs/write.c
浏览文件 @
61822ab5
...
...
@@ -81,7 +81,6 @@ static void nfs_mark_request_dirty(struct nfs_page *req);
static
int
nfs_wait_on_write_congestion
(
struct
address_space
*
,
int
);
static
int
nfs_wait_on_requests
(
struct
inode
*
,
unsigned
long
,
unsigned
int
);
static
long
nfs_flush_mapping
(
struct
address_space
*
mapping
,
struct
writeback_control
*
wbc
,
int
how
);
static
int
nfs_wb_page_priority
(
struct
inode
*
inode
,
struct
page
*
page
,
int
how
);
static
const
struct
rpc_call_ops
nfs_write_partial_ops
;
static
const
struct
rpc_call_ops
nfs_write_full_ops
;
static
const
struct
rpc_call_ops
nfs_commit_ops
;
...
...
@@ -280,8 +279,10 @@ static int nfs_page_mark_flush(struct page *page)
spin_lock
(
req_lock
);
}
spin_unlock
(
req_lock
);
if
(
test_and_set_bit
(
PG_FLUSHING
,
&
req
->
wb_flags
)
==
0
)
if
(
test_and_set_bit
(
PG_FLUSHING
,
&
req
->
wb_flags
)
==
0
)
{
nfs_mark_request_dirty
(
req
);
set_page_writeback
(
page
);
}
ret
=
test_bit
(
PG_NEED_FLUSH
,
&
req
->
wb_flags
);
nfs_unlock_request
(
req
);
return
ret
;
...
...
@@ -443,6 +444,13 @@ nfs_mark_request_dirty(struct nfs_page *req)
mark_inode_dirty
(
inode
);
}
static
void
nfs_redirty_request
(
struct
nfs_page
*
req
)
{
clear_bit
(
PG_FLUSHING
,
&
req
->
wb_flags
);
__set_page_dirty_nobuffers
(
req
->
wb_page
);
}
/*
* Check if a request is dirty
*/
...
...
@@ -777,7 +785,7 @@ static void nfs_writepage_release(struct nfs_page *req)
#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
if
(
!
PageError
(
req
->
wb_page
))
{
if
(
NFS_NEED_RESCHED
(
req
))
{
nfs_
mark_request_dirty
(
req
);
nfs_
redirty_request
(
req
);
goto
out
;
}
else
if
(
NFS_NEED_COMMIT
(
req
))
{
nfs_mark_request_commit
(
req
);
...
...
@@ -893,7 +901,6 @@ static int nfs_flush_multi(struct inode *inode, struct list_head *head, int how)
atomic_set
(
&
req
->
wb_complete
,
requests
);
ClearPageError
(
page
);
set_page_writeback
(
page
);
offset
=
0
;
nbytes
=
req
->
wb_bytes
;
do
{
...
...
@@ -923,7 +930,7 @@ static int nfs_flush_multi(struct inode *inode, struct list_head *head, int how)
list_del
(
&
data
->
pages
);
nfs_writedata_release
(
data
);
}
nfs_
mark_request_dirty
(
req
);
nfs_
redirty_request
(
req
);
nfs_clear_page_writeback
(
req
);
return
-
ENOMEM
;
}
...
...
@@ -954,7 +961,6 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, int how)
nfs_list_remove_request
(
req
);
nfs_list_add_request
(
req
,
&
data
->
pages
);
ClearPageError
(
req
->
wb_page
);
set_page_writeback
(
req
->
wb_page
);
*
pages
++
=
req
->
wb_page
;
count
+=
req
->
wb_bytes
;
}
...
...
@@ -969,7 +975,7 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, int how)
while
(
!
list_empty
(
head
))
{
struct
nfs_page
*
req
=
nfs_list_entry
(
head
->
next
);
nfs_list_remove_request
(
req
);
nfs_
mark_request_dirty
(
req
);
nfs_
redirty_request
(
req
);
nfs_clear_page_writeback
(
req
);
}
return
-
ENOMEM
;
...
...
@@ -1004,7 +1010,7 @@ static int nfs_flush_list(struct inode *inode, struct list_head *head, int npage
while
(
!
list_empty
(
head
))
{
req
=
nfs_list_entry
(
head
->
next
);
nfs_list_remove_request
(
req
);
nfs_
mark_request_dirty
(
req
);
nfs_
redirty_request
(
req
);
nfs_clear_page_writeback
(
req
);
}
return
error
;
...
...
@@ -1320,7 +1326,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
}
/* We have a mismatch. Write the page again */
dprintk
(
" mismatch
\n
"
);
nfs_
mark_request_dirty
(
req
);
nfs_
redirty_request
(
req
);
next:
nfs_clear_page_writeback
(
req
);
}
...
...
@@ -1451,13 +1457,18 @@ int nfs_wb_all(struct inode *inode)
.
bdi
=
mapping
->
backing_dev_info
,
.
sync_mode
=
WB_SYNC_ALL
,
.
nr_to_write
=
LONG_MAX
,
.
for_writepages
=
1
,
.
range_cyclic
=
1
,
};
int
ret
;
ret
=
generic_writepages
(
mapping
,
&
wbc
);
if
(
ret
<
0
)
goto
out
;
ret
=
nfs_sync_mapping_wait
(
mapping
,
&
wbc
,
0
);
if
(
ret
>=
0
)
return
0
;
out:
return
ret
;
}
...
...
@@ -1469,16 +1480,23 @@ int nfs_sync_mapping_range(struct address_space *mapping, loff_t range_start, lo
.
nr_to_write
=
LONG_MAX
,
.
range_start
=
range_start
,
.
range_end
=
range_end
,
.
for_writepages
=
1
,
};
int
ret
;
if
(
!
(
how
&
FLUSH_NOWRITEPAGE
))
{
ret
=
generic_writepages
(
mapping
,
&
wbc
);
if
(
ret
<
0
)
goto
out
;
}
ret
=
nfs_sync_mapping_wait
(
mapping
,
&
wbc
,
how
);
if
(
ret
>=
0
)
return
0
;
out:
return
ret
;
}
static
int
nfs_wb_page_priority
(
struct
inode
*
inode
,
struct
page
*
page
,
int
how
)
int
nfs_wb_page_priority
(
struct
inode
*
inode
,
struct
page
*
page
,
int
how
)
{
loff_t
range_start
=
page_offset
(
page
);
loff_t
range_end
=
range_start
+
(
loff_t
)(
PAGE_CACHE_SIZE
-
1
);
...
...
include/linux/nfs_fs.h
浏览文件 @
61822ab5
...
...
@@ -438,6 +438,7 @@ extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_contr
extern
int
nfs_sync_mapping_range
(
struct
address_space
*
,
loff_t
,
loff_t
,
int
);
extern
int
nfs_wb_all
(
struct
inode
*
inode
);
extern
int
nfs_wb_page
(
struct
inode
*
inode
,
struct
page
*
page
);
extern
int
nfs_wb_page_priority
(
struct
inode
*
inode
,
struct
page
*
page
,
int
how
);
#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
extern
int
nfs_commit_inode
(
struct
inode
*
,
int
);
extern
struct
nfs_write_data
*
nfs_commit_alloc
(
void
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录