public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: asmadeus@codewreck.org
To: Eric Van Hensbergen <ericvh@kernel.org>
Cc: v9fs-developer@lists.sourceforge.net, rminnich@gmail.com,
	lucho@ionkov.net, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux_oss@crudebyte.com
Subject: Re: [PATCH v4 10/11] fs/9p: writeback mode fixes
Date: Sat, 18 Feb 2023 19:01:22 +0900	[thread overview]
Message-ID: <Y/Ch8o/6HVS8Iyeh@codewreck.org> (raw)
In-Reply-To: <20230218003323.2322580-11-ericvh@kernel.org>

Eric Van Hensbergen wrote on Sat, Feb 18, 2023 at 12:33:22AM +0000:
> This fixes several detected problems from preivous
> patches when running with writeback mode.  In
> particular this fixes issues with files which are opened
> as write only and getattr on files which dirty caches.
> 
> This patch makes sure that cache behavior for an open file is stored in
> the client copy of fid->mode.  This allows us to reflect cache behavior
> from mount flags, open mode, and information from the server to
> inform readahead and writeback behavior.
> 
> This includes adding support for a 9p semantic that qid.version==0
> is used to mark a file as non-cachable which is important for
> synthetic files.  This may have a side-effect of not supporting
> caching on certain legacy file servers that do not properly set
> qid.version.  There is also now a mount flag which can disable
> the qid.version behavior.
> 
> Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>

Didn't have time to review it all thoroughly, sending what I have
anyway...

> diff --git a/Documentation/filesystems/9p.rst b/Documentation/filesystems/9p.rst
> index 0e800b8f73cc..0c2c7a181d85 100644
> --- a/Documentation/filesystems/9p.rst
> +++ b/Documentation/filesystems/9p.rst
> @@ -79,18 +79,14 @@ Options
>  
>    cache=mode	specifies a caching policy.  By default, no caches are used.
>  
> -                        none
> -				default no cache policy, metadata and data
> -                                alike are synchronous.
> -			loose
> -				no attempts are made at consistency,
> -                                intended for exclusive, read-only mounts
> -                        fscache
> -				use FS-Cache for a persistent, read-only
> -				cache backend.
> -                        mmap
> -				minimal cache that is only used for read-write
> -                                mmap.  Northing else is cached, like cache=none
> +			=========	=============================================
> +			none		no cache of file or metadata
> +			readahead	readahead caching of files
> +			writeback	delayed writeback of files
> +			mmap		support mmap operations read/write with cache
> +			loose		meta-data and file cache with no coherency
> +			fscache		use FS-Cache for a persistent cache backend
> +			=========	=============================================

perhaps a word saying the caches are incremental, only one can be used,
and listing them in order?
e.g. it's not clear from this that writeback also enables readahead,
and as a user I'd try to use cache=readahead,cache=writeback and wonder
why that doesn't work (well, I guess it would in that order...)


> diff --git a/fs/9p/fid.c b/fs/9p/fid.c
> index 805151114e96..8c1697619f3d 100644
> --- a/fs/9p/fid.c
> +++ b/fs/9p/fid.c
> @@ -41,14 +40,24 @@ void v9fs_fid_add(struct dentry *dentry, struct p9_fid **pfid)
>  	*pfid = NULL;
>  }
>  
> +static bool v9fs_is_writeable(int mode)
> +{
> +	if ((mode & P9_OWRITE) || (mode & P9_ORDWR))

(style) that's usually written 'if (mode & (P9_OWRITE | P9_ORDWR))'

(I don't really care, the compiler will likely generate the same more
efficient check)

> @@ -32,4 +34,33 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
>  	p9_fid_put(fid);
>  	return nfid;
>  }
> +/**
> + * v9fs_fid_addmodes - add cache flags to fid mode (for client use only)
> + * @fid: fid to augment
> + * @s_flags: session info mount flags
> + * @s_cache: session info cache flags
> + * @f_flags: unix open flags
> + *
> + * make sure mode reflects flags of underlying mounts
> + * also qid.version == 0 reflects a synthetic or legacy file system
> + * NOTE: these are set after open so only reflect 9p client not
> + * underlying file system on server.

Ok, so ignore my comment about that in other commit; but that note
really should also be in the header or commits should make sense in
order...
Rand aside, what's the point? It saves a lookup for the session in
v9fs_file_read/write_iter ? We don't support changing cache mode for new
fids with `mount -o remount` do we...

Ah, I see you're adding DIRECT to the mode if you fail opening the
writeback fid; ok that makes more sense.
I'd appreciate a comment as well for that, around the enum definition
rather than here, if you want to humor me on this.


> v9fs_file.c
> @@ -59,7 +59,19 @@ int v9fs_file_open(struct inode *inode, struct file *file)
>  		if (IS_ERR(fid))
>  			return PTR_ERR(fid);
>  
> -		err = p9_client_open(fid, omode);
> +		if ((v9ses->cache >= CACHE_WRITEBACK) && (omode & P9_OWRITE)) {
> +			int writeback_omode = (omode & !P9_OWRITE) | P9_ORDWR;

omode & ~P9_OWRITE ?
`!P9_OWRITE` will be 0...

> diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
> index 5fc6a945bfff..797f717e1a91 100644
> --- a/fs/9p/vfs_super.c
> +++ b/fs/9p/vfs_super.c

> @@ -323,16 +327,17 @@ static int v9fs_write_inode_dotl(struct inode *inode,
>  	 */
>  	v9inode = V9FS_I(inode);
>  	p9_debug(P9_DEBUG_VFS, "%s: inode %p, writeback_fid %p\n",
> -		 __func__, inode, v9inode->writeback_fid);
> -	if (!v9inode->writeback_fid)
> -		return 0;
> +		 __func__, inode, fid);
> +	if (!fid)
> +		return -EINVAL;

Hmm, what happens if we return EINVAL here?
Might want a WARN_ONCE or something?

  parent reply	other threads:[~2023-02-18 10:02 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221217183142.1425132-1-evanhensbergen@icloud.com>
2022-12-18 23:22 ` [PATCH v2 00/10] Performance fixes for 9p filesystem Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 01/10] Adjust maximum MSIZE to account for p9 header Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 02/10] Expand setup of writeback cache to all levels Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 03/10] Consolidate file operations and add readahead and writeback Eric Van Hensbergen
2023-01-24  2:43     ` asmadeus
2023-01-24  3:03       ` Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 04/10] Remove unnecessary superblock flags Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 05/10] allow disable of xattr support on mount Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 06/10] fix bug in client create for .L Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 07/10] Add additional debug flags and open modes Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 08/10] Add new mount modes Eric Van Hensbergen
2023-01-24  3:35     ` Amir Goldstein
2022-12-18 23:22   ` [PATCH v2 09/10] fix error reporting in v9fs_dir_release Eric Van Hensbergen
2022-12-18 23:22   ` [PATCH v2 10/10] writeback mode fixes Eric Van Hensbergen
2023-01-23 16:31   ` [PATCH v2 00/10] Performance fixes for 9p filesystem Christian Schoenebeck
2023-01-24  2:33     ` evanhensbergen
2023-01-24  2:49       ` asmadeus
2023-01-24  2:38   ` [PATCH v3 00/11] " Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 01/11] Adjust maximum MSIZE to account for p9 header Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 02/11] Expand setup of writeback cache to all levels Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 03/11] Consolidate file operations and add readahead and writeback Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 04/11] Remove unnecessary superblock flags Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 05/11] allow disable of xattr support on mount Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 06/11] fix bug in client create for .L Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 07/11] Add additional debug flags and open modes Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 08/11] Add new mount modes Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 09/11] fix error reporting in v9fs_dir_release Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 10/11] writeback mode fixes Eric Van Hensbergen
2023-01-24  2:38     ` [PATCH v3 11/11] Fix revalidate Eric Van Hensbergen
2023-02-02 11:27     ` [PATCH v3 00/11] Performance fixes for 9p filesystem Christian Schoenebeck
2023-02-03 19:12       ` Eric Van Hensbergen
2023-02-04 13:40         ` Christian Schoenebeck
2023-02-04 21:38           ` Eric Van Hensbergen
2023-02-05 16:37       ` Eric Van Hensbergen
2023-02-06 13:20         ` Christian Schoenebeck
2023-02-06 13:37           ` Eric Van Hensbergen
2023-02-18  0:33     ` [PATCH v4 " Eric Van Hensbergen
2023-02-18  0:33       ` [PATCH v4 01/11] net/9p: Adjust maximum MSIZE to account for p9 header Eric Van Hensbergen
2023-02-18  7:50         ` asmadeus
2023-02-18  0:33       ` [PATCH v4 02/11] fs/9p: Expand setup of writeback cache to all levels Eric Van Hensbergen
2023-02-18  8:57         ` asmadeus
2023-02-18  0:33       ` [PATCH v4 03/11] fs/9p: Consolidate file operations and add readahead and writeback Eric Van Hensbergen
2023-02-18  9:24         ` asmadeus
2023-02-18 16:17           ` Eric Van Hensbergen
2023-02-18 16:19             ` Eric Van Hensbergen
2023-02-18 20:35               ` asmadeus
2023-02-27  2:50                 ` [PATCH v5 3/11] " Eric Van Hensbergen
2023-02-18  0:33       ` [PATCH v4 04/11] fs/9p: Remove unnecessary superblock flags Eric Van Hensbergen
2023-02-18  9:33         ` asmadeus
2023-02-18 16:24           ` Eric Van Hensbergen
2023-02-18 20:30             ` asmadeus
2023-02-18  0:33       ` [PATCH v4 05/11] fs/9p: allow disable of xattr support on mount Eric Van Hensbergen
2023-02-18  7:52         ` asmadeus
2023-02-18  0:33       ` [PATCH v4 06/11] net/9p: fix bug in client create for .L Eric Van Hensbergen
2023-02-18  8:01         ` asmadeus
2023-02-18  0:33       ` [PATCH v4 07/11] 9p: Add additional debug flags and open modes Eric Van Hensbergen
2023-02-18  8:05         ` asmadeus
2023-02-27  2:53           ` [PATCH v5 7/11] " Eric Van Hensbergen
2023-02-18  0:33       ` [PATCH v4 08/11] fs/9p: Add new mount modes Eric Van Hensbergen
2023-02-18  8:46         ` asmadeus
2023-02-27  2:55           ` [PATCH v5 8/11] " Eric Van Hensbergen
2023-02-18  0:33       ` [PATCH v4 09/11] fs/9p: fix error reporting in v9fs_dir_release Eric Van Hensbergen
2023-02-18  8:49         ` asmadeus
2023-02-18  0:33       ` [PATCH v4 10/11] fs/9p: writeback mode fixes Eric Van Hensbergen
2023-02-18  8:38         ` asmadeus
2023-02-18 10:01         ` asmadeus [this message]
2023-02-18 12:15           ` asmadeus
2023-02-18 16:40             ` Eric Van Hensbergen
2023-02-18 20:29               ` asmadeus
2023-03-21  1:12             ` Eric Van Hensbergen
2023-02-18 19:58           ` Christian Schoenebeck
2023-02-18 22:24             ` Eric Van Hensbergen
2023-02-18 23:40               ` asmadeus
2023-02-18 23:52                 ` Eric Van Hensbergen
2023-03-27  2:59         ` [PATCH v5] fs/9p: remove writeback fid and fix per-file modes Eric Van Hensbergen
2023-04-25  7:11           ` Christophe JAILLET
2023-04-25 11:13             ` asmadeus
2023-04-26  0:01             ` Eric Van Hensbergen
2023-02-18  0:33       ` [PATCH v4 11/11] fs/9p: Fix revalidate Eric Van Hensbergen
2023-02-18  8:55         ` asmadeus
2023-02-18  7:48       ` [PATCH v4 00/11] Performance fixes for 9p filesystem asmadeus
2023-02-19 21:36       ` Christian Schoenebeck
2023-02-20  1:13         ` Eric Van Hensbergen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y/Ch8o/6HVS8Iyeh@codewreck.org \
    --to=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=rminnich@gmail.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox