Re: [PATCH v2 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode

2024-01-22 Thread Jingbo Xu
On 1/23/24 6:32 AM, David Howells wrote: > cachefiles_ondemand_init_object() as called from cachefiles_open_file() and > cachefiles_create_tmpfile() does not check if object->ondemand is set > before dereferencing it, leading to an oops something like: > > RIP:

[PATCH v2 09/10] afs: Remove afs_dynroot_d_revalidate() as it is redundant

2024-01-22 Thread David Howells
Remove afs_dynroot_d_revalidate() as it is redundant as all it does is return 1 and the caller assumes that if the op is not given. Suggested-by: Alexander Viro Signed-off-by: David Howells cc: Marc Dionne cc: linux-...@lists.infradead.org cc: linux-fsde...@vger.kernel.org ---

[PATCH v2 10/10] afs: Fix missing/incorrect unlocking of RCU read lock

2024-01-22 Thread David Howells
In afs_proc_addr_prefs_show(), we need to unlock the RCU read lock in both places before returning (and not lock it again). Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities") Reported-by: kernel test robot Closes:

[PATCH v2 08/10] afs: Fix error handling with lookup via FS.InlineBulkStatus

2024-01-22 Thread David Howells
When afs does a lookup, it tries to use FS.InlineBulkStatus to preemptively look up a bunch of files in the parent directory and cache this locally, on the basis that we might want to look at them too (for example if someone does an ls on a directory, they may want want to then stat every file

[PATCH v2 07/10] afs: Hide silly-rename files from userspace

2024-01-22 Thread David Howells
There appears to be a race between silly-rename files being created/removed and various userspace tools iterating over the contents of a directory, leading to such errors as: find: './kernel/.tmp_cpio_dir/include/dt-bindings/reset/.__afs2080': No such file or directory tar:

[PATCH v2 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode

2024-01-22 Thread David Howells
cachefiles_ondemand_init_object() as called from cachefiles_open_file() and cachefiles_create_tmpfile() does not check if object->ondemand is set before dereferencing it, leading to an oops something like: RIP: 0010:cachefiles_ondemand_init_object+0x9/0x41 ... Call Trace:

[PATCH v2 05/10] netfs: Fix a NULL vs IS_ERR() check in netfs_perform_write()

2024-01-22 Thread David Howells
From: Dan Carpenter The netfs_grab_folio_for_write() function doesn't return NULL, it returns error pointers. Update the check accordingly. Fixes: c38f4e96e605 ("netfs: Provide func to copy data to pagecache for buffered write") Signed-off-by: Dan Carpenter Signed-off-by: David Howells

[PATCH v2 03/10] cifs: Don't use certain unnecessary folio_*() functions

2024-01-22 Thread David Howells
Filesystems should use folio->index and folio->mapping, instead of folio_index(folio), folio_mapping() and folio_file_mapping() since they know that it's in the pagecache. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/smb/client/*.c perl -p -i -e

[PATCH v2 04/10] netfs, fscache: Prevent Oops in fscache_put_cache()

2024-01-22 Thread David Howells
From: Dan Carpenter This function dereferences "cache" and then checks if it's IS_ERR_OR_NULL(). Check first, then dereference. Fixes: 9549332df4ed ("fscache: Implement cache registration") Signed-off-by: Dan Carpenter Signed-off-by: David Howells Link:

[PATCH v2 02/10] afs: Don't use certain unnecessary folio_*() functions

2024-01-22 Thread David Howells
Filesystems should use folio->index and folio->mapping, instead of folio_index(folio), folio_mapping() and folio_file_mapping() since they know that it's in the pagecache. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/afs/*.c perl -p -i -e

[PATCH v2 01/10] netfs: Don't use certain unnecessary folio_*() functions

2024-01-22 Thread David Howells
Filesystems should use folio->index and folio->mapping, instead of folio_index(folio), folio_mapping() and folio_file_mapping() since they know that it's in the pagecache. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/netfs/*.c perl -p -i -e

[PATCH v2 00/10] netfs, afs, cifs, cachefiles, erofs: Miscellaneous fixes

2024-01-22 Thread David Howells
Hi Christian, Here are some miscellaneous fixes for netfslib and a number of filesystems: (1) Replace folio_index() with folio->index in netfs, afs and cifs. (2) Fix an oops in fscache_put_cache(). (3) Fix error handling in netfs_perform_write(). (4) Fix an oops in cachefiles when not

Re: [PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode

2024-01-22 Thread David Howells
Jingbo Xu wrote: > > - ret = cachefiles_ondemand_init_object(object); > > - if (ret < 0) > > - goto err_unuse; > > + if (object->ondemand) { > > + ret = cachefiles_ondemand_init_object(object); > > + if (ret < 0) > > + goto err_unuse; > > +

Re: [PATCH 01/10] netfs: Don't use certain internal folio_*() functions

2024-01-22 Thread David Howells
Jeff Layton wrote: > > Filesystems should not be using folio->index not folio_index(folio) and > > I think you mean "should be" here. Ach. I forgot to update the patch descriptions! David

Re: [PATCH 01/10] netfs: Don't use certain internal folio_*() functions

2024-01-22 Thread Matthew Wilcox
On Mon, Jan 22, 2024 at 10:38:58AM -0500, Jeff Layton wrote: > On Mon, 2024-01-22 at 12:38 +, David Howells wrote: > > Filesystems should not be using folio->index not folio_index(folio) and > > I think you mean "should be" here. Also these are not internal functions! They're just functions

Re: [PATCH 00/10] netfs, afs, cifs, cachefiles, erofs: Miscellaneous fixes

2024-01-22 Thread Jeff Layton
On Mon, 2024-01-22 at 12:38 +, David Howells wrote: > Hi Christian, > > Here are some miscellaneous fixes for netfslib and a number of filesystems: > > (1) Replace folio_index() with folio->index in netfs, afs and cifs. > > (2) Fix an oops in fscache_put_cache(). > > (3) Fix error

Re: [PATCH 01/10] netfs: Don't use certain internal folio_*() functions

2024-01-22 Thread Jeff Layton
On Mon, 2024-01-22 at 12:38 +, David Howells wrote: > Filesystems should not be using folio->index not folio_index(folio) and I think you mean "should be" here. > folio->mapping, not folio_mapping() or folio_file_mapping() in filesystem > code. > > Change this automagically with: > > perl

Re: [PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode

2024-01-22 Thread Gao Xiang
On 2024/1/22 20:38, David Howells wrote: cachefiles_ondemand_init_object() as called from cachefiles_open_file() and cachefiles_create_tmpfile() does not check if object->ondemand is set before dereferencing it, leading to an oops something like: RIP:

Re: [PATCH 00/10] netfs, afs, cifs, cachefiles, erofs: Miscellaneous fixes

2024-01-22 Thread Christian Brauner
On Mon, Jan 22, 2024 at 12:38:33PM +, David Howells wrote: > Hi Christian, > > Here are some miscellaneous fixes for netfslib and a number of filesystems: > > (1) Replace folio_index() with folio->index in netfs, afs and cifs. > > (2) Fix an oops in fscache_put_cache(). > > (3) Fix

Re: [PATCH 0/2] netfs, cachefiles: Update MAINTAINERS records

2024-01-22 Thread Christian Brauner
On Mon, 22 Jan 2024 11:49:59 +, David Howells wrote: > Update the MAINTAINERS records for netfs and cachefiles to reflect a change of > mailing list for both as Red Hat no longer archives the mailing list in a > publicly accessible place. > > Also add Jeff Layton as a reviewer. Yay! > >

Re: [PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode

2024-01-22 Thread Jingbo Xu
On 1/22/24 8:38 PM, David Howells wrote: > cachefiles_ondemand_init_object() as called from cachefiles_open_file() and > cachefiles_create_tmpfile() does not check if object->ondemand is set > before dereferencing it, leading to an oops something like: > > RIP:

[PATCH 10/10] afs: Fix missing/incorrect unlocking of RCU read lock

2024-01-22 Thread David Howells
In afs_proc_addr_prefs_show(), we need to unlock the RCU read lock in both places before returning (and not lock it again). Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities") Reported-by: kernel test robot Closes:

[PATCH 09/10] afs: Remove afs_dynroot_d_revalidate() as it is redundant

2024-01-22 Thread David Howells
Remove afs_dynroot_d_revalidate() as it is redundant as all it does is return 1 and the caller assumes that if the op is not given. Suggested-by: Alexander Viro Signed-off-by: David Howells cc: Marc Dionne cc: linux-...@lists.infradead.org cc: linux-fsde...@vger.kernel.org ---

[PATCH 06/10] cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode

2024-01-22 Thread David Howells
cachefiles_ondemand_init_object() as called from cachefiles_open_file() and cachefiles_create_tmpfile() does not check if object->ondemand is set before dereferencing it, leading to an oops something like: RIP: 0010:cachefiles_ondemand_init_object+0x9/0x41 ... Call Trace:

[PATCH 08/10] afs: Fix error handling with lookup via FS.InlineBulkStatus

2024-01-22 Thread David Howells
When afs does a lookup, it tries to use FS.InlineBulkStatus to preemptively look up a bunch of files in the parent directory and cache this locally, on the basis that we might want to look at them too (for example if someone does an ls on a directory, they may want want to then stat every file

[PATCH 07/10] afs: Hide silly-rename files from userspace

2024-01-22 Thread David Howells
There appears to be a race between silly-rename files being created/removed and various userspace tools iterating over the contents of a directory, leading to such errors as: find: './kernel/.tmp_cpio_dir/include/dt-bindings/reset/.__afs2080': No such file or directory tar:

[PATCH 05/10] netfs: Fix a NULL vs IS_ERR() check in netfs_perform_write()

2024-01-22 Thread David Howells
From: Dan Carpenter The netfs_grab_folio_for_write() function doesn't return NULL, it returns error pointers. Update the check accordingly. Fixes: c38f4e96e605 ("netfs: Provide func to copy data to pagecache for buffered write") Signed-off-by: Dan Carpenter Signed-off-by: David Howells

[PATCH 04/10] netfs, fscache: Prevent Oops in fscache_put_cache()

2024-01-22 Thread David Howells
From: Dan Carpenter This function dereferences "cache" and then checks if it's IS_ERR_OR_NULL(). Check first, then dereference. Fixes: 9549332df4ed ("fscache: Implement cache registration") Signed-off-by: Dan Carpenter Signed-off-by: David Howells Link:

[PATCH 01/10] netfs: Don't use certain internal folio_*() functions

2024-01-22 Thread David Howells
Filesystems should not be using folio->index not folio_index(folio) and folio->mapping, not folio_mapping() or folio_file_mapping() in filesystem code. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/netfs/*.c perl -p -i -e

[PATCH 03/10] cifs: Don't use certain internal folio_*() functions

2024-01-22 Thread David Howells
Filesystems should not be using folio->index not folio_index(folio) and folio->mapping, not folio_mapping() or folio_file_mapping() in filesystem code. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/smb/client/*.c perl -p -i -e

[PATCH 02/10] afs: Don't use certain internal folio_*() functions

2024-01-22 Thread David Howells
Filesystems should not be using folio->index not folio_index(folio) and folio->mapping, not folio_mapping() or folio_file_mapping() in filesystem code. Change this automagically with: perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/afs/*.c perl -p -i -e

[PATCH 00/10] netfs, afs, cifs, cachefiles, erofs: Miscellaneous fixes

2024-01-22 Thread David Howells
Hi Christian, Here are some miscellaneous fixes for netfslib and a number of filesystems: (1) Replace folio_index() with folio->index in netfs, afs and cifs. (2) Fix an oops in fscache_put_cache(). (3) Fix error handling in netfs_perform_write(). (4) Fix an oops in cachefiles when not

[PATCH 2/2] netfs: Add Jeff Layton as reviewer

2024-01-22 Thread David Howells
Add Jeff Layton as a reviewer in the MAINTAINERS file. Signed-off-by: David Howells Acked-by: Jeff Layton cc: ne...@lists.linux.dev cc: linux-fsde...@vger.kernel.org --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index ab5858d24ffc..2f4f4bf2e7f8

[PATCH 1/2] netfs, cachefiles: Change mailing list

2024-01-22 Thread David Howells
The publicly accessible archives for Red Hat mailing lists stop at Oct 2023; messages sent after that time are in internal-only archives. Change the netfs and cachefiles mailing list to one that has publicly accessible archives: ne...@lists.linux.dev Signed-off-by: David Howells cc:

[PATCH 0/2] netfs, cachefiles: Update MAINTAINERS records

2024-01-22 Thread David Howells
/dhowells/linux-fs.git/ tagged as netfs-lib-20240122. Thanks, David David Howells (2): netfs, cachefiles: Change mailing list netfs: Add Jeff Layton as reviewer MAINTAINERS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)

[PATCH v2] erofs: make iov_iter describe target buffer when read from fscache

2024-01-22 Thread Jingbo Xu
So far the fscache mode supports uncompressed data only, and the data read from fscache is put directly into the target page cache. As the support for compressed data in fscache mode is going to be introduced, refactor the interface of reading fscache so that the following compressed part could

Re: [PATCH] erofs: make iov_iter describe target buffer when read from fscache

2024-01-22 Thread Jingbo Xu
Hi, Xiang, On 1/22/24 3:42 PM, Gao Xiang wrote: > Hi Jingbo, > > On 2024/1/22 15:12, Jingbo Xu wrote: >> So far the fscache mode supports uncompressed data only, and the data >> read from fscache is put directly into the target page cache.  As the >> support for compressed data in fscache mode