[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <750e8251-ba30-4f53-a17b-73c79e3739ce@linux.alibaba.com>
Date: Tue, 2 Jan 2024 22:04:12 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: David Howells <dhowells@...hat.com>
Cc: Matthew Wilcox <willy@...radead.org>,
Marc Dionne <marc.dionne@...istor.com>, Paulo Alcantara <pc@...guebit.com>,
Shyam Prasad N <sprasad@...rosoft.com>, Tom Talpey <tom@...pey.com>,
Dominique Martinet <asmadeus@...ewreck.org>,
Eric Van Hensbergen <ericvh@...nel.org>, Ilya Dryomov <idryomov@...il.com>,
Christian Brauner <christian@...uner.io>, linux-cachefs@...hat.com,
linux-afs@...ts.infradead.org, linux-cifs@...r.kernel.org,
linux-nfs@...r.kernel.org, ceph-devel@...r.kernel.org, v9fs@...ts.linux.dev,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Jeff Layton <jlayton@...nel.org>,
Steve French <smfrench@...il.com>
Subject: Re: [PATCH v5 33/40] netfs, cachefiles: Pass upper bound length to
allow expansion
Hi David,
On 2023/12/21 21:23, David Howells wrote:
> Make netfslib pass the maximum length to the ->prepare_write() op to tell
> the cache how much it can expand the length of a write to. This allows a
> write to the server at the end of a file to be limited to a few bytes
> whilst writing an entire block to the cache (something required by direct
> I/O).
>
> Signed-off-by: David Howells <dhowells@...hat.com>
> Reviewed-by: Jeff Layton <jlayton@...nel.org>
> cc: linux-cachefs@...hat.com
> cc: linux-fsdevel@...r.kernel.org
> cc: linux-mm@...ck.org
> ---
> fs/cachefiles/internal.h | 2 +-
> fs/cachefiles/io.c | 10 ++++++----
> fs/cachefiles/ondemand.c | 2 +-
> fs/netfs/fscache_io.c | 2 +-
> fs/netfs/io.c | 2 +-
> fs/netfs/objects.c | 1 +
> fs/netfs/output.c | 25 ++++++++++---------------
> fs/smb/client/fscache.c | 2 +-
> include/linux/netfs.h | 5 +++--
> 9 files changed, 25 insertions(+), 26 deletions(-)
>
> diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h
> index 2ad58c465208..1af48d576a34 100644
> --- a/fs/cachefiles/internal.h
> +++ b/fs/cachefiles/internal.h
> @@ -233,7 +233,7 @@ extern bool cachefiles_begin_operation(struct netfs_cache_resources *cres,
> enum fscache_want_state want_state);
> extern int __cachefiles_prepare_write(struct cachefiles_object *object,
> struct file *file,
> - loff_t *_start, size_t *_len,
> + loff_t *_start, size_t *_len, size_t upper_len,
> bool no_space_allocated_yet);
> extern int __cachefiles_write(struct cachefiles_object *object,
> struct file *file,
> diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c
> index 009d23cd435b..bffffedce4a9 100644
> --- a/fs/cachefiles/io.c
> +++ b/fs/cachefiles/io.c
> @@ -518,7 +518,7 @@ cachefiles_prepare_ondemand_read(struct netfs_cache_resources *cres,
> */
> int __cachefiles_prepare_write(struct cachefiles_object *object,
> struct file *file,
> - loff_t *_start, size_t *_len,
> + loff_t *_start, size_t *_len, size_t upper_len,
> bool no_space_allocated_yet)
> {
> struct cachefiles_cache *cache = object->volume->cache;
> @@ -530,6 +530,8 @@ int __cachefiles_prepare_write(struct cachefiles_object *object,
> down = start - round_down(start, PAGE_SIZE);
> *_start = start - down;
> *_len = round_up(down + len, PAGE_SIZE);
> + if (down < start || *_len > upper_len)
> + return -ENOBUFS;
Sorry for bothering. We just found some strange when testing
today-next EROFS over fscache.
I'm not sure the meaning of
if (down < start
For example, if start is page-aligned, down == 0.
so as long as start > 0 and page-aligned, it will return
-ENOBUFS. Does it an intended behavior?
Thanks,
Gao Xiang
Powered by blists - more mailing lists