CacheFiles: Handle truncate unlocking the page we're reading
authorDavid Howells <dhowells@redhat.com>
Thu, 19 Nov 2009 18:11:55 +0000 (18:11 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 19 Nov 2009 18:11:55 +0000 (18:11 +0000)
commit5e929b33c3935ecb029b3e495356b2b8af432efa
tree99f892f4ea926d94b441856e27f1e08814ab1c75
parenta17754fb8c28af19cd70dcbec6d5b0773b94e0c1
CacheFiles: Handle truncate unlocking the page we're reading

Handle truncate unlocking the page we're attempting to read from the backing
device before the read has completed.

This was causing reports like the following to occur:

Pid: 4765, comm: kslowd Not tainted 2.6.30.1 #1
Call Trace:
 [<ffffffffa0331d7a>] ? cachefiles_read_waiter+0xd9/0x147 [cachefiles]
 [<ffffffff804b74bd>] ? __wait_on_bit+0x60/0x6f
 [<ffffffff8022bbbb>] ? __wake_up_common+0x3f/0x71
 [<ffffffff8022cc32>] ? __wake_up+0x30/0x44
 [<ffffffff8024a41f>] ? __wake_up_bit+0x28/0x2d
 [<ffffffffa003a793>] ? ext3_truncate+0x4d7/0x8ed [ext3]
 [<ffffffff80281f90>] ? pagevec_lookup+0x17/0x1f
 [<ffffffff8028c2ff>] ? unmap_mapping_range+0x59/0x1ff
 [<ffffffff8022cc32>] ? __wake_up+0x30/0x44
 [<ffffffff8028e286>] ? vmtruncate+0xc2/0xe2
 [<ffffffff802b82cf>] ? inode_setattr+0x22/0x10a
 [<ffffffffa003baa5>] ? ext3_setattr+0x17b/0x1e6 [ext3]
 [<ffffffff802b853d>] ? notify_change+0x186/0x2c9
 [<ffffffffa032d9de>] ? cachefiles_attr_changed+0x133/0x1cd [cachefiles]
 [<ffffffffa032df7f>] ? cachefiles_lookup_object+0xcf/0x12a [cachefiles]
 [<ffffffffa0318165>] ? fscache_lookup_object+0x110/0x122 [fscache]
 [<ffffffffa03188c3>] ? fscache_object_slow_work_execute+0x590/0x6bc
[fscache]
 [<ffffffff80278f82>] ? slow_work_thread+0x285/0x43a
 [<ffffffff8024a446>] ? autoremove_wake_function+0x0/0x2e
 [<ffffffff80278cfd>] ? slow_work_thread+0x0/0x43a
 [<ffffffff8024a317>] ? kthread+0x54/0x81
 [<ffffffff8020c93a>] ? child_rip+0xa/0x20
 [<ffffffff8024a2c3>] ? kthread+0x0/0x81
 [<ffffffff8020c930>] ? child_rip+0x0/0x20
CacheFiles: I/O Error: Readpage failed on backing file 200000000000810
FS-Cache: Cache cachefiles stopped due to I/O error

Reported-by: Christian Kujau <lists@nerdbynature.de>
Reported-by: Takashi Iwai <tiwai@suse.de>
Reported-by: Duc Le Minh <duclm.vn@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
fs/cachefiles/rdwr.c