Bug#690071: ecryptfs: corrupted files on a disk full event
Package: src:linux
Version: 3.2.23-1
Severity: important
Dear Maintainer,
After a running into a full disk event with my ecrypts encrypted home directory
I get the following messages:
[ 1477.919780] Valid eCryptfs headers not found in file header region or
xattr region, inode 3328393
[ 1477.919788] Either the lower file is not in a valid eCryptfs format,
or the key could not be retrieved. Plaintext passthrough mode is not
enabled; returning -EIO
** Tainted: O (4096)
* Out-of-tree module has been loaded.
** Kernel log:
[ 1318.082537] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1318.082548] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1318.082574] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1318.082581] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1323.076714] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1323.076725] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1323.076751] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1323.076758] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1328.071473] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1328.071484] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1328.071510] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1328.071518] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1333.065588] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1333.065599] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1333.065625] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1333.065632] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1338.060585] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1338.060597] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1338.060622] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1338.060630] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1343.055335] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1343.055347] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1343.055372] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1343.055380] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1348.050229] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1348.050240] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1348.050266] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1348.050273] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1353.045191] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1353.045203] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1353.045228] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1353.045236] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1358.040753] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1358.040764] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1358.040789] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1358.040797] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1363.035423] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1363.035434] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1363.035460] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1363.035468] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1368.030677] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1368.030688] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1368.030715] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1368.030722] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1373.025400] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1373.025411] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1373.025437] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1373.025444] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1378.020364] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1378.020375] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1378.020401] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1378.020408] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1383.015850] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1383.015861] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1383.015888] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1383.015895] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1388.010728] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1388.010739] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1388.010765] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1388.010773] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1393.005367] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1393.005377] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1393.005409] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1393.005416] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1398.000344] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1398.000355] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1398.000382] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1398.000389] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1402.995364] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1402.995375] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1402.995402] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1402.995409] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1407.990201] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1407.990212] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1407.990239] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1407.990246] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1412.984709] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1412.984720] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1412.984745] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1412.984753] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1417.979808] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1417.979819] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1417.979845] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1417.979852] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1422.975123] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1422.975134] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1422.975159] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1422.975167] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1427.970175] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1427.970187] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1427.970212] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1427.970219] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1432.965965] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1432.965976] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1432.966002] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1432.966010] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1437.960667] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1437.960678] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
[ 1437.960704] Valid eCryptfs headers not found in file header region or xattr region, inode 3328393
[ 1437.960711] Either the lower file is not in a valid eCryptfs format, or the key could not be retrieved. Plaintext passthrough mode is not enabled; returning -EIO
** Model information
sys_vendor: LENOVO
product_name: 4287CTO
product_version: ThinkPad X220
chassis_vendor: LENOVO
chassis_version: Not Available
bios_vendor: LENOVO
bios_version: 8DET52WW (1.22 )
board_vendor: LENOVO
board_name: 4287CTO
board_version: Not Available
*** Protocol statistics:
Ip:
1647 total packets received
0 forwarded
0 incoming packets discarded
1541 incoming packets delivered
1636 requests sent out
48 outgoing packets dropped
4 dropped because of missing route
Icmp:
56 ICMP messages received
0 input ICMP message failed.
ICMP input histogram:
destination unreachable: 56
56 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 56
IcmpMsg:
InType3: 56
OutType3: 56
Tcp:
100 active connections openings
0 passive connection openings
2 failed connection attempts
4 connection resets received
4 connections established
2603 segments received
2249 segments send out
20 segments retransmited
0 bad segments received.
40 resets sent
Udp:
661 packets received
56 packets to unknown port received.
0 packet receive errors
674 packets sent
UdpLite:
TcpExt:
50 TCP sockets finished time wait in fast timer
47 delayed acks sent
Quick ack mode was activated 4 times
1752 packet headers predicted
280 acknowledgments not containing data payload received
150 predicted acknowledgments
3 congestion windows recovered without slow start after partial ack
16 retransmits in slow start
4 other TCP timeouts
3 DSACKs sent for old packets
2 DSACKs received
12 connections reset due to unexpected data
4 connections reset due to early user close
TCPSackShiftFallback: 5
IpExt:
InNoRoutes: 3
InMcastPkts: 106
OutMcastPkts: 91
InBcastPkts: 108
OutBcastPkts: 105
InOctets: 697110
OutOctets: 237722
InMcastOctets: 12342
OutMcastOctets: 11051
InBcastOctets: 15449
OutBcastOctets: 14754
0d:00.0 System peripheral [0880]: Ricoh Co Ltd MMC/SD Host Controller [1180:e822] (rev 07) (prog-if 01)
Subsystem: Lenovo Device [17aa:21da]
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 16
Region 0: Memory at f1500000 (32-bit, non-prefetchable) [size=256]
Capabilities: <access denied>
Kernel driver in use: sdhci-pci
0e:00.0 USB controller [0c03]: NEC Corporation uPD720200 USB 3.0 Host Controller [1033:0194] (rev 04) (prog-if 30 [XHCI])
Subsystem: Lenovo Device [17aa:21da]
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 18
Region 0: Memory at f1400000 (64-bit, non-prefetchable) [size=8K]
Capabilities: <access denied>
Kernel driver in use: xhci_hcd
** USB devices:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Bus 003 Device 004: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 003 Device 005: ID 04f2:b217 Chicony Electronics Co., Ltd Lenovo Integrated Camera (0.3MP)
Bus 004 Device 003: ID 0bdb:1911 Ericsson Business Mobile Networks BV
Bus 004 Device 004: ID 08e6:34ec Gemplus
Kernel: Linux 3.2.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages linux-image-3.2.0-3-amd64 depends on:
ii debconf [debconf-2.0] 1.5.46
ii initramfs-tools [linux-initramfs-tool] 0.108
ii kmod 9-2
ii linux-base 3.5
ii module-init-tools 9-2
Versions of packages linux-image-3.2.0-3-amd64 recommends:
ii firmware-linux-free 3.1
Versions of packages linux-image-3.2.0-3-amd64 suggests:
pn debian-kernel-handbook <none>
ii extlinux 2:4.05+dfsg-6
ii grub-pc 1.99-23
pn linux-doc-3.2 <none>
Versions of packages linux-image-3.2.0-3-amd64 is related to:
pn firmware-atheros <none>
pn firmware-bnx2 <none>
pn firmware-bnx2x <none>
pn firmware-brcm80211 <none>
ii firmware-intelwimax 0.36
ii firmware-ipw2x00 0.36
pn firmware-ivtv <none>
ii firmware-iwlwifi 0.36
pn firmware-libertas <none>
pn firmware-linux <none>
ii firmware-linux-nonfree 0.36
pn firmware-myricom <none>
pn firmware-netxen <none>
pn firmware-qlogic <none>
pn firmware-ralink <none>
pn firmware-realtek <none>
pn xen-hypervisor <none>
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/20121009173522.5563.81022.reportbug@klapprechner
10-09-2012, 07:33 PM
Jonathan Nieder
Bug#690071: ecryptfs: corrupted files on a disk full event
tags 690071 + upstream patch moreinfo
quit
Hi Sebastian,
Sebastian Heinlein wrote:
> After a running into a full disk event with my ecrypts encrypted home directory
[...]
> I see a lot of random broken files on my system:
[...]
> https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/957843
Please test the attached patches against a 3.2.y kernel, for example
using the following instructions:
0. prerequisites
apt-get install git build-essential
1. get the kernel history, if you don't already have it
cd linux
git remote add stable
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git fetch stable
3. configure, build, test
git checkout stable/linux-3.2.y
cp /boot/config-$(uname -r) .config; # current configuration
scripts/config --disable DEBUG_INFO
make localmodconfig; # optional: minimize configuration
make deb-pkg; # optionally with -j<num> for parallel build
dpkg -i ../<name of package>; # as root
reboot
... test test test ...
Hopefully it reproduces the bug, so
4. try the patches
cd linux
git am -3sc $(ls -1 /path/to/patches/0*)
make deb-pkg; # maybe with -j4
dpkg -i ../<name of package>; # as root
reboot
... test test test ...
Hope that helps,
Jonathan
From: Tyler Hicks <tyhicks@canonical.com>
Date: Tue, 22 May 2012 15:09:50 -0500
Subject: eCryptfs: Unlink lower inode when ecryptfs_create() fails
ecryptfs_create() creates a lower inode, allocates an eCryptfs inode,
initializes the eCryptfs inode and cryptographic metadata attached to
the inode, and then writes the metadata to the header of the file.
If an error was to occur after the lower inode was created, an empty
lower file would be left in the lower filesystem. This is a problem
because ecryptfs_open() refuses to open any lower files which do not
have the appropriate metadata in the file header.
This patch properly unlinks the lower inode when an error occurs in the
later stages of ecryptfs_create(), reducing the chance that an empty
lower file will be left in the lower filesystem.
https://launchpad.net/bugs/872905
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Cc: John Johansen <john.johansen@canonical.com>
Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
fs/ecryptfs/inode.c | 55 ++++++++++++++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 23 deletions(-)
Historically, eCryptfs has only initialized lower files in the
ecryptfs_create() path. Lower file initialization is the act of writing
the cryptographic metadata from the inode's crypt_stat to the header of
the file. The ecryptfs_open() path already expects that metadata to be
in the header of the file.
A number of users have reported empty lower files in beneath their
eCryptfs mounts. Most of the causes for those empty files being left
around have been addressed, but the presence of empty files causes
problems due to the lack of proper cryptographic metadata.
To transparently solve this problem, this patch initializes empty lower
files in the ecryptfs_open() error path. If the metadata is unreadable
due to the lower inode size being 0, plaintext passthrough support is
not in use, and the metadata is stored in the header of the file (as
opposed to the user.ecryptfs extended attribute), the lower file will be
initialized.
The number of nested conditionals in ecryptfs_open() was getting out of
hand, so a helper function was created. To avoid the same nested
conditional problem, the conditional logic was reversed inside of the
helper function.
https://launchpad.net/bugs/911507
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Cc: John Johansen <john.johansen@canonical.com>
Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
fs/ecryptfs/ecryptfs_kernel.h | 2 ++
fs/ecryptfs/file.c | 71 ++++++++++++++++++++++++++---------------
fs/ecryptfs/inode.c | 4 +--
3 files changed, 49 insertions(+), 28 deletions(-)
A change was made about a year ago to get eCryptfs to better utilize its
page cache during writes. The idea was to do the page encryption
operations during page writeback, rather than doing them when initially
writing into the page cache, to reduce the number of page encryption
operations during sequential writes. This meant that the encrypted page
would only be written to the lower filesystem during page writeback,
which was a change from how eCryptfs had previously wrote to the lower
filesystem in ecryptfs_write_end().
The change caused a few eCryptfs-internal bugs that were shook out.
Unfortunately, more grave side effects have been identified that will
force changes outside of eCryptfs. Because the lower filesystem isn't
consulted until page writeback, eCryptfs has no way to pass lower write
errors (ENOSPC, mainly) back to userspace. Additionaly, it was reported
that quotas could be bypassed because of the way eCryptfs may sometimes
open the lower filesystem using a privileged kthread.
It would be nice to resolve the latest issues, but it is best if the
eCryptfs commits be reverted to the old behavior in the meantime.
This reverts:
32001d6f "eCryptfs: Flush file in vma close"
5be79de2 "eCryptfs: Flush dirty pages in setattr"
57db4e8d "ecryptfs: modify write path to encrypt page in writepage"
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Tested-by: Colin King <colin.king@canonical.com>
Cc: Colin King <colin.king@canonical.com>
Cc: Thieu Le <thieule@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
fs/ecryptfs/file.c | 33 ++-------------------------------
fs/ecryptfs/inode.c | 6 ------
fs/ecryptfs/mmap.c | 39 +++++++++++++--------------------------
3 files changed, 15 insertions(+), 63 deletions(-)
- 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);
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 6a44148c5fb9..93a998a21374 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -62,18 +62,6 @@ static int ecryptfs_writepage(struct page *page, struct writeback_control *wbc)
{
int rc;
- /*
- * Refuse to write the page out if we are called from reclaim context
- * since our writepage() path may potentially allocate memory when
- * calling into the lower fs vfs_write() which may in turn invoke
- * us again.
- */
- if (current->flags & PF_MEMALLOC) {
- redirty_page_for_writepage(wbc, page);
- rc = 0;
- goto out;
- }
-
rc = ecryptfs_encrypt_page(page);
if (rc) {
ecryptfs_printk(KERN_WARNING, "Error encrypting "
@@ -498,7 +486,6 @@ static int ecryptfs_write_end(struct file *file,
struct ecryptfs_crypt_stat *crypt_stat =
&ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat;
int rc;
- int need_unlock_page = 1;
Bug#690071: ecryptfs: corrupted files on a disk full event
I had a short conversation with one of the upstream developers, Tyler
Hicks. It seems that there are still two other patches required:
"For completeness, I wanted to point out two more patches which should
be added to the list I gave in comment 20. 821f749 introduced a
regression and these two patches are needed to fix the regression:
64e6651 eCryptfs: Call lower ->flush() from ecryptfs_flush()
7149f25 eCryptfs: Write out all dirty pages just before releasing the
lower file
Actually, 7149f25 is the only one required but I recommend 64e6651, as
well."
The IRC chat:
<glatzor> tyhicks, hello
<tyhicks> glatzor: Hi
* mwhudson hat die Verbindung getrennt (Ping timeout: 246 seconds)
<glatzor> tyhicks, I run an ecryptfs protected home dir on my debian
wheezy system and run into the corrupted files on disk full error
<glatzor> tyhicks, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=
+%09690071
* dholbach hat die Verbindung getrennt (Read error: Connection reset by
peer)
<glatzor> tyhicks, you mentioned that some patches to fix this problem
have been applied in ubuntu. but I still get the problem with the
patches applied
<glatzor> tyhicks, are there any further patches missing?
* dholbach (~daniel@ubuntu/member/dholbach) hat #ubuntu-devel betreten
<tyhicks> glatzor: You applied the 3 patches mentioned at the bottom of
that bug?
<glatzor> tyhicks, right.
<glatzor> tyhicks, with the applied patches the command to fill up the
disk failed correctly by a disk full error. I used dd if=/dev/zero
of=disk-full bs=1M
<glatzor> tyhicks, but without the patches the dd command tries to write
for ever
* babyface__ hat die Verbindung getrennt (Quit: Ex-Chat)
<tyhicks> glatzor: With the patches applied, it sounds like things are
working correctly. Why do you think there is still a problem?
* TJ- (tj@yes.iam.tj) hat #ubuntu-devel betreten
* mvo hat die Verbindung getrennt (Quit: Ex-Chat)
<glatzor> tyhicks, because I still get files of zero size in
$HOME/.Private/ that cause problems
* mvo (~egon@p5B09B69A.dip.t-dialin.net) hat #ubuntu-devel betreten
* tsdgeos hat die Verbindung getrennt (Remote host closed the
connection)
<tyhicks> glatzor: FYI, see
https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/957843/comments/22
<ubottu> Launchpad bug 957843 in eCryptfs "files in eCryptFS Private
directory get corrupted" [High,Fix released]
<yhicks> glatzor: Those two extra patches don't fix the problem that
you're seeing, but they're needed if you carry the other three patches
<glatzor> tyhicks, Is it ok if I add this conversation to the bug? I
will try with the other two patches
<tyhicks> glatzor: Sure
<tyhicks> glatzor: I'm going to have to step away shortly. If you're
sure that you're still seing zero length files, please file an upstream
eCryptfs bug at https://bugs.launchpad.net/ecryptfs/+filebug and I'll
take a look at it tomorrow.
Am Dienstag, den 09.10.2012, 12:33 -0700 schrieb Jonathan Nieder:
> tags 690071 + upstream patch moreinfo
> quit
>
> Hi Sebastian,
>
> Sebastian Heinlein wrote:
>
> > After a running into a full disk event with my ecrypts encrypted home directory
> [...]
> > I see a lot of random broken files on my system:
> [...]
> > https://bugs.launchpad.net/ubuntu/+source/ecryptfs-utils/+bug/957843
>
> Please test the attached patches against a 3.2.y kernel, for example
> using the following instructions:
>
> 0. prerequisites
>
> apt-get install git build-essential
>
> 1. get the kernel history, if you don't already have it
>
> git clone
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>
> 2. fetch point releases
>
> cd linux
> git remote add stable
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
> git fetch stable
>
> 3. configure, build, test
>
> git checkout stable/linux-3.2.y
> cp /boot/config-$(uname -r) .config; # current configuration
> scripts/config --disable DEBUG_INFO
> make localmodconfig; # optional: minimize configuration
> make deb-pkg; # optionally with -j<num> for parallel build
> dpkg -i ../<name of package>; # as root
> reboot
> ... test test test ...
>
> Hopefully it reproduces the bug, so
>
> 4. try the patches
>
> cd linux
> git am -3sc $(ls -1 /path/to/patches/0*)
> make deb-pkg; # maybe with -j4
> dpkg -i ../<name of package>; # as root
> reboot
> ... test test test ...
>
> Hope that helps,
> Jonathan
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/1349864504.5016.13.camel@klapprechner
10-10-2012, 01:04 PM
Sebastian Heinlein
Bug#690071: ecryptfs: corrupted files on a disk full event
Hello Jonathan und Thyler,
Applying all 5 patches fixed all issues for me.
I don't get any zero sized files anymore with a full disk (find
$HOME/.Private/ -size 0c). I can even login with the user having a full
disk (before often a broken .ICEauthority made this inpossible. I could
not see any data corruptions in applications (Evolution, Iceweasel).
The dd command which fills up the disk also exits correctly.
Thanks
$ dd if=/dev/zero of=disk-full
dd: Schreiben von „disk-full“: Auf dem Gerät ist kein Speicherplatz mehr
verfügbar
6579+0 Datensätze ein
6578+0 Datensätze aus
6898343936 Bytes (6,9 GB) kopiert, 75,1908 s, 91,7 MB/s
I see a lot of errors in dmesg, but these seem to be related to the full
disk write operation:
[ 554.634486] ecryptfs_encrypt_page: Error attempting to write lower
page; rc = [-28]
[ 554.634492] ecryptfs_write_end: Error encrypting page (upper index
[0x0000000000000054])
[ 570.567506] ecryptfs_write_metadata_to_contents: Error attempting to
write header information to lower file; rc = [-28]
[ 570.567517] ecryptfs_write_metadata: Error writing metadata out to
lower file; rc = [-28]
[ 570.567524] Error writing headers; rc = [-28]
[ 580.071153] ecryptfs_write_metadata_to_contents: Error attempting to
write header information to lower file; rc = [-28]
[ 580.071164] ecryptfs_write_metadata: Error writing metadata out to
lower file; rc = [-28]
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/1349874250.6874.6.camel@klapprechner
10-10-2012, 05:01 PM
Tyler Hicks
Bug#690071: ecryptfs: corrupted files on a disk full event
On 2012-10-10 15:04:10, Sebastian Heinlein wrote:
> Applying all 5 patches fixed all issues for me.
Good to hear!
> I see a lot of errors in dmesg, but these seem to be related to the full
> disk write operation:
This is just eCryptfs being too chatty in error situations. This is
expected at the moment, but it is something that needs to be fixed in
the future.
Tyler
10-10-2012, 09:58 PM
Jonathan Nieder
Bug#690071: ecryptfs: corrupted files on a disk full event
Thanks; passed upstream. Hopefully these patches can be included in
kernel.org point releases soon so everyone benefits from them.
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/20121010215856.GF4517@elie.Belkin