summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.com>2019-09-11 12:45:17 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2019-09-16 11:38:45 -0400
commitcb8434f16479b6c00540e23d02d6e078ebe69a52 (patch)
treeafd8e048881f19c3628bae84c52f022942d8e296
parent98194030554cd9b10568a9b58f5a135c7e7cba85 (diff)
f2fs: fix inode rwsem regression
This is similar to 942491c9e6d6 ("xfs: fix AIM7 regression") Apparently our current rwsem code doesn't like doing the trylock, then lock for real scheme. So change our read/write methods to just do the trylock for the RWF_NOWAIT case. We don't need a check for IOCB_NOWAIT and !direct-IO because it is checked in generic_write_checks(). Fixes: b91050a80cec ("f2fs: add nowait aio support") Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/file.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index fab6e4cf8f06..aea82f2b9240 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3230,11 +3230,12 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
3230 goto out; 3230 goto out;
3231 } 3231 }
3232 3232
3233 if (!inode_trylock(inode)) { 3233 if (iocb->ki_flags & IOCB_NOWAIT) {
3234 if (iocb->ki_flags & IOCB_NOWAIT) { 3234 if (!inode_trylock(inode)) {
3235 ret = -EAGAIN; 3235 ret = -EAGAIN;
3236 goto out; 3236 goto out;
3237 } 3237 }
3238 } else {
3238 inode_lock(inode); 3239 inode_lock(inode);
3239 } 3240 }
3240 3241