fuse: postpone end_page_writeback() in fuse_writepage_locked()

commit 4a4ac4eba1010ef9a804569058ab29e3450c0315 upstream.

The patch fixes a race between ftruncate(2), mmap-ed write and write(2):

1) An user makes a page dirty via mmap-ed write.
2) The user performs shrinking truncate(2) intended to purge the page.
3) Before fuse_do_setattr calls truncate_pagecache, the page goes to
   writeback. fuse_writepage_locked fills FUSE_WRITE request and releases
   the original page by end_page_writeback.
4) fuse_do_setattr() completes and successfully returns. Since now, i_mutex
   is free.
5) Ordinary write(2) extends i_size back to cover the page. Note that
   fuse_send_write_pages do wait for fuse writeback, but for another
   page->index.
6) fuse_writepage_locked proceeds by queueing FUSE_WRITE request.
   fuse_send_writepage is supposed to crop inarg->size of the request,
   but it doesn't because i_size has already been extended back.

Moving end_page_writeback to the end of fuse_writepage_locked fixes the
race because now the fact that truncate_pagecache is successfully returned
infers that fuse_writepage_locked has already called end_page_writeback.
And this, in turn, infers that fuse_flush_writepages has already called
fuse_send_writepage, and the latter used valid (shrunk) i_size. write(2)
could not extend it because of i_mutex held by ftruncate(2).

Signed-off-by: Maxim Patlasov <mpatlasov@parallels.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fuse: invalidate inode attributes on xattr modification

commit d331a415aef98717393dda0be69b7947da08eba3 upstream.

Calls like setxattr and removexattr result in updation of ctime.
Therefore invalidate inode attributes to force a refresh.

Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Disable Dynamic Fsync

A quote from Gustavo:
Dynamic fsync disables fsync when screen is on, enables it when you turn screen off to flush all data to disk.
If your phone freeze or if you pull the battery while screen is on + fsync disabled, you will end up with corrupted data, and that can cause bootloops and etc.
fsync off -> boosts i/o speed but can corrupt your data
fsync on -> stability

Change-Id: I9fdf459bf46c5e8d39e9a1994b2e3449a3e555da
block: BFQ I/O scheduler v6r2 for linux 3.0.y
source: http://algo.ing.unimo.it/people/paolo/disk_sched/sources.php

Change-Id: I22d844bfcad3457d47f0cfa9936c6efa59f195c0
smdk4412: update fimc_capture and sr130pc20 cam driver

-updates are from i605 4.3 kernel source
-updates + small hack fixes front cam on kona

Change-Id: If8348be6dbef50bb322a60d554d177e046eec429

Conflicts:
	drivers/media/video/samsung/fimc/fimc_capture.c
	drivers/media/video/sr130pc20.c
	drivers/media/video/sr130pc20.h
Update i9100 config for BFQ IO Scheduler

Change-Id: Ia74118eea491e61a831386c4afb53632f68019bd
cpufreq: zzmoove v0.8 beta 8
thanks to zanezam, yank555 and andip71

Change-Id: I1416088e0d4a525f36fe898fe5c43a666e0abbe8
cpufreq: zzmoove: max cores = 2

Change-Id: I7c6d112b1490f7b7d3523980b8d1315e2a33c342
[CPUFREQ] Remove wall variable from cpufreq_gov_dbs_init()

CPUFREQ Remove wall variable from cpufreq_gov_dbs_init()

Remove wall variable from cpufreq_gov_dbs_init() as
get_cpu_idle_time_us() no longer updates the last_update_time
unconditionally. Passing non-NULL last_update_time address
will result in accounting additional idle time with
update_ts_time_stats() before returning idle_sleeptime.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Dave Jones <davej@redhat.com>
--
 drivers/cpufreq/cpufreq_ondemand.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Change-Id: Idb87183defc487ebe4454f839e938b305202433c