]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
edc532829ba4df578b5ca62f6643a3e55d916ce8
[thirdparty/kernel/stable-queue.git] /
1 From 65caafd0d2145d1dd02072c4ced540624daeab40 Mon Sep 17 00:00:00 2001
2 From: Olga Kornievskaia <kolga@netapp.com>
3 Date: Wed, 15 Jul 2020 13:04:15 -0400
4 Subject: SUNRPC reverting d03727b248d0 ("NFSv4 fix CLOSE not waiting for direct IO compeletion")
5
6 From: Olga Kornievskaia <kolga@netapp.com>
7
8 commit 65caafd0d2145d1dd02072c4ced540624daeab40 upstream.
9
10 Reverting commit d03727b248d0 "NFSv4 fix CLOSE not waiting for
11 direct IO compeletion". This patch made it so that fput() by calling
12 inode_dio_done() in nfs_file_release() would wait uninterruptably
13 for any outstanding directIO to the file (but that wait on IO should
14 be killable).
15
16 The problem the patch was also trying to address was REMOVE returning
17 ERR_ACCESS because the file is still opened, is supposed to be resolved
18 by server returning ERR_FILE_OPEN and not ERR_ACCESS.
19
20 Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
21 Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23
24 ---
25 fs/nfs/direct.c | 13 ++++---------
26 fs/nfs/file.c | 1 -
27 2 files changed, 4 insertions(+), 10 deletions(-)
28
29 --- a/fs/nfs/direct.c
30 +++ b/fs/nfs/direct.c
31 @@ -396,6 +396,8 @@ static void nfs_direct_complete(struct n
32 {
33 struct inode *inode = dreq->inode;
34
35 + inode_dio_end(inode);
36 +
37 if (dreq->iocb) {
38 long res = (long) dreq->error;
39 if (dreq->count != 0) {
40 @@ -407,10 +409,7 @@ static void nfs_direct_complete(struct n
41
42 complete(&dreq->completion);
43
44 - igrab(inode);
45 nfs_direct_req_release(dreq);
46 - inode_dio_end(inode);
47 - iput(inode);
48 }
49
50 static void nfs_direct_read_completion(struct nfs_pgio_header *hdr)
51 @@ -540,10 +539,8 @@ static ssize_t nfs_direct_read_schedule_
52 * generic layer handle the completion.
53 */
54 if (requested_bytes == 0) {
55 - igrab(inode);
56 - nfs_direct_req_release(dreq);
57 inode_dio_end(inode);
58 - iput(inode);
59 + nfs_direct_req_release(dreq);
60 return result < 0 ? result : -EIO;
61 }
62
63 @@ -960,10 +957,8 @@ static ssize_t nfs_direct_write_schedule
64 * generic layer handle the completion.
65 */
66 if (requested_bytes == 0) {
67 - igrab(inode);
68 - nfs_direct_req_release(dreq);
69 inode_dio_end(inode);
70 - iput(inode);
71 + nfs_direct_req_release(dreq);
72 return result < 0 ? result : -EIO;
73 }
74
75 --- a/fs/nfs/file.c
76 +++ b/fs/nfs/file.c
77 @@ -82,7 +82,6 @@ nfs_file_release(struct inode *inode, st
78 dprintk("NFS: release(%pD2)\n", filp);
79
80 nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
81 - inode_dio_wait(inode);
82 nfs_file_clear_open_context(filp);
83 return 0;
84 }