From nobody Sun Apr 5 17:28:06 2026 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (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 356543D566E for ; Tue, 24 Mar 2026 14:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.111 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774361296; cv=none; b=plsH84CnTnaDa5UY8i9mzI7HQ/ang9sQgGmNaZUhe8qoXHywycw/2krYrzbAIjKfRriyCWEguEra8f4n4qzaJotFbTrusiAGz91kvSnU+m0rUVzViP3DM/lKRTKVrPfwUVScUMxwVlKx40/QbKXkUN1Im3T5uTOQzH1i/U+fU6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774361296; c=relaxed/simple; bh=4ZEZ3uBa4NBXVVDQzOXUoWDwKPFVzdvBV3EOOr2ZGdI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lUeJOx1gvnOKJSgsFnRF2UI+5AUsfT11LXdXALz5mDF4YIK6DrEgB3NM88WezJbdik9rOj+wReqpOXYW+XlTXlh9Fth3eCOvh3fYn6dwjHG+b9UN+YdUiWTMRnVdRT62dx/ZmdDulqr8wLqirh0S6h3/GtUV/XMuF/RAMPVPgCU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=VYMAJMqQ; arc=none smtp.client-ip=115.124.30.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="VYMAJMqQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1774361290; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=vpivJBCuzAYnN3HFD1lEir3R4MT75M+1TjEuwNcM5lM=; b=VYMAJMqQfJh3H9378upaaAiB7UEdmJwa4E7CABHHLQcwZNdQhAuSktKC6hktjsuMSlifDLfc20L5xfJfTVM5nbcSXm17Z9Z05ezPedq2+N5zdVzA4DVTKyyowayXGJznArfh9LvrOGYXcIlL4+hh9aDdLowDSNl0zGxTQj4OV4E= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033032089153;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0X.ei8RJ_1774361286; Received: from x31i01179.sqa.na131.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0X.ei8RJ_1774361286 cluster:ay36) by smtp.aliyun-inc.com; Tue, 24 Mar 2026 22:08:10 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: LKML , Gao Xiang , Hongbo Li Subject: [PATCH] erofs: fix .fadvise() for page cache sharing Date: Tue, 24 Mar 2026 22:08:05 +0800 Message-ID: <20260324140805.225088-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- fs/erofs/ishare.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c index 829d50d5c717..57b51d77263d 100644 --- a/fs/erofs/ishare.c +++ b/fs/erofs/ishare.c @@ -201,7 +201,10 @@ struct inode *erofs_real_inode(struct inode *inode, bo= ol *need_iput) int __init erofs_init_ishare(void) { erofs_ishare_mnt =3D kern_mount(&erofs_anon_fs_type); - return PTR_ERR_OR_ZERO(erofs_ishare_mnt); + if (IS_ERR_OR_NULL(erofs_ishare_mnt)) + return PTR_ERR_OR_ZERO(erofs_ishare_mnt); + /* generic_fadvise() doesn't work if s_bdi =3D=3D &noop_backing_dev_info = */ + return super_setup_bdi(erofs_ishare_mnt->mnt_sb); } =20 void erofs_exit_ishare(void) --=20 2.43.5