From: Greg Kroah-Hartman Date: Tue, 24 Sep 2013 23:27:25 +0000 (-0700) Subject: 3.0-stable patches X-Git-Tag: v3.0.97~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f8b47f71ba6afb7c753f06eb9df0b34a1354e66c;p=thirdparty%2Fkernel%2Fstable-queue.git 3.0-stable patches added patches: fuse-invalidate-inode-attributes-on-xattr-modification.patch fuse-postpone-end_page_writeback-in-fuse_writepage_locked.patch mmc-tmio_mmc_dma-fix-pio-fallback-on-sdhi.patch --- diff --git a/queue-3.0/fuse-invalidate-inode-attributes-on-xattr-modification.patch b/queue-3.0/fuse-invalidate-inode-attributes-on-xattr-modification.patch new file mode 100644 index 00000000000..76c3e6f2d4f --- /dev/null +++ b/queue-3.0/fuse-invalidate-inode-attributes-on-xattr-modification.patch @@ -0,0 +1,41 @@ +From d331a415aef98717393dda0be69b7947da08eba3 Mon Sep 17 00:00:00 2001 +From: Anand Avati +Date: Tue, 20 Aug 2013 02:21:07 -0400 +Subject: fuse: invalidate inode attributes on xattr modification + +From: Anand Avati + +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 +Reviewed-by: Brian Foster +Signed-off-by: Miklos Szeredi +Signed-off-by: Greg Kroah-Hartman + +--- + fs/fuse/dir.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/fs/fuse/dir.c ++++ b/fs/fuse/dir.c +@@ -1439,6 +1439,8 @@ static int fuse_setxattr(struct dentry * + fc->no_setxattr = 1; + err = -EOPNOTSUPP; + } ++ if (!err) ++ fuse_invalidate_attr(inode); + return err; + } + +@@ -1568,6 +1570,8 @@ static int fuse_removexattr(struct dentr + fc->no_removexattr = 1; + err = -EOPNOTSUPP; + } ++ if (!err) ++ fuse_invalidate_attr(inode); + return err; + } + diff --git a/queue-3.0/fuse-postpone-end_page_writeback-in-fuse_writepage_locked.patch b/queue-3.0/fuse-postpone-end_page_writeback-in-fuse_writepage_locked.patch new file mode 100644 index 00000000000..af78df4c80c --- /dev/null +++ b/queue-3.0/fuse-postpone-end_page_writeback-in-fuse_writepage_locked.patch @@ -0,0 +1,59 @@ +From 4a4ac4eba1010ef9a804569058ab29e3450c0315 Mon Sep 17 00:00:00 2001 +From: Maxim Patlasov +Date: Mon, 12 Aug 2013 20:39:30 +0400 +Subject: fuse: postpone end_page_writeback() in fuse_writepage_locked() + +From: Maxim Patlasov + +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 +Signed-off-by: Miklos Szeredi +Signed-off-by: Greg Kroah-Hartman + +--- + fs/fuse/file.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/fs/fuse/file.c ++++ b/fs/fuse/file.c +@@ -1298,7 +1298,6 @@ static int fuse_writepage_locked(struct + + inc_bdi_stat(mapping->backing_dev_info, BDI_WRITEBACK); + inc_zone_page_state(tmp_page, NR_WRITEBACK_TEMP); +- end_page_writeback(page); + + spin_lock(&fc->lock); + list_add(&req->writepages_entry, &fi->writepages); +@@ -1306,6 +1305,8 @@ static int fuse_writepage_locked(struct + fuse_flush_writepages(inode); + spin_unlock(&fc->lock); + ++ end_page_writeback(page); ++ + return 0; + + err_free: diff --git a/queue-3.0/mmc-tmio_mmc_dma-fix-pio-fallback-on-sdhi.patch b/queue-3.0/mmc-tmio_mmc_dma-fix-pio-fallback-on-sdhi.patch new file mode 100644 index 00000000000..647f1f0a925 --- /dev/null +++ b/queue-3.0/mmc-tmio_mmc_dma-fix-pio-fallback-on-sdhi.patch @@ -0,0 +1,62 @@ +From f936f9b67b7f8c2eae01dd303a0e90bd777c4679 Mon Sep 17 00:00:00 2001 +From: Sergei Shtylyov +Date: Sat, 24 Aug 2013 23:38:15 -0400 +Subject: mmc: tmio_mmc_dma: fix PIO fallback on SDHI + +From: Sergei Shtylyov + +commit f936f9b67b7f8c2eae01dd303a0e90bd777c4679 upstream. + +I'm testing SH-Mobile SDHI driver in DMA mode with a new DMA controller using +'bonnie++' and getting DMA error after which the tmio_mmc_dma.c code falls back +to PIO but all commands time out after that. It turned out that the fallback +code calls tmio_mmc_enable_dma() with RX/TX channels already freed and pointers +to them cleared, so that the function bails out early instead of clearing the +DMA bit in the CTL_DMA_ENABLE register. The regression was introduced by commit +162f43e31c5a376ec16336e5d0ac973373d54c89 (mmc: tmio: fix a deadlock). +Moving tmio_mmc_enable_dma() calls to the top of the PIO fallback code in +tmio_mmc_start_dma_{rx|tx}() helps. + +Signed-off-by: Sergei Shtylyov +Acked-by: Guennadi Liakhovetski +Signed-off-by: Chris Ball +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/tmio_mmc_dma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/mmc/host/tmio_mmc_dma.c ++++ b/drivers/mmc/host/tmio_mmc_dma.c +@@ -88,6 +88,7 @@ static void tmio_mmc_start_dma_rx(struct + pio: + if (!desc) { + /* DMA failed, fall back to PIO */ ++ tmio_mmc_enable_dma(host, false); + if (ret >= 0) + ret = -EIO; + host->chan_rx = NULL; +@@ -100,7 +101,6 @@ pio: + } + dev_warn(&host->pdev->dev, + "DMA failed: %d, falling back to PIO\n", ret); +- tmio_mmc_enable_dma(host, false); + } + + dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d, sg[%d]\n", __func__, +@@ -169,6 +169,7 @@ static void tmio_mmc_start_dma_tx(struct + pio: + if (!desc) { + /* DMA failed, fall back to PIO */ ++ tmio_mmc_enable_dma(host, false); + if (ret >= 0) + ret = -EIO; + host->chan_tx = NULL; +@@ -181,7 +182,6 @@ pio: + } + dev_warn(&host->pdev->dev, + "DMA failed: %d, falling back to PIO\n", ret); +- tmio_mmc_enable_dma(host, false); + } + + dev_dbg(&host->pdev->dev, "%s(): desc %p, cookie %d\n", __func__, diff --git a/queue-3.0/series b/queue-3.0/series index 7ba42def87a..0c26d1c3fe4 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -23,3 +23,6 @@ ocfs2-fix-the-end-cluster-offset-of-fiemap.patch memcg-fix-multiple-large-threshold-notifications.patch mm-huge_memory.c-fix-potential-null-pointer-dereference.patch isofs-refuse-rw-mount-of-the-filesystem-instead-of-making-it-ro.patch +mmc-tmio_mmc_dma-fix-pio-fallback-on-sdhi.patch +fuse-postpone-end_page_writeback-in-fuse_writepage_locked.patch +fuse-invalidate-inode-attributes-on-xattr-modification.patch