From patchwork Mon Jun 1 11:55:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: He YunLei X-Patchwork-Id: 6521231 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B2F6FC0020 for ; Mon, 1 Jun 2015 12:01:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B4892052F for ; Mon, 1 Jun 2015 12:00:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E430620531 for ; Mon, 1 Jun 2015 12:00:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752173AbbFAMAx (ORCPT ); Mon, 1 Jun 2015 08:00:53 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:31454 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464AbbFAMAr (ORCPT ); Mon, 1 Jun 2015 08:00:47 -0400 Received: from 172.24.2.119 (EHLO szxeml426-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id COU27052; Mon, 01 Jun 2015 20:00:42 +0800 (CST) Received: from [127.0.0.1] (10.111.64.133) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.158.1; Mon, 1 Jun 2015 19:55:11 +0800 Message-ID: <556C481C.1050400@huawei.com> Date: Mon, 1 Jun 2015 19:55:08 +0800 From: He YunLei User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: CC: , , Bintian , Subject: [f2fs-dev] Dwrite with non-aligned offset and size X-Originating-IP: [10.111.64.133] X-CFilter-Loop: Reflected Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Jaegeuk, We run ltp testcase with f2fs and obtain a TFAIL in diotest4, the result in detail is as fallow: dio04 <<>> tag=dio04 stime=1432278894 cmdline="diotest4" contacts="" analysis=exit <<>> diotest4 1 TPASS : Negative Offset diotest4 2 TPASS : removed diotest4 3 TFAIL : diotest4.c:129: write allows odd count.returns 1: Success diotest4 4 TFAIL : diotest4.c:183: Odd count of read and write diotest4 5 TPASS : Read beyond the file size ...... the result of ext4 with same environment: dio04 <<>> tag=dio04 stime=1432259643 cmdline="diotest4" contacts="" analysis=exit <<>> diotest4 1 TPASS : Negative Offset diotest4 2 TPASS : removed diotest4 3 TPASS : Odd count of read and write diotest4 4 TPASS : Read beyond the file size ...... Does f2fs allow dwrite with non-aligned offset and size? I check the code and found dwrite with non-aligned offset and size will turn into buffered write. Whether it will have some impact on user layer applications? I wrote a patch, not well tested, how do you think of it? I wish you and other developers in this list could help me in a correct way. Thanks, He --- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 9bedfa8..ba5d94c 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2010,8 +2010,9 @@ static ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, if (f2fs_encrypted_inode(inode) && S_ISREG(inode->i_mode)) return 0; - if (check_direct_IO(inode, iter, offset)) - return 0; + err = check_direct_IO(inode, iter, offset) + if (err) + return -EINVAL; trace_f2fs_direct_IO_enter(inode, offset, count, iov_iter_rw(iter));