linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hostfs: Use noop_fsync for directories
@ 2015-01-13 22:15 Richard Weinberger
  2015-01-13 22:19 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2015-01-13 22:15 UTC (permalink / raw)
  To: user-mode-linux-devel
  Cc: dxld, linux-kernel, linux-fsdevel, Richard Weinberger, stable

Daniel reported that dpkg(1) dies if the root filesystem is a hostfs
because it does not expect fsync(2) to fail with EINVAL on directories.
While fsync(2) is allowed to fail with EINVAL if the filesystem does not
support it we can do better and use noop_fsync() to not confuse userspace
further.

Cc: stable@vger.kernel.org
Reported-and-tested-by: Daniel Gröber <dxld@darkboxed.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/hostfs/hostfs_kern.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index fd62cae..a7ac856 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -393,6 +393,7 @@ static const struct file_operations hostfs_dir_fops = {
 	.llseek		= generic_file_llseek,
 	.iterate	= hostfs_readdir,
 	.read		= generic_read_dir,
+	.fsync		= noop_fsync,
 };
 
 static int hostfs_writepage(struct page *page, struct writeback_control *wbc)
-- 
1.8.4.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] hostfs: Use noop_fsync for directories
  2015-01-13 22:15 [PATCH] hostfs: Use noop_fsync for directories Richard Weinberger
@ 2015-01-13 22:19 ` Christoph Hellwig
  2015-01-13 22:26   ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2015-01-13 22:19 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: user-mode-linux-devel, dxld, linux-kernel, linux-fsdevel, stable

On Tue, Jan 13, 2015 at 11:15:58PM +0100, Richard Weinberger wrote:
> Daniel reported that dpkg(1) dies if the root filesystem is a hostfs
> because it does not expect fsync(2) to fail with EINVAL on directories.
> While fsync(2) is allowed to fail with EINVAL if the filesystem does not
> support it we can do better and use noop_fsync() to not confuse userspace
> further.

Shouldn't hostfs pass the fsync through to the host filesystem?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] hostfs: Use noop_fsync for directories
  2015-01-13 22:19 ` Christoph Hellwig
@ 2015-01-13 22:26   ` Richard Weinberger
  2015-01-14  8:39     ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2015-01-13 22:26 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: user-mode-linux-devel, dxld, linux-kernel, linux-fsdevel, stable

Am 13.01.2015 um 23:19 schrieb Christoph Hellwig:
> On Tue, Jan 13, 2015 at 11:15:58PM +0100, Richard Weinberger wrote:
>> Daniel reported that dpkg(1) dies if the root filesystem is a hostfs
>> because it does not expect fsync(2) to fail with EINVAL on directories.
>> While fsync(2) is allowed to fail with EINVAL if the filesystem does not
>> support it we can do better and use noop_fsync() to not confuse userspace
>> further.
> 
> Shouldn't hostfs pass the fsync through to the host filesystem?

hostfs tries do reduce the amount of syscall between guest and host as much
as possible. For file operations it passes everything down to the host but
for directory operations only ->iterate() does.

It is already horrible slow, if we add an ->open() for directory too it would
get even more slower. :-(

Thanks,
//richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] hostfs: Use noop_fsync for directories
  2015-01-13 22:26   ` Richard Weinberger
@ 2015-01-14  8:39     ` Christoph Hellwig
  2015-01-14  8:43       ` Richard Weinberger
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2015-01-14  8:39 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Christoph Hellwig, user-mode-linux-devel, dxld, linux-kernel,
	linux-fsdevel, stable

On Tue, Jan 13, 2015 at 11:26:38PM +0100, Richard Weinberger wrote:
> hostfs tries do reduce the amount of syscall between guest and host as much
> as possible. For file operations it passes everything down to the host but
> for directory operations only ->iterate() does.
> 
> It is already horrible slow, if we add an ->open() for directory too it would
> get even more slower. :-(

This sounds fairlt dangerous.  At least add some good documentation
explaining these semantics.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] hostfs: Use noop_fsync for directories
  2015-01-14  8:39     ` Christoph Hellwig
@ 2015-01-14  8:43       ` Richard Weinberger
  2015-01-18  1:08         ` Daniel Gröber
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Weinberger @ 2015-01-14  8:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: user-mode-linux-devel, dxld, linux-kernel, linux-fsdevel, stable

Am 14.01.2015 um 09:39 schrieb Christoph Hellwig:
> On Tue, Jan 13, 2015 at 11:26:38PM +0100, Richard Weinberger wrote:
>> hostfs tries do reduce the amount of syscall between guest and host as much
>> as possible. For file operations it passes everything down to the host but
>> for directory operations only ->iterate() does.
>>
>> It is already horrible slow, if we add an ->open() for directory too it would
>> get even more slower. :-(
> 
> This sounds fairlt dangerous.  At least add some good documentation
> explaining these semantics.

Understood. Maybe it is time to rebenchmark hostfs with full directory pass-through support.
Daniel, are you interested in a small kernel project?
As explained on IRC adding real support for directory fsync() should be an easy task.
The only interesting point is how much overhead it will add.

Thanks,
//richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] hostfs: Use noop_fsync for directories
  2015-01-14  8:43       ` Richard Weinberger
@ 2015-01-18  1:08         ` Daniel Gröber
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Gröber @ 2015-01-18  1:08 UTC (permalink / raw)
  To: richard; +Cc: hch, user-mode-linux-devel, linux-kernel, linux-fsdevel, stable

[-- Attachment #1: Type: Text/Plain, Size: 337 bytes --]

From: Richard Weinberger <richard@nod.at>
Subject: Re: [PATCH] hostfs: Use noop_fsync for directories
Date: Wed, 14 Jan 2015 09:43:53 +0100

> Daniel, are you interested in a small kernel project?

Sure, I'm just pretty busy with university right now, I'll probably
pick this back up after exams are finished in a month or so.

--Daniel

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-18  1:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-13 22:15 [PATCH] hostfs: Use noop_fsync for directories Richard Weinberger
2015-01-13 22:19 ` Christoph Hellwig
2015-01-13 22:26   ` Richard Weinberger
2015-01-14  8:39     ` Christoph Hellwig
2015-01-14  8:43       ` Richard Weinberger
2015-01-18  1:08         ` Daniel Gröber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).