Skip to content

Commit 64a93db

Browse files
author
Trond Myklebust
committed
NFS: Fix deadlocks in nfs_scan_commit_list()
Partially revert commit 2ce209c ("NFS: Wait for requests that are locked on the commit list"), since it can lead to deadlocks between commit requests and nfs_join_page_group(). For now we should assume that any locked requests on the commit list are either about to be removed and committed by another task, or the writes they describe are about to be retransmitted. In either case, we should not need to worry. Fixes: 2ce209c ("NFS: Wait for requests that are locked on the commit list") Signed-off-by: Trond Myklebust <[email protected]>
1 parent 110cb2d commit 64a93db

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

fs/nfs/write.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,25 +1039,11 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst,
10391039
struct nfs_page *req, *tmp;
10401040
int ret = 0;
10411041

1042-
restart:
10431042
list_for_each_entry_safe(req, tmp, src, wb_list) {
10441043
kref_get(&req->wb_kref);
10451044
if (!nfs_lock_request(req)) {
1046-
int status;
1047-
1048-
/* Prevent deadlock with nfs_lock_and_join_requests */
1049-
if (!list_empty(dst)) {
1050-
nfs_release_request(req);
1051-
continue;
1052-
}
1053-
/* Ensure we make progress to prevent livelock */
1054-
mutex_unlock(&NFS_I(cinfo->inode)->commit_mutex);
1055-
status = nfs_wait_on_request(req);
10561045
nfs_release_request(req);
1057-
mutex_lock(&NFS_I(cinfo->inode)->commit_mutex);
1058-
if (status < 0)
1059-
break;
1060-
goto restart;
1046+
continue;
10611047
}
10621048
nfs_request_remove_commit_list(req, cinfo);
10631049
clear_bit(PG_COMMIT_TO_DS, &req->wb_flags);
@@ -1952,6 +1938,7 @@ static int __nfs_commit_inode(struct inode *inode, int how,
19521938
int may_wait = how & FLUSH_SYNC;
19531939
int ret, nscan;
19541940

1941+
how &= ~FLUSH_SYNC;
19551942
nfs_init_cinfo_from_inode(&cinfo, inode);
19561943
nfs_commit_begin(cinfo.mds);
19571944
for (;;) {

0 commit comments

Comments
 (0)