mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongbo Li <lihongbo22@huawei.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>, <linux-erofs@lists.ozlabs.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] erofs: fix .fadvise() for page cache sharing
Date: Wed, 25 Mar 2026 09:01:11 +0800	[thread overview]
Message-ID: <31af2fe2-76f8-47b4-a18d-64b487847ba5@huawei.com> (raw)
In-Reply-To: <20260324155407.371642-1-hsiangkao@linux.alibaba.com>



On 2026/3/24 23:54, Gao Xiang wrote:
> Currently, .fadvise() doesn't work well if page cache sharing is on
> since shared inodes belong to a pseudo fs generated with init_pseudo(),
> and sb->s_bdi is the default one &noop_backing_dev_info.
> 
> Then, generic_fadvise() will just behave as a no-op if sb->s_bdi is
> &noop_backing_dev_info, but as the bdev fs (the bdev fs changes
> inode_to_bdi() instead), it's actually NOT a pure memfs.
> 
> Let's generate a real bdi for erofs_ishare_mnt instead.
> 
> Fixes: d86d7817c042 ("erofs: implement .fadvise for page cache share")
> Cc: Hongbo Li <lihongbo22@huawei.com>
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> v2:
>   - handle super_setup_bdi() failure properly.
> 
>   fs/erofs/ishare.c | 15 +++++++++++++--
>   1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c
> index 829d50d5c717..ec433bacc592 100644
> --- a/fs/erofs/ishare.c
> +++ b/fs/erofs/ishare.c
> @@ -200,8 +200,19 @@ struct inode *erofs_real_inode(struct inode *inode, bool *need_iput)
>   
>   int __init erofs_init_ishare(void)
>   {
> -	erofs_ishare_mnt = kern_mount(&erofs_anon_fs_type);
> -	return PTR_ERR_OR_ZERO(erofs_ishare_mnt);
> +	struct vfsmount *mnt;
> +	int ret;
> +
> +	mnt = kern_mount(&erofs_anon_fs_type);
> +	if (IS_ERR(mnt))
> +		return PTR_ERR(mnt);
> +	/* generic_fadvise() doesn't work if s_bdi == &noop_backing_dev_info */
> +	ret = super_setup_bdi(mnt->mnt_sb);
> +	if (ret)
> +		kern_unmount(mnt);
> +	else
> +		erofs_ishare_mnt = mnt;
> +	return ret;
>   }

ok, looks good.

Reviewed-by: Hongbo Li <lihongbo22@huawei.com>

Thanks,
Hongbo

>   
>   void erofs_exit_ishare(void)

      reply	other threads:[~2026-03-25  1:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 15:54 Gao Xiang
2026-03-25  1:01 ` Hongbo Li [this message]

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=31af2fe2-76f8-47b4-a18d-64b487847ba5@huawei.com \
    --to=lihongbo22@huawei.com \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®