summaryrefslogtreecommitdiffstats
path: root/fs/hostfs
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2015-03-01 18:09:33 -0500
committerRichard Weinberger <richard@nod.at>2015-03-26 18:27:48 -0400
commit4c6dcafc691bbd1e3258b623121d8859d3213ae9 (patch)
treeda299aa878b61b977bd501d0cfcc481ddcb49121 /fs/hostfs
parentaf9556586a906106453ff7df8bcacf795b2b7d0a (diff)
hostfs: Allow fsync on directories
Historically hostfs did not open directories on the host filesystem for performance and memory reasons. But it turned out that this optimization has a drawback. Calling fsync() on a hostfs directory returns immediately with -EINVAL as fsync is not implemented. While this is behavior is strictly speaking correct common userspace like dpkg(1) stumbles over that and makes it impossible to use hostfs as root filesystem. The fix is easy, wire up the existing host open/fsync functions to the directory file operations. Reported-by: Daniel Gröber <dxld@darkboxed.org> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/hostfs')
-rw-r--r--fs/hostfs/hostfs_kern.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 112ba5aa0848..92b008f564a4 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -295,7 +295,7 @@ static int hostfs_readdir(struct file *file, struct dir_context *ctx)
295 return 0; 295 return 0;
296} 296}
297 297
298static int hostfs_file_open(struct inode *ino, struct file *file) 298static int hostfs_open(struct inode *ino, struct file *file)
299{ 299{
300 char *name; 300 char *name;
301 fmode_t mode = 0; 301 fmode_t mode = 0;
@@ -386,7 +386,7 @@ static const struct file_operations hostfs_file_fops = {
386 .write_iter = generic_file_write_iter, 386 .write_iter = generic_file_write_iter,
387 .write = new_sync_write, 387 .write = new_sync_write,
388 .mmap = generic_file_mmap, 388 .mmap = generic_file_mmap,
389 .open = hostfs_file_open, 389 .open = hostfs_open,
390 .release = hostfs_file_release, 390 .release = hostfs_file_release,
391 .fsync = hostfs_fsync, 391 .fsync = hostfs_fsync,
392}; 392};
@@ -395,6 +395,8 @@ static const struct file_operations hostfs_dir_fops = {
395 .llseek = generic_file_llseek, 395 .llseek = generic_file_llseek,
396 .iterate = hostfs_readdir, 396 .iterate = hostfs_readdir,
397 .read = generic_read_dir, 397 .read = generic_read_dir,
398 .open = hostfs_open,
399 .fsync = hostfs_fsync,
398}; 400};
399 401
400static int hostfs_writepage(struct page *page, struct writeback_control *wbc) 402static int hostfs_writepage(struct page *page, struct writeback_control *wbc)