From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (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 5B15217BED0 for ; Tue, 18 Aug 2026 11:37:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787053047; cv=none; b=tgHmqPc40kJEAoLc45lvx6eRqB4fJznKFpONZL54Dl+rdZnR2NVDqxMXrizjILyFn5vtclFaxTjvYrbndN7Cnqnzw5xP+H1pLt5+zCcKHHfdamkIaJjfAsw+G6Kh6PM/UE4GLChawqgUi+EhzIQJ7b2nDZHIyvnHhn0bzTZXeBY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787053047; c=relaxed/simple; bh=NgrBCeZNqJe0meh1l/hK7CVI57+sN/63lJAUfg3NLAo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=pgTILZ0z27yTU4nIh3+zpoMjXeKY6HVJSB7tx+DUBLwvJe9wgpPcJXJv6FGxvKAOGwOPsLMiKuZ9wleIAmfoDgXxx0IDKRoAdgC/zCKX6oZFr3/BZ59YPErPdTS0ORacGGCU2nIdXxdnIEiD417uyCt18k19tXAZ7pXM+j/cfHE= 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=GERcRBms; arc=none smtp.client-ip=115.124.30.101 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="GERcRBms" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1787053034; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=CFrZbe/zoAbWSEEae8g2rMxIifB/6Ye1yePxe9JFFRU=; b=GERcRBmsoMuJL8wyNCIx84MPWgU9JYv+JbX3Mgq3wr9gLExxTb4Wg+ZSGwWUywX4jON+AekWFlxS3hgMEefXybEQzBuRF6S5K6BbviJHTfjB+xVjIIRZ/hTUZQFf6tv37rVBkF+O/B3cfK4Zw7bSVG6oGckx2iIGdNXpXRNjTNQ= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0X9DNCHB_1787053033; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0X9DNCHB_1787053033 cluster:ay36) by smtp.aliyun-inc.com; Tue, 18 Aug 2026 19:37:13 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] erofs: support SEEK_HOLE/SEEK_DATA in inode_share mode Date: Tue, 18 Aug 2026 19:37:13 +0800 Message-Id: <20260818113713.116849-1-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When inode_share is enabled, erofs_ishare_fops.llseek falls back to generic_file_llseek, which treats the whole file as data and always returns i_size for SEEK_HOLE, hiding real holes in sparse files. Switch it to erofs_file_llseek instead. For user files f_mapping->host is always the real erofs inode, so SEEK_HOLE/SEEK_DATA resolve the per-file on-disk layout via iomap_seek_hole()/iomap_seek_data(). Reported-by: Yuanhe Shu Signed-off-by: Jingbo Xu --- fs/erofs/data.c | 2 +- fs/erofs/internal.h | 2 ++ fs/erofs/ishare.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index d2f01245ee79..09d668deb86d 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -509,7 +509,7 @@ static int erofs_file_mmap_prepare(struct vm_area_desc *desc) #define erofs_file_mmap_prepare generic_file_readonly_mmap_prepare #endif -static loff_t erofs_file_llseek(struct file *file, loff_t offset, int whence) +loff_t erofs_file_llseek(struct file *file, loff_t offset, int whence) { struct inode *inode = file->f_mapping->host; const struct iomap_ops *ops = &erofs_iomap_ops; diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 57bd21859c65..3263c11d714c 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -528,6 +528,8 @@ static inline struct inode *erofs_real_inode(struct inode *inode, bool *need_ipu } #endif +loff_t erofs_file_llseek(struct file *file, loff_t offset, int whence); + long erofs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); long erofs_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); diff --git a/fs/erofs/ishare.c b/fs/erofs/ishare.c index fa7d4112dec5..4c7be60565cb 100644 --- a/fs/erofs/ishare.c +++ b/fs/erofs/ishare.c @@ -156,7 +156,7 @@ static int erofs_ishare_fadvise(struct file *file, loff_t offset, const struct file_operations erofs_ishare_fops = { .open = erofs_ishare_file_open, - .llseek = generic_file_llseek, + .llseek = erofs_file_llseek, .read_iter = erofs_ishare_file_read_iter, .mmap = erofs_ishare_mmap, .release = erofs_ishare_file_release, -- 2.19.1.6.gb485710b