From: Fengnan Chang <changfengnan@vivo.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2] fuse: use newer inode info when writeback cache is enabled
Date: Fri, 25 Jun 2021 11:42:42 +0800 [thread overview]
Message-ID: <7b20f5b0-51d7-7634-a495-f6da83c287e5@vivo.com> (raw)
In-Reply-To: <29a3623f-fb4d-2a2b-af28-26f9ef0b0764@vivo.com>
Hi Miklos:
FYI, I run xfstest on fuse, with linux 5.4.61 + patch, no new failure case.
On 2021/6/24 15:42, Fengnan Chang wrote:
> Hi Miklos:
>
> Thank you for the information, I have been able to reproduce the problem.
>
> The new version of the patch as below. Previous fsx test is pass now.
> Need do more test, Can you help to test new patch? or send me your test
> case, I will test this.
>
> Here is my test case, and is the problem this patch is trying to solve.
> Case A:
> mkdir /tmp/test
> passthrough_ll -ocache=always,writeback /mnt/test/
> echo "11111" > /tmp/test/fsx
> ls -l /mnt/test/tmp/test/
> echo "2222" >> /tmp/test/fsx
> ls -l /mnt/test/tmp/test/
>
> Case B:
> mkdir /tmp/test
> passthrough_ll -ocache=always,writeback /mnt/test/
> passthrough_ll -ocache=always,writeback /mnt/test2/
> echo "11111" > /tmp/test/fsx
> ls -l /mnt/test/tmp/test/
> ls -l /mnt/test2/tmp/test/
> echo "222" >> /mnt/test/tmp/test/fsx
> ls -l /mnt/test/tmp/test/
> ls -l /mnt/test2/tmp/test/
>
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index b9beb39a4a18..8e22a31b55c4 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -60,6 +60,10 @@ MODULE_PARM_DESC(max_user_congthresh,
> /** Congestion starts at 75% of maximum */
> #define FUSE_DEFAULT_CONGESTION_THRESHOLD (FUSE_DEFAULT_MAX_BACKGROUND
> * 3 / 4)
>
> +static inline bool attr_newer_than_local(struct fuse_attr *attr, struct
> inode *inode) {
> + return (attr->mtime > inode->i_mtime.tv_sec)
> + || ((attr->mtime == inode->i_mtime.tv_sec) &&
> (attr->mtimensec > inode->i_mtime.tv_nsec));
> +}
> #ifdef CONFIG_BLOCK
> static struct file_system_type fuseblk_fs_type;
> #endif
> @@ -241,8 +245,10 @@ void fuse_change_attributes(struct inode *inode,
> struct fuse_attr *attr,
> * extend local i_size without keeping userspace server in
> sync. So,
> * attr->size coming from server can be stale. We cannot trust it.
> */
> - if (!is_wb || !S_ISREG(inode->i_mode))
> + if (!is_wb || !S_ISREG(inode->i_mode)
> + || (attr_newer_than_local(attr, inode) &&
> !inode_is_open_for_write(inode))) {
> i_size_write(inode, attr->size);
> + }
> spin_unlock(&fi->lock);
>
> if (!is_wb && S_ISREG(inode->i_mode)) {
>
> On 2021/6/22 23:19, Miklos Szeredi wrote:
>> On Tue, 22 Jun 2021 at 14:25, Fengnan Chang <changfengnan@vivo.com>
>> wrote:
>>>
>>> Unh, it seems i_writecount not work.
>>> If we modify file through lowerfs, i_writecount won't change, but the
>>> size already changed.
>>> For example:
>>> echo "111" > /lowerfs/test
>>> ls -l /upper/test
>>> echo "2222" >> /lowerfs/test
>>> ls -l /upper/test
>>>
>>> So, can you describe your test enviroment? including kernel version and
>>> fsx parameters, I will check it.
>>
>> linux-5.13-rc5 + patch
>> mkdir /tmp/test
>> libfuse/example/passthrough_ll -ocache=always,writeback /mnt/fuse/
>> fsx-linux -N 1000000 /mnt/fuse/tmp/test/fsx
>>
>> Thanks,
>> Miklos
>>
next prev parent reply other threads:[~2021-06-25 3:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-30 8:50 [PATCH v2] fuse: use newer inode info when writeback cache is enabled Fengnan Chang
2021-05-07 10:04 ` Fengnan Chang
2021-06-22 7:59 ` Miklos Szeredi
2021-06-22 12:25 ` Fengnan Chang
2021-06-22 15:19 ` Miklos Szeredi
2021-06-24 7:42 ` Fengnan Chang
2021-06-25 3:42 ` Fengnan Chang [this message]
2021-08-06 12:20 ` Miklos Szeredi
2021-08-10 1:41 ` Fengnan Chang
2021-08-16 2:48 ` Peng Tao
2021-05-07 10:09 changfengnan
2021-05-11 11:21 ` 答复: " changfengnan
2021-05-12 12:33 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7b20f5b0-51d7-7634-a495-f6da83c287e5@vivo.com \
--to=changfengnan@vivo.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).