From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938AbdKVJcX (ORCPT ); Wed, 22 Nov 2017 04:32:23 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:56378 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751273AbdKVJcV (ORCPT ); Wed, 22 Nov 2017 04:32:21 -0500 From: jiangyiwen Subject: [V9fs-developer] [bug report] fs/9p: inode blocks show error in fscache mode To: Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , CC: , , , Eduard Shishkin , "Xulei (Stone)" Message-ID: <5A1543DA.30504@huawei.com> Date: Wed, 22 Nov 2017 17:31:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.16.168] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, I test a scenario that will cause the difference of inode blocks between client and host, the scenario as follows: Precondition: 1) use VirtFS(virtio-9p) to connect guest and host. 2) 9p dir in guest is /mnt/9p, host is /9p-host. 3) server fs is ext4 and block size is 4096. Test steps: 1) on the client(guest) # touch /mnt/9p/test/file # dd if=/dev/zero of=/mnt/9p/test/file bs=1 count=1043456 seek=1302528 conv=notrunc 2) on the client(guest) # stat /mnt/9p/test/file the file's blocks is 4582 blocks(block size is 512) 3) on the server(host) # stat /9p-host/test/file the file's blocks is 2040 blocks(block size is 512) Cause analysis: Because the file is sparse file, so in function v9fs_write_end will update inode blocks according to difference between last_pos and inode_size, only when last_pos is larger than the inode_size, then it update the blocks and inode_size, the operation is not fit the sparse file. Currently I want to call v9fs_invalidate_inode_attr to invalidate inode, but it will influence the performance, so I don't have a good solution. Please advise. Thanks in advance! Best regards, Yiwen