diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-24 16:17:12 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-24 16:17:12 (GMT) |
commit | d333fc8d3006296f2893d17817bc0f67cf87f353 (patch) | |
tree | f759092ae962b0071e805e4526ffff57995d487b /fs/nfs/pagelist.c | |
parent | 1a93fa86bf6eb0d8bed84ef18c8b35be389edee5 (diff) | |
parent | d4a8f3677fe2c2fc86443254fe42825e244c194d (diff) | |
download | linux-d333fc8d3006296f2893d17817bc0f67cf87f353.tar.xz |
Merge branch 'fixes' of git://git.linux-nfs.org/pub/linux/nfs-2.6
* 'fixes' of git://git.linux-nfs.org/pub/linux/nfs-2.6:
NFS: Fix nfs_direct_dirty_pages()
NFS: Fix handful of compiler warnings in direct.c
NFS: Avoid a deadlock situation on write
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r-- | fs/nfs/pagelist.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index cbdd1c6..c5bb51a 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -355,6 +355,26 @@ void nfs_pageio_complete(struct nfs_pageio_descriptor *desc) nfs_pageio_doio(desc); } +/** + * nfs_pageio_cond_complete - Conditional I/O completion + * @desc: pointer to io descriptor + * @index: page index + * + * It is important to ensure that processes don't try to take locks + * on non-contiguous ranges of pages as that might deadlock. This + * function should be called before attempting to wait on a locked + * nfs_page. It will complete the I/O if the page index 'index' + * is not contiguous with the existing list of pages in 'desc'. + */ +void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index) +{ + if (!list_empty(&desc->pg_list)) { + struct nfs_page *prev = nfs_list_entry(desc->pg_list.prev); + if (index != prev->wb_index + 1) + nfs_pageio_doio(desc); + } +} + #define NFS_SCAN_MAXENTRIES 16 /** * nfs_scan_list - Scan a list for matching requests |