From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF6AB1AA1F4 for ; Wed, 25 Mar 2026 01:01:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.219 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774400479; cv=none; b=EWGl9U+gy8ElJJWGAwJ7ajO0QTxxfTIZyETQVgrMUpnmqehC49hGT3MPWpqPVq2O0kv6qIXCJbr9FkuN6r/CwXd/wihg9xpMn7WOG8aOG3AzZ2PRnrM3ojfLxpl2MN4n8Vj0ULezyVeV/7jumd7C2W5yFe20w2ywn+nqXmfsqdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774400479; c=relaxed/simple; bh=6+bQId7H9x6tMBJQW61jWn/bdVnQ4W/QCsjVNq8M+tU=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=QBojQKofF6C3wbBscWMLr3SJSBN8teToOCWbF6/y00PSLpV4XjgT+YnRGct/dbTUeI3fqfLzYrzTPHfZmzFHM+Oc/GqtDHwFJVwRmieMEhQMV/mCTcTUw0Q26m8gCcHhwBcPXbzWDqZJEhBTVdSJHgrqNmLHDVIcqcd7NFNZMBI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=ELzxRQRX; arc=none smtp.client-ip=113.46.200.219 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="ELzxRQRX" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=lCVVCb6bvjigpk0YgQbcxBqpg/Dxtj+wiLOaZEtNyh4=; b=ELzxRQRXSMLIjuAM5Xp23+lewOig+Oza1sqzTH0Akl2nuxGQ2/UJXgMnfdcvMLpp4oWmSn+zE Wlbxk8JC9U/voBSs2Sx+ezm9Vq8YW3/NINmNBUoYHXGuy01DYPyv3hID7svX2I+Y8IQyrCpkObN a3wxuer7gRyj2P16AYQ+VUc= Received: from mail.maildlp.com (unknown [172.19.163.0]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4fgT2w700vz1prmY; Wed, 25 Mar 2026 08:55:04 +0800 (CST) Received: from kwepemr500015.china.huawei.com (unknown [7.202.195.162]) by mail.maildlp.com (Postfix) with ESMTPS id 239CE40561; Wed, 25 Mar 2026 09:01:13 +0800 (CST) Received: from [10.67.111.104] (10.67.111.104) by kwepemr500015.china.huawei.com (7.202.195.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 25 Mar 2026 09:01:12 +0800 Message-ID: <31af2fe2-76f8-47b4-a18d-64b487847ba5@huawei.com> Date: Wed, 25 Mar 2026 09:01:11 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] erofs: fix .fadvise() for page cache sharing To: Gao Xiang , CC: LKML References: <20260324155407.371642-1-hsiangkao@linux.alibaba.com> Content-Language: en-US From: Hongbo Li In-Reply-To: <20260324155407.371642-1-hsiangkao@linux.alibaba.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemr500015.china.huawei.com (7.202.195.162) 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 > Signed-off-by: Gao Xiang > --- > 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 Thanks, Hongbo > > void erofs_exit_ishare(void)