Re: [PATCH] cachefiles: fix __cachefiles_prepare_write() error handling

From: David Howells
Date: Tue Dec 07 2021 - 12:02:28 EST


Arnd Bergmann <arnd@xxxxxxxxxx> wrote:

> pos = cachefiles_inject_remove_error();
> - if (pos == 0)
> - ret = vfs_fallocate(file, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
> - *_start, *_len);
> + if (pos != 0)
> + return 0;
> +
> + ret = vfs_fallocate(file, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
> + *_start, *_len);
> if (ret < 0) {

The right fix is to use "ret" rather than "pos". I've fixed this already on
my fscache-rewrite branch. Hopefully I'll be able to push that over to my
next branch shortly.

David