diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-26 02:45:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-26 02:45:40 -0400 |
commit | 4ed590271a65b0fbe3eb1cf828ad5af16603c8ce (patch) | |
tree | f08c34529025fd00229e3c8db8f386442017544d | |
parent | 035bcf88d52d922a36931aaaafe4f82bbfa91f14 (diff) | |
parent | 942491c9e6d631c012f3c4ea8e7777b0b02edeab (diff) |
Merge tag 'xfs-4.14-fixes-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs fix from Darrick Wong:
"Here's (hopefully) the last bugfix for 4.14:
- Rework nowait locking code to reduce locking overhead penalty"
* tag 'xfs-4.14-fixes-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
xfs: fix AIM7 regression
-rw-r--r-- | fs/xfs/xfs_file.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 56d0e526870c..6526ef0e2a23 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -237,11 +237,13 @@ xfs_file_dax_read( | |||
237 | if (!count) | 237 | if (!count) |
238 | return 0; /* skip atime */ | 238 | return 0; /* skip atime */ |
239 | 239 | ||
240 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) { | 240 | if (iocb->ki_flags & IOCB_NOWAIT) { |
241 | if (iocb->ki_flags & IOCB_NOWAIT) | 241 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) |
242 | return -EAGAIN; | 242 | return -EAGAIN; |
243 | } else { | ||
243 | xfs_ilock(ip, XFS_IOLOCK_SHARED); | 244 | xfs_ilock(ip, XFS_IOLOCK_SHARED); |
244 | } | 245 | } |
246 | |||
245 | ret = dax_iomap_rw(iocb, to, &xfs_iomap_ops); | 247 | ret = dax_iomap_rw(iocb, to, &xfs_iomap_ops); |
246 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | 248 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); |
247 | 249 | ||
@@ -259,9 +261,10 @@ xfs_file_buffered_aio_read( | |||
259 | 261 | ||
260 | trace_xfs_file_buffered_read(ip, iov_iter_count(to), iocb->ki_pos); | 262 | trace_xfs_file_buffered_read(ip, iov_iter_count(to), iocb->ki_pos); |
261 | 263 | ||
262 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) { | 264 | if (iocb->ki_flags & IOCB_NOWAIT) { |
263 | if (iocb->ki_flags & IOCB_NOWAIT) | 265 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) |
264 | return -EAGAIN; | 266 | return -EAGAIN; |
267 | } else { | ||
265 | xfs_ilock(ip, XFS_IOLOCK_SHARED); | 268 | xfs_ilock(ip, XFS_IOLOCK_SHARED); |
266 | } | 269 | } |
267 | ret = generic_file_read_iter(iocb, to); | 270 | ret = generic_file_read_iter(iocb, to); |
@@ -552,9 +555,10 @@ xfs_file_dio_aio_write( | |||
552 | iolock = XFS_IOLOCK_SHARED; | 555 | iolock = XFS_IOLOCK_SHARED; |
553 | } | 556 | } |
554 | 557 | ||
555 | if (!xfs_ilock_nowait(ip, iolock)) { | 558 | if (iocb->ki_flags & IOCB_NOWAIT) { |
556 | if (iocb->ki_flags & IOCB_NOWAIT) | 559 | if (!xfs_ilock_nowait(ip, iolock)) |
557 | return -EAGAIN; | 560 | return -EAGAIN; |
561 | } else { | ||
558 | xfs_ilock(ip, iolock); | 562 | xfs_ilock(ip, iolock); |
559 | } | 563 | } |
560 | 564 | ||
@@ -606,9 +610,10 @@ xfs_file_dax_write( | |||
606 | size_t count; | 610 | size_t count; |
607 | loff_t pos; | 611 | loff_t pos; |
608 | 612 | ||
609 | if (!xfs_ilock_nowait(ip, iolock)) { | 613 | if (iocb->ki_flags & IOCB_NOWAIT) { |
610 | if (iocb->ki_flags & IOCB_NOWAIT) | 614 | if (!xfs_ilock_nowait(ip, iolock)) |
611 | return -EAGAIN; | 615 | return -EAGAIN; |
616 | } else { | ||
612 | xfs_ilock(ip, iolock); | 617 | xfs_ilock(ip, iolock); |
613 | } | 618 | } |
614 | 619 | ||