LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ecryptfs lower_file handling issues 
@ 2007-02-19 14:34 Dmitriy Monakhov
  2007-02-22  7:34 ` [PATCH] ecryptfs remove unnecessary flush_dcache_page Dmitriy Monakhov
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitriy Monakhov @ 2007-02-19 14:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 449 bytes --]


1)Function ecryptfs_do_readpage() calls flush_dcache_page(lower_page),
  but lower_page was't changed here. So remove this line.

2)prepare_write ret val was ignored in ecryptfs_write_inode_size_to_header().
If error happends we can't call commit_write, just do cleanup and fial.
It is issue easy to reproduce with full lower_fs, in this case prepare_write()
will return ENOSPC.
Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>
-------------

[-- Attachment #2: diff-mm-ecryptfs-mmap-fix-2_6_20-mm2 --]
[-- Type: text/plain, Size: 986 bytes --]

diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 1e5d2ba..0cebb75 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -238,7 +238,6 @@ int ecryptfs_do_readpage(struct file *file, struct page *page,
 	lower_page_data = kmap_atomic(lower_page, KM_USER1);
 	memcpy(page_data, lower_page_data, PAGE_CACHE_SIZE);
 	kunmap_atomic(lower_page_data, KM_USER1);
-	flush_dcache_page(lower_page);
 	kunmap_atomic(page_data, KM_USER0);
 	flush_dcache_page(page);
 	rc = 0;
@@ -454,6 +453,12 @@ static int ecryptfs_write_inode_size_to_header(struct file *lower_file,
 	}
 	lower_a_ops = lower_inode->i_mapping->a_ops;
 	rc = lower_a_ops->prepare_write(lower_file, header_page, 0, 8);
+	if (rc) {
+		ecryptfs_printk(KERN_ERR, "Error preparing header page "
+			"write\n");
+		ecryptfs_release_lower_page(header_page);
+		goto out;
+	}
 	file_size = (u64)i_size_read(inode);
 	ecryptfs_printk(KERN_DEBUG, "Writing size: [0x%.16x]\n", file_size);
 	file_size = cpu_to_be64(file_size);

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

* [PATCH] ecryptfs remove unnecessary flush_dcache_page
  2007-02-19 14:34 [PATCH] ecryptfs lower_file handling issues Dmitriy Monakhov
@ 2007-02-22  7:34 ` Dmitriy Monakhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitriy Monakhov @ 2007-02-22  7:34 UTC (permalink / raw)
  To: Dmitriy Monakhov; +Cc: linux-kernel, devel, ecryptfs-devel

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

Dmitriy Monakhov <dmonakhov@openvz.org> writes:

> 1)Function ecryptfs_do_readpage() calls flush_dcache_page(lower_page),
>   but lower_page was't changed here. So remove this line.
>
> 2)prepare_write ret val was ignored in ecryptfs_write_inode_size_to_header().
> If error happends we can't call commit_write, just do cleanup and fial.
> It is issue easy to reproduce with full lower_fs, in this case prepare_write()
Second issue was fixed by "ecryptfs-resolve-lower-page-unlocking-problem.patch",
but first issue was't.

[LOG]
  Function ecryptfs_do_readpage() calls flush_dcache_page(lower_page),
  but lower_page was't changed here. Even if it was changed by 
  lower_a_ops->readpage() dcache was flushed by readpage() itself.
  So remove this unnecessary line.
Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>


[-- Attachment #2: diff-mm-ecryptfs-false-flush_dcache --]
[-- Type: text/plain, Size: 478 bytes --]

diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 1e5d2ba..2e45513 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -238,7 +238,6 @@ int ecryptfs_do_readpage(struct file *file, struct page *page,
 	lower_page_data = kmap_atomic(lower_page, KM_USER1);
 	memcpy(page_data, lower_page_data, PAGE_CACHE_SIZE);
 	kunmap_atomic(lower_page_data, KM_USER1);
-	flush_dcache_page(lower_page);
 	kunmap_atomic(page_data, KM_USER0);
 	flush_dcache_page(page);
 	rc = 0;

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

end of thread, other threads:[~2007-02-22  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-19 14:34 [PATCH] ecryptfs lower_file handling issues Dmitriy Monakhov
2007-02-22  7:34 ` [PATCH] ecryptfs remove unnecessary flush_dcache_page Dmitriy Monakhov

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).