Linux-Fsdevel Archive on
 help / color / Atom feed
From: Hans de Goede <>
To: Christoph Hellwig <>
Cc: Alexander Viro <>,
	David Howells <>,
Subject: Re: [PATCH v13] fs: Add VirtualBox guest shared folder (vboxsf) support
Date: Fri, 16 Aug 2019 11:39:32 +0200
Message-ID: <> (raw)
In-Reply-To: <>


On 16-08-19 11:01, Hans de Goede wrote:
> On 16-08-19 09:56, Christoph Hellwig wrote:


>>> + * Ideally we would wrap generic_file_read_iter with a function which also
>>> + * does this check, to reduce the chance of us missing writes happening on the
>>> + * host side after open(). But the vboxsf stat call to the host only works on
>>> + * filenames, so that would require caching the filename in our
>>> + * file->private_data and there is no guarantee that filename will still
>>> + * be valid at read_iter time. So this would be in no way bulletproof.
>> Well, you can usually generate a file name from file->f_path.dentry.
>> The only odd case is opened by unliked files.  NFS has a special hack
>> for those called sillyrename (you can grep for that). 
> Right, so since the unlink or a normal rename could happen on the host side
> and there is no notification of that, those will be 2 areas where a stat
> call to verify will fail, which leaves us with 3 options:
> 1) Make stat calls before read() calls, if they fail purge the cache to be safe
> 2) Make stat calls before read(), on failure ignore the stat call
> 3) Treat read() calls like other page-cache reads such as sendfile or mmap
> and only check if the cache is stale at open() time.

I just realized there is a 4th option, which is to make vboxsf read_iter
simply always do:

4) Always evict non dirt pages from page-cache from read_iter, to ensure we
    get the latest version from the host:

So something like this:

          * Evict non dirt pages from page-cache, so that we reget them from
          * the host in case they have been changed.
          * /
	invalidate_mapping_pages(inode->i_mapping, pos >> PAGE_SHIFT,
				 (pos + len) >> PAGE_SHIFT);

This is in essence what the out of tree driver is doing on read(), except
that it does not go through the page-cache at all.

I think this might be the best option, perhaps controlled by a mount
flag ?



  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 13:12 Hans de Goede
2019-08-15 13:12 ` Hans de Goede
2019-08-16  7:56   ` Christoph Hellwig
2019-08-16  9:01     ` Hans de Goede
2019-08-16  9:39       ` Hans de Goede [this message]
2019-08-16 12:49       ` Christoph Hellwig
2019-08-15 13:33 ` Hans de Goede

Reply instructions:

You may reply publically 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:

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

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Fsdevel Archive on

Archives are clonable:
	git clone --mirror linux-fsdevel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fsdevel linux-fsdevel/ \
	public-inbox-index linux-fsdevel

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox