[LU-13846] move iov iter forward by ourself Created: 01/Aug/20  Updated: 28/Sep/20  Resolved: 19/Sep/20

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.14.0

Type: Bug Priority: Major
Reporter: Wang Shilong (Inactive) Assignee: Wang Shilong (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-13835 reuse same cl_dio_aio for one IO Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Newer kernel will reward iov iter back to original
position for direct IO, see following codes:

    
            iov_iter_revert(from, write_len -iov_iter_count(from));--------->here
    out:
            return written;
    }
    EXPORT_SYMBOL(generic_file_direct_write);

This break assumptions from Lustre and caused problem
when Lustre need split one IO to several io loop, considering
4M block IO for 1 MiB stripe file, it will submit first 1MiB IO
4 times and caused data corruptions finally.

Since generic kernel varies from different kernel versions,
we'd better fix this problem by move iov iter forward by
Lustre itself.



 Comments   
Comment by Wang Shilong (Inactive) [ 01/Aug/20 ]

Patch is here:
https://review.whamcloud.com/#/c/39565/2

Comment by Wang Shilong (Inactive) [ 04/Aug/20 ]

A bit deep look when we will have this bug:

The problem existed since kernel v3.16 from following upstream linux commit:

commit 26978b8b4d83c46f4310b253db70fa9e65149e7c
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Mon Mar 10 14:08:45 2014 -0400
    give ->direct_IO() a copy of iov_iter
    
    the thing is, we want to advance what's given to ->direct_IO() as we
    are forming the request; however, the callers care about the amount
    of data actually transferred, not the amount we tried to transfer.
    It's more convenient to allow ->direct_IO() instances do use
    iov_iter_advance() on the copy of iov_iter, leaving the actual
    advancing of the original to caller.
    
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Comment by Gerrit Updater [ 01/Sep/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/39565/
Subject: LU-13846 llite: move iov iter forward by ourself
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 689714eb511d39e225da64d8bfae42a4b2554626

Comment by James A Simmons [ 19/Sep/20 ]

Patch has landed. If more work is needed please reopen

Generated at Sat Feb 10 03:04:43 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.