summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyler Hicks <tyhicks@linux.vnet.ibm.com>2011-04-22 13:08:00 -0500
committerTyler Hicks <tyhicks@linux.vnet.ibm.com>2011-04-25 18:49:46 -0500
commit5be79de2e1ffa19d871a494697cf76cddee93384 (patch)
tree4b6a9e060ba1d33f3573f0ea4b04f950e8027c79
parent3aeb86ea4cd15f728147a3bd5469a205ada8c767 (diff)
downloadblackbird-op-linux-5be79de2e1ffa19d871a494697cf76cddee93384.tar.gz
blackbird-op-linux-5be79de2e1ffa19d871a494697cf76cddee93384.zip
eCryptfs: Flush dirty pages in setattr
After 57db4e8d73ef2b5e94a3f412108dff2576670a8a changed eCryptfs to write-back caching, eCryptfs page writeback updates the lower inode times due to the use of vfs_write() on the lower file. To preserve inode metadata changes, such as 'cp -p' does with utimensat(), we need to flush all dirty pages early in ecryptfs_setattr() so that the user-updated lower inode metadata isn't clobbered later in writeback. https://bugzilla.kernel.org/show_bug.cgi?id=33372 Reported-by: Rocko <rockorequin@hotmail.com> Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
-rw-r--r--fs/ecryptfs/inode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 2c19d362d2d4..4d4cc6a90cd5 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -929,6 +929,12 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
}
}
mutex_unlock(&crypt_stat->cs_mutex);
+ if (S_ISREG(inode->i_mode)) {
+ rc = filemap_write_and_wait(inode->i_mapping);
+ if (rc)
+ goto out;
+ fsstack_copy_attr_all(inode, lower_inode);
+ }
memcpy(&lower_ia, ia, sizeof(lower_ia));
if (ia->ia_valid & ATTR_FILE)
lower_ia.ia_file = ecryptfs_file_to_lower(ia->ia_file);
OpenPOWER on IntegriCloud