[PATCH] erofs: add SEEK_{DATA,HOLE} support

2024-10-10 Thread Gao Xiang
Many userspace programs (including erofs-utils itself) uses SEEK_DATA / SEEK_HOLE to parse hole extents in addition to FIEMAP. Signed-off-by: Gao Xiang --- fs/erofs/data.c | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/fs/erofs/data.c b/fs/erofs/da

Re: [PATCH v2 2/2] erofs: get rid of kaddr in `struct z_erofs_maprecorder`

2024-10-10 Thread Chao Yu via Linux-erofs
On 2024/10/11 7:58, Gao Xiang wrote: `kaddr` becomes useless after switching to metabuf. Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks,

Re: [PATCH 1/2] erofs: get rid of z_erofs_try_to_claim_pcluster()

2024-10-10 Thread Chao Yu via Linux-erofs
On 2024/10/10 17:04, Gao Xiang wrote: Just fold it into the caller for simplicity. Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks,

Re: [PATCH v2] erofs: ensure regular inodes for file-backed mounts

2024-10-10 Thread Chao Yu via Linux-erofs
On 2024/9/17 21:08, Gao Xiang wrote: Only regular inodes are allowed for file-backed mounts, not directories (as seen in the original syzbot case) or special inodes. Also ensure that .read_folio() is implemented on the underlying fs for the primary device. Fixes: fb176750266a ("erofs: add file-

Re: [PATCH 7/8] cachefiles: Fix NULL pointer dereference in object->file

2024-10-10 Thread Zizhi Wo via Linux-erofs
在 2024/10/10 22:52, David Howells 写道: Zizhi Wo wrote: 在 2024/10/10 19:26, David Howells 写道: Zizhi Wo wrote: + spin_lock(&object->lock); if (object->file) { fput(object->file); object->file = NULL; } + spin_unlock(&object->lock)

[PATCH v2 2/2] erofs: get rid of kaddr in `struct z_erofs_maprecorder`

2024-10-10 Thread Gao Xiang
`kaddr` becomes useless after switching to metabuf. Signed-off-by: Gao Xiang --- change since v1: - shouldn't move `m->lcn` downwards since `lcn` has been changed. fs/erofs/zmap.c | 32 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/fs/erofs/zm

[xiang-erofs:dev-test] BUILD SUCCESS 56bd565ea59192bbc7d5bbcea155e861a20393f4

2024-10-10 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test branch HEAD: 56bd565ea59192bbc7d5bbcea155e861a20393f4 erofs: get rid of kaddr in `struct z_erofs_maprecorder` elapsed time: 737m configs tested: 54 configs skipped: 1 The following configs have been built su

Re: [PATCH 7/8] cachefiles: Fix NULL pointer dereference in object->file

2024-10-10 Thread David Howells
Zizhi Wo wrote: > 在 2024/10/10 19:26, David Howells 写道: > > Zizhi Wo wrote: > > > >> + spin_lock(&object->lock); > >>if (object->file) { > >>fput(object->file); > >>object->file = NULL; > >>} > >> + spin_unlock(&object->lock); > > I would suggest stashing the f

Re: [PATCH 1/8] cachefiles: Fix incorrect block calculations in __cachefiles_prepare_write()

2024-10-10 Thread Zizhi Wo via Linux-erofs
在 2024/10/10 19:36, David Howells 写道: Zizhi Wo wrote: For scenarios such as nfs/cifs, the corresponding bsize is PAGE_SIZE aligned cache->bsize is a property of the cache device, not the network filesystems that might be making use of it (and it might be shared between multiple volumes fr

Re: [PATCH 1/8] cachefiles: Fix incorrect block calculations in __cachefiles_prepare_write()

2024-10-10 Thread Zizhi Wo via Linux-erofs
在 2024/10/10 19:36, David Howells 写道: Zizhi Wo wrote: For scenarios such as nfs/cifs, the corresponding bsize is PAGE_SIZE aligned cache->bsize is a property of the cache device, not the network filesystems that might be making use of it (and it might be shared between multiple volumes fr

Re: [PATCH 7/8] cachefiles: Fix NULL pointer dereference in object->file

2024-10-10 Thread Zizhi Wo via Linux-erofs
在 2024/10/10 19:26, David Howells 写道: Zizhi Wo wrote: + spin_lock(&object->lock); if (object->file) { fput(object->file); object->file = NULL; } + spin_unlock(&object->lock); I would suggest stashing the file pointer in a local v

Re: [PATCH] erofs-utils: tests: fix compression algorithms check

2024-10-10 Thread Hongzhen Luo
On 2024/10/10 17:51, Hongzhen Luo wrote: When checking with _require_erofs_compression(), the error "xxx is not a block device" occurs. This patch adds "-o loop" to address this issue. Fixes: ace04f5bbc5c ("erofs-utils: tests: add compression algorithms check for tests") Signed-off-by: Hongzh

Re: [PATCH 6/8] cachefiles: Modify inappropriate error return value in cachefiles_daemon_secctx()

2024-10-10 Thread Zizhi Wo via Linux-erofs
在 2024/10/10 19:31, David Howells 写道: Zizhi Wo wrote: In cachefiles_daemon_secctx(), if it is detected that secctx has been written to the cache, the error code returned is -EINVAL, which is inappropriate and does not distinguish the situation well. I disagree: it is an invalid parameter,

Re: [PATCH 1/8] cachefiles: Fix incorrect block calculations in __cachefiles_prepare_write()

2024-10-10 Thread David Howells
Zizhi Wo wrote: > For scenarios such as nfs/cifs, the corresponding bsize is PAGE_SIZE aligned cache->bsize is a property of the cache device, not the network filesystems that might be making use of it (and it might be shared between multiple volumes from multiple network filesystems, all of whi

Re: [PATCH 6/8] cachefiles: Modify inappropriate error return value in cachefiles_daemon_secctx()

2024-10-10 Thread David Howells
Zizhi Wo wrote: > In cachefiles_daemon_secctx(), if it is detected that secctx has been > written to the cache, the error code returned is -EINVAL, which is > inappropriate and does not distinguish the situation well. I disagree: it is an invalid parameter, not an already extant file, and a mess

Re: [PATCH 3/8] cachefiles: Fix missing pos updates in cachefiles_ondemand_fd_write_iter()

2024-10-10 Thread David Howells
Zizhi Wo wrote: > In the erofs on-demand loading scenario, read and write operations are > usually delivered through "off" and "len" contained in read req in user > mode. Naturally, pwrite is used to specify a specific offset to complete > write operations. > > However, if the write(not pwrite)

Re: [PATCH 7/8] cachefiles: Fix NULL pointer dereference in object->file

2024-10-10 Thread David Howells
Zizhi Wo wrote: > + spin_lock(&object->lock); > if (object->file) { > fput(object->file); > object->file = NULL; > } > + spin_unlock(&object->lock); I would suggest stashing the file pointer in a local var and then doing the fput() outside of the l

Re: [PATCH 8/8] netfs/fscache: Add a memory barrier for FSCACHE_VOLUME_CREATING

2024-10-10 Thread David Howells
Zizhi Wo wrote: > In fscache_create_volume(), there is a missing memory barrier between the > bit-clearing operation and the wake-up operation. This may cause a > situation where, after a wake-up, the bit-clearing operation hasn't been > detected yet, leading to an indefinite wait. The triggering

Re: [PATCH 5/8] cachefiles: Clean up in cachefiles_commit_tmpfile()

2024-10-10 Thread David Howells
Zizhi Wo wrote: > Currently, cachefiles_commit_tmpfile() will only be called if object->flags > is set to CACHEFILES_OBJECT_USING_TMPFILE. Only cachefiles_create_file() > and cachefiles_invalidate_cookie() set this flag. Both of these functions > replace object->file with the new tmpfile, and bot

Re: [PATCH 4/8] cachefiles: Clear invalid cache data in advance

2024-10-10 Thread David Howells
Zizhi Wo wrote: > In the current on-demand loading scenario, when umount is called, the > cachefiles_commit_tmpfile() is invoked. When checking the inode > corresponding to object->file is inconsistent with the dentry, > cachefiles_unlink() is called to perform cleanup to prevent invalid data > f

Re: [PATCH 1/8] cachefiles: Fix incorrect block calculations in __cachefiles_prepare_write()

2024-10-10 Thread Zizhi Wo via Linux-erofs
在 2024/10/10 18:34, David Howells 写道: Zizhi Wo wrote: In the __cachefiles_prepare_write function, DIO aligns blocks using PAGE_SIZE as the unit. And currently cachefiles_add_cache() binds cache->bsize with the requirement that it must not exceed PAGE_SIZE. However, if cache->bsize is smalle

Re: [PATCH 1/8] cachefiles: Fix incorrect block calculations in __cachefiles_prepare_write()

2024-10-10 Thread David Howells
Zizhi Wo wrote: > In the __cachefiles_prepare_write function, DIO aligns blocks using > PAGE_SIZE as the unit. And currently cachefiles_add_cache() binds > cache->bsize with the requirement that it must not exceed PAGE_SIZE. > However, if cache->bsize is smaller than PAGE_SIZE, the calculated blo

[PATCH] erofs-utils: tests: fix compression algorithms check

2024-10-10 Thread Hongzhen Luo
When checking with _require_erofs_compression(), the error "xxx is not a block device" occurs. This patch adds "-o loop" to address this issue. Fixes: ace04f5bbc5c ("erofs-utils: tests: add compression algorithms check for tests") Signed-off-by: Hongzhen Luo --- tests/common/rc | 2 +- 1 file c

Re: [PATCH v2 1/2] fs/super.c: introduce get_tree_bdev_flags()

2024-10-10 Thread Christian Brauner via Linux-erofs
On Wed, 09 Oct 2024 11:31:50 +0800, Gao Xiang wrote: > As Allison reported [1], currently get_tree_bdev() will store > "Can't lookup blockdev" error message. Although it makes sense for > pure bdev-based fses, this message may mislead users who try to use > EROFS file-backed mounts since get_tree_

[PATCH 1/2] erofs: get rid of z_erofs_try_to_claim_pcluster()

2024-10-10 Thread Gao Xiang
Just fold it into the caller for simplicity. Signed-off-by: Gao Xiang --- fs/erofs/zdata.c | 29 + 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 8936790618c6..a569ff9dfd04 100644 --- a/fs/erofs/zdata.c +++ b/f

[PATCH 2/2] erofs: get rid of kaddr in `struct z_erofs_maprecorder`

2024-10-10 Thread Gao Xiang
`kaddr` becomes useless after switching to metabuf. Signed-off-by: Gao Xiang --- fs/erofs/zmap.c | 34 +- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c index e980e29873a5..d329a38de1b9 100644 --- a/fs/erofs/zmap.