Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2135736ybi; Thu, 4 Jul 2019 05:47:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGRQYi8jKoW6BXuATgEEX4eGMfgHcY9kotjrBnq+NpTQZFp3+uLVRzchrrgUithjQUe138 X-Received: by 2002:a17:90a:346c:: with SMTP id o99mr19213896pjb.20.1562244427501; Thu, 04 Jul 2019 05:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562244427; cv=none; d=google.com; s=arc-20160816; b=DqjB5fVHM8kS8Yfk4blSN3Hbh3ix/x6Ja6NwHTuAROPIJ2ehcNFIkerePjAsjpLh/F 7yZH6ieoaYijldtsVBxf0kgXKDipI6KWSvqKSU5GLAwSnE8OE1OIPQJJ3jOsNf6I7h9k 4r0guyYllXRweB/jWimEMVPNxZhxUV3svn9UYj2f22P3YW0eey/0ObQniS0OfqCIxguB 4o+Dw/OJWQCJZzQJSZi/yvibOPHuPEAsVIxckoZDxnRFCvAJgPSzB6C99koXXdwxE1fR q1i1Rupu6tmB+M1VGcAo9xWF1gLsY7eRDFouWfMNG2sfceYXmSbeUW54MFLS5LVfzlqL 0HoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=/8JeWyNEkkzfakm4stggoothBJzZ6WIPxxLxsNPzd94=; b=wNdbMonfHF0Ef9nNGDQLKrlx5NjTUiWC8csJimARSIEPuLj67fza0wdqbV3yacK0lQ lTRX4aYMiP2pmg8uYmZweCFUvZXQhiQmKj2gzeuBI/hiPfqOzm6NJoX3u3f48LUCEOuR IxP3G6Mxjqa15QsH4JFjg6q7QjmAfKmZAHiYlLRf0V/0lhciW7FbT++F2Fvc2WbLr7bu YWPukapaC0HV0MgUFodJYkCiiy8fU8BveI+26hi+35wViBqpbcBiU1MHfrwkfT5hmD/3 Ac4EmVaRvPxyoLTjt0R5OWG+FMQIPXAsmS3FjFLcZtmSW4IIs1gm8kHSSuhAoojUdvy6 aWtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si814873pge.429.2019.07.04.05.46.42; Thu, 04 Jul 2019 05:47:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725865AbfGDMpD (ORCPT + 99 others); Thu, 4 Jul 2019 08:45:03 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59508 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726791AbfGDMpD (ORCPT ); Thu, 4 Jul 2019 08:45:03 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4B7BCC2F52A1F1CB3ADC; Thu, 4 Jul 2019 20:45:00 +0800 (CST) Received: from RH5885H-V3.huawei.com (10.90.53.225) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Thu, 4 Jul 2019 20:44:50 +0800 From: yangerkun To: , CC: , , , , Subject: [PATCH] ext4: fix warning when turn on dioread_nolock and inline_data Date: Thu, 4 Jul 2019 20:50:32 +0800 Message-ID: <1562244632-134963-1-git-send-email-yangerkun@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.90.53.225] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org mkfs.ext4 -O inline_data /dev/vdb mount -o dioread_nolock /dev/vdb /mnt echo "some inline data..." >> /mnt/test-file echo "some inline data..." >> /mnt/test-file sync With upon script, system will trigger "WARN_ON(!io_end->handle && sbi->s_journal)" since the wrong order between rsv_blocks calculate and destroy inline data for dealloc. Signed-off-by: yangerkun --- fs/ext4/inode.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index c7f77c6..3f2a366 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2769,15 +2769,6 @@ static int ext4_writepages(struct address_space *mapping, goto out_writepages; } - if (ext4_should_dioread_nolock(inode)) { - /* - * We may need to convert up to one extent per block in - * the page and we may dirty the inode. - */ - rsv_blocks = 1 + ext4_chunk_trans_blocks(inode, - PAGE_SIZE >> inode->i_blkbits); - } - /* * If we have inline data and arrive here, it means that * we will soon create the block for the 1st page, so @@ -2796,6 +2787,15 @@ static int ext4_writepages(struct address_space *mapping, ext4_journal_stop(handle); } + if (ext4_should_dioread_nolock(inode)) { + /* + * We may need to convert up to one extent per block in + * the page and we may dirty the inode. + */ + rsv_blocks = 1 + ext4_chunk_trans_blocks(inode, + PAGE_SIZE >> inode->i_blkbits); + } + if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX) range_whole = 1; -- 2.7.4