Reverting commit d03727b248d0 "NFSv4 fix CLOSE not waiting for direct IO compeletion". This patch made it so that fput() by calling inode_dio_done() in nfs_file_release() would wait uninterruptably for any outstanding directIO to the file (but that wait on IO should be killable). The problem the patch was also trying to address was REMOVE returning ERR_ACCESS because the file is still opened, is supposed to be resolved by server returning ERR_FILE_OPEN and not ERR_ACCESS.
Unified · Split
| @@ -267,6 +267,8 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) · 266 unmodified lines | |||
| 267 | { | 267 | { |
| 268 | struct inode *inode = dreq->inode; | 268 | struct inode *inode = dreq->inode; |
| 269 | 269 | ||
| 270 | inode_dio_end(inode); | ||
| 271 | |||
| 270 | if (dreq->iocb) { | 272 | if (dreq->iocb) { |
| 271 | long res = (long) dreq->error; | 273 | long res = (long) dreq->error; |
| 272 | if (dreq->count != 0) { | 274 | if (dreq->count != 0) { |
| @@ -278,10 +280,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) · 5 unmodified lines | |||
| 278 | 280 | ||
| 279 | complete(&dreq->completion); | 281 | complete(&dreq->completion); |
| 280 | 282 | ||
| 281 | igrab(inode); | ||
| 282 | nfs_direct_req_release(dreq); | 283 | nfs_direct_req_release(dreq); |
| 283 | inode_dio_end(inode); | ||
| 284 | iput(inode); | ||
| 285 | } | 284 | } |
| 286 | 285 | ||
| 287 | static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) | 286 | static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) |
| @@ -411,10 +410,8 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, · 123 unmodified lines | |||
| 411 | * generic layer handle the completion. | 410 | * generic layer handle the completion. |
| 412 | */ | 411 | */ |
| 413 | if (requested_bytes == 0) { | 412 | if (requested_bytes == 0) { |
| 414 | igrab(inode); | ||
| 415 | nfs_direct_req_release(dreq); | ||
| 416 | inode_dio_end(inode); | 413 | inode_dio_end(inode); |
| 417 | iput(inode); | 414 | nfs_direct_req_release(dreq); |
| 418 | return result < 0 ? result : -EIO; | 415 | return result < 0 ? result : -EIO; |
| 419 | } | 416 | } |
| 420 | 417 | ||
| @@ -867,10 +864,8 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, · 446 unmodified lines | |||
| 867 | * generic layer handle the completion. | 864 | * generic layer handle the completion. |
| 868 | */ | 865 | */ |
| 869 | if (requested_bytes == 0) { | 866 | if (requested_bytes == 0) { |
| 870 | igrab(inode); | ||
| 871 | nfs_direct_req_release(dreq); | ||
| 872 | inode_dio_end(inode); | 867 | inode_dio_end(inode); |
| 873 | iput(inode); | 868 | nfs_direct_req_release(dreq); |
| 874 | return result < 0 ? result : -EIO; | 869 | return result < 0 ? result : -EIO; |
| 875 | } | 870 | } |
| 876 | 871 | ||
| @@ -83,7 +83,6 @@ nfs_file_release(struct inode *inode, struct file *filp) · 82 unmodified lines | |||
| 83 | dprintk("NFS: release(%pD2)\n", filp); | 83 | dprintk("NFS: release(%pD2)\n", filp); |
| 84 | 84 | ||
| 85 | nfs_inc_stats(inode, NFSIOS_VFSRELEASE); | 85 | nfs_inc_stats(inode, NFSIOS_VFSRELEASE); |
| 86 | inode_dio_wait(inode); | ||
| 87 | nfs_file_clear_open_context(filp); | 86 | nfs_file_clear_open_context(filp); |
| 88 | return 0; | 87 | return 0; |
| 89 | } | 88 | } |