linux-stable/fs/fscache
David Howells 6bdded59c8 fscache: Clear outstanding writes when disabling a cookie
fscache_disable_cookie() needs to clear the outstanding writes on the
cookie it's disabling because they cannot be completed after.

Without this, fscache_nfs_open_file() gets stuck because it disables the
cookie when the file is opened for writing but can't uncache the pages till
afterwards - otherwise there's a race between the open routine and anyone
who already has it open R/O and is still reading from it.

Looking in /proc/pid/stack of the offending process shows:

[<ffffffffa0142883>] __fscache_wait_on_page_write+0x82/0x9b [fscache]
[<ffffffffa014336e>] __fscache_uncache_all_inode_pages+0x91/0xe1 [fscache]
[<ffffffffa01740fa>] nfs_fscache_open_file+0x59/0x9e [nfs]
[<ffffffffa01ccf41>] nfs4_file_open+0x17f/0x1b8 [nfsv4]
[<ffffffff8117350e>] do_dentry_open+0x16d/0x2b7
[<ffffffff811743ac>] vfs_open+0x5c/0x65
[<ffffffff81184185>] path_openat+0x785/0x8fb
[<ffffffff81184343>] do_filp_open+0x48/0x9e
[<ffffffff81174710>] do_sys_open+0x13b/0x1cb
[<ffffffff811747b9>] SyS_open+0x19/0x1b
[<ffffffff81001c44>] do_syscall_64+0x80/0x17a
[<ffffffff8165c2da>] return_from_SYSCALL_64+0x0/0x7a
[<ffffffffffffffff>] 0xffffffffffffffff

Reported-by: Jianhong Yin <jiyin@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-01-31 13:23:09 -05:00
..
cache.c fs/fscache: convert printk to pr_foo() 2014-06-04 16:53:51 -07:00
cookie.c fscache: Clear outstanding writes when disabling a cookie 2017-01-31 13:23:09 -05:00
fsdef.c FS-Cache: Provide the ability to enable/disable cookies 2013-09-27 18:40:25 +01:00
histogram.c drop redundant ->owner initializations 2016-05-29 19:08:00 -04:00
internal.h FS-Cache: The operation cancellation method needs calling in more places 2015-04-02 14:28:53 +01:00
Kconfig fscache: drop references to slow-work 2010-07-22 22:58:58 +02:00
main.c fs/fscache: make ctl_table static 2014-08-06 18:01:12 -07:00
Makefile FS-Cache: Allow the current state of all objects to be dumped 2009-11-19 18:11:04 +00:00
netfs.c FS-Cache: Initialise stores_lock in netfs cookie 2017-01-31 13:23:09 -05:00
object-list.c drop redundant ->owner initializations 2016-05-29 19:08:00 -04:00
object.c fscache: Clear outstanding writes when disabling a cookie 2017-01-31 13:23:09 -05:00
operation.c FS-Cache: Retain the netfs context in the retrieval op earlier 2015-04-02 14:28:53 +01:00
page.c FS-Cache: wake write waiter after invalidating writes 2016-06-01 10:29:09 +02:00
proc.c FS-Cache: Allow the current state of all objects to be dumped 2009-11-19 18:11:04 +00:00
stats.c drop redundant ->owner initializations 2016-05-29 19:08:00 -04:00