Commit 4882a9a3 authored by Nathan Scott's avatar Nathan Scott

[XFS] Ensure bytes read statistic is not updated when the generic

routines fail.

SGI Modid: xfs-linux:xfs-kern:178890a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 48a7031e
...@@ -296,11 +296,6 @@ xfs_read( ...@@ -296,11 +296,6 @@ xfs_read(
return -EIO; return -EIO;
} }
/* OK so we are holding the I/O lock for the duration
* of the submission, then what happens if the I/O
* does not really happen here, but is scheduled
* later?
*/
xfs_ilock(ip, XFS_IOLOCK_SHARED); xfs_ilock(ip, XFS_IOLOCK_SHARED);
if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) &&
...@@ -321,6 +316,7 @@ xfs_read( ...@@ -321,6 +316,7 @@ xfs_read(
ret = __generic_file_aio_read(iocb, iovp, segs, offset); ret = __generic_file_aio_read(iocb, iovp, segs, offset);
if (ret == -EIOCBQUEUED) if (ret == -EIOCBQUEUED)
ret = wait_on_sync_kiocb(iocb); ret = wait_on_sync_kiocb(iocb);
xfs_iunlock(ip, XFS_IOLOCK_SHARED); xfs_iunlock(ip, XFS_IOLOCK_SHARED);
if (ret > 0) if (ret > 0)
...@@ -380,12 +376,17 @@ xfs_sendfile( ...@@ -380,12 +376,17 @@ xfs_sendfile(
} }
} }
xfs_rw_enter_trace(XFS_SENDFILE_ENTER, &ip->i_iocore, xfs_rw_enter_trace(XFS_SENDFILE_ENTER, &ip->i_iocore,
(void*)(unsigned long)target, count, *offset, ioflags); (void *)(unsigned long)target, count, *offset, ioflags);
ret = generic_file_sendfile(filp, offset, count, actor, target); ret = generic_file_sendfile(filp, offset, count, actor, target);
xfs_iunlock(ip, XFS_IOLOCK_SHARED); xfs_iunlock(ip, XFS_IOLOCK_SHARED);
if (ret > 0)
XFS_STATS_ADD(xs_read_bytes, ret); XFS_STATS_ADD(xs_read_bytes, ret);
if (likely(!(ioflags & IO_INVIS)))
xfs_ichgtime(ip, XFS_ICHGTIME_ACC); xfs_ichgtime(ip, XFS_ICHGTIME_ACC);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment