mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: David Howells <dhowells@redhat.com>, alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 3.18 22/59] afs: Fix afs_kill_pages()
Date: Thu, 7 Dec 2017 15:51:28 +0000	[thread overview]
Message-ID: <20171207155116.6013-22-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171207155116.6013-1-alexander.levin@verizon.com>

From: David Howells <dhowells@redhat.com>

[ Upstream commit 7286a35e893176169b09715096a4aca557e2ccd2 ]

Fix afs_kill_pages() in two ways:

 (1) If a writeback has been partially flushed, then if we try and kill the
     pages it contains, some of them may no longer be undergoing writeback
     and end_page_writeback() will assert.

     Fix this by checking to see whether the page in question is actually
     undergoing writeback before ending that writeback.

 (2) The loop that scans for pages to kill doesn't increase the first page
     index, and so the loop may not terminate, but it will try to process
     the same pages over and over again.

     Fix this by increasing the first page index to one after the last page
     we processed.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 fs/afs/write.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/afs/write.c b/fs/afs/write.c
index 9f816624e212..c4817b2f6aa7 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -300,10 +300,14 @@ static void afs_kill_pages(struct afs_vnode *vnode, bool error,
 		ASSERTCMP(pv.nr, ==, count);
 
 		for (loop = 0; loop < count; loop++) {
-			ClearPageUptodate(pv.pages[loop]);
+			struct page *page = pv.pages[loop];
+			ClearPageUptodate(page);
 			if (error)
-				SetPageError(pv.pages[loop]);
-			end_page_writeback(pv.pages[loop]);
+				SetPageError(page);
+			if (PageWriteback(page))
+				end_page_writeback(page);
+			if (page->index >= first)
+				first = page->index + 1;
 		}
 
 		__pagevec_release(&pv);
-- 
2.11.0

  parent reply	other threads:[~2017-12-07 16:24 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 15:51 [PATCH AUTOSEL for 3.18 01/59] usb: phy: isp1301: Add OF device ID table alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 02/59] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 06/59] NFSD: fix nfsd_reset_versions for NFSv4 alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 03/59] net: bcmgenet: correct MIB access of UniMAC RUNT counters alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 05/59] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL) alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 04/59] net: bcmgenet: Power up the internal PHY before probing the MII alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 07/59] Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 08/59] net: wimax/i2400m: fix NULL-deref at probe alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 10/59] net: Resend IGMP memberships upon peer notification alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 09/59] dmaengine: Fix array index out of bounds warning in __get_unmap_pool() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 13/59] sched/deadline: Use deadline instead of period when calculating overflow alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 12/59] drm/radeon/si: add dpm quirk for Oland alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 14/59] drm/radeon: reinstate oland workaround for sclk alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 11/59] openrisc: fix issue handling 8 byte get_user calls alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 15/59] afs: Fix missing put_page() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 16/59] afs: Populate group ID from vnode status alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 17/59] afs: Adjust mode bits processing alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 20/59] afs: Populate and use client modification time alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 19/59] afs: Fix the maths in afs_fs_store_data() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 21/59] afs: Fix page leak in afs_write_begin() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 18/59] afs: Flush outstanding writes when an fd is closed alexander.levin
2017-12-07 15:51 ` alexander.levin [this message]
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 24/59] NFSv4.1 respect server's max size in CREATE_SESSION alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 25/59] btrfs: add missing memset while reading compressed inline extents alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 23/59] perf symbols: Fix symbols__fixup_end heuristic for corner cases alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 28/59] video: udlfb: Fix read EDID timeout alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 29/59] video: fbdev: au1200fb: Release some resources if a memory allocation fails alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 26/59] target: Use system workqueue for ALUA transitions alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 27/59] fbdev: controlfb: Add missing modes to fix out of bounds access alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 31/59] ASoC: cs42l56: Fix reset GPIO name in example DT binding alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 30/59] video: fbdev: au1200fb: Return an error code if a memory allocation fails alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 32/59] PCI/PME: Handle invalid data when reading Root Status alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 33/59] powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 34/59] powerpc/opal: Fix EBUSY bug in acquiring tokens alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 36/59] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 37/59] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 35/59] powerpc/ipic: Fix status get and status clear alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 39/59] target:fix condition return in core_pr_dump_initiator_port() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 41/59] arm-ccn: perf: Prevent module unload while PMU is in use alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 38/59] iscsi-target: fix memory leak in lio_target_tiqn_addtpg() alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 40/59] target/file: Do not return error for UNMAP if length is zero alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 45/59] thermal/drivers/step_wise: Fix temperature regulation misbehavior alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 42/59] mm: Handle 0 flags in _calc_vm_trans() macro alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 44/59] ppp: Destroy the mutex when cleanup alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 43/59] clk: tegra: Fix cclk_lp divisor register alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 47/59] bcache: explicitly destroy mutex while exiting alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 46/59] GFS2: Take inode off order_write list when setting jdata flag alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 49/59] xfs: fix log block underflow during recovery cycle verification alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 51/59] tty fix oops when rmmod 8250 alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 50/59] PCI: Detach driver before procfs & sysfs teardown on device remove alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 52/59] pinctrl: adi2: Fix Kconfig build problem alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 53/59] raid5: Set R5_Expanded on parity devices as well as data alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 54/59] scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 56/59] scsi: bfa: integer overflow in debugfs alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 55/59] ASoC: samsung: i2s: disable secondary DAI until it gets fixed alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 58/59] macvlan: Only deliver one copy of the frame to the macvlan interface alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 59/59] ath9k: fix tx99 potential info leak alexander.levin
2017-12-07 15:51 ` [PATCH AUTOSEL for 3.18 57/59] udf: Avoid overflow when session starts at large offset alexander.levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207155116.6013-22-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®