All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Andreas Gruenbacher <agruenba@redhat.com>,
	Bob Peterson <rpeterso@redhat.com>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 4.4 05/70] gfs2: Special-case rindex for gfs2_grow
Date: Mon, 24 Sep 2018 13:52:04 +0200	[thread overview]
Message-ID: <20180924113058.997615561@linuxfoundation.org> (raw)
In-Reply-To: <20180924113058.420454070@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andreas Gruenbacher <agruenba@redhat.com>

[ Upstream commit 776125785a87ff05d49938bd5b9f336f2a05bff6 ]

To speed up the common case of appending to a file,
gfs2_write_alloc_required presumes that writing beyond the end of a file
will always require additional blocks to be allocated.  This assumption
is incorrect for preallocates files, but there are no negative
consequences as long as *some* space is still left on the filesystem.

One special file that always has some space preallocated beyond the end
of the file is the rindex: when growing a filesystem, gfs2_grow adds one
or more new resource groups and appends records describing those
resource groups to the rindex; the preallocated space ensures that this
is always possible.

However, when a filesystem is completely full, gfs2_write_alloc_required
will indicate that an additional allocation is required, and appending
the next record to the rindex will fail even though space for that
record has already been preallocated.  To fix that, skip the incorrect
optimization in gfs2_write_alloc_required, but for the rindex only.
Other writes to preallocated space beyond the end of the file are still
allowed to fail on completely full filesystems.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/gfs2/bmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1476,7 +1476,7 @@ int gfs2_write_alloc_required(struct gfs
 	end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift;
 	lblock = offset >> shift;
 	lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
-	if (lblock_stop > end_of_file)
+	if (lblock_stop > end_of_file && ip != GFS2_I(sdp->sd_rindex))
 		return 1;
 
 	size = (lblock_stop - lblock) << shift;



  parent reply	other threads:[~2018-09-24 11:55 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 11:51 [PATCH 4.4 00/70] 4.4.158-stable review Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 01/70] iommu/arm-smmu-v3: sync the OVACKFLG to PRIQ consumer register Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 02/70] ALSA: msnd: Fix the default sample sizes Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 03/70] ALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 04/70] xfrm: fix passing zero to ERR_PTR() warning Greg Kroah-Hartman
2018-09-24 11:52 ` Greg Kroah-Hartman [this message]
2018-09-24 11:52 ` [PATCH 4.4 06/70] clk: imx6ul: fix missing of_node_put() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 07/70] kbuild: add .DELETE_ON_ERROR special target Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 08/70] dmaengine: pl330: fix irq race with terminate_all Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 09/70] MIPS: ath79: fix system restart Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 10/70] media: videobuf2-core: check for q->error in vb2_core_qbuf() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 11/70] mtd/maps: fix solutionengine.c printk format warnings Greg Kroah-Hartman
2018-09-24 11:52   ` Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 12/70] fbdev: omapfb: off by one in omapfb_register_client() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 13/70] video: goldfishfb: fix memory leak on driver remove Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 14/70] fbdev/via: fix defined but not used warning Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 15/70] perf powerpc: Fix callchain ip filtering when return address is in a register Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 16/70] fbdev: Distinguish between interlaced and progressive modes Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 17/70] ARM: exynos: Clear global variable on init error path Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 18/70] perf powerpc: Fix callchain ip filtering Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 19/70] powerpc/powernv: opal_put_chars partial write fix Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 20/70] MIPS: jz4740: Bump zload address Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 21/70] mac80211: restrict delayed tailroom needed decrement Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 22/70] xen-netfront: fix queue name setting Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 23/70] arm64: dts: qcom: db410c: Fix Bluetooth LED trigger Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 24/70] s390/qeth: fix race in used-buffer accounting Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 25/70] s390/qeth: reset layer2 attribute on layer switch Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 26/70] platform/x86: toshiba_acpi: Fix defined but not used build warnings Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 27/70] crypto: sharah - Unregister correct algorithms for SAHARA 3 Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 28/70] xen-netfront: fix warn message as irq device name has / Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 29/70] RDMA/cma: Protect cma dev list with lock Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 30/70] pstore: Fix incorrect persistent ram buffer mapping Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 31/70] xen/netfront: fix waiting for xenbus state change Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 32/70] IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 33/70] Tools: hv: Fix a bug in the key delete code Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 34/70] misc: hmc6352: fix potential Spectre v1 Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 35/70] usb: Dont die twice if PCI xhci host is not responding in resume Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 36/70] USB: Add quirk to support DJI CineSSD Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 37/70] usb: Avoid use-after-free by flushing endpoints early in usb_set_interface() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 38/70] usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 39/70] USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 40/70] USB: net2280: Fix erroneous synchronization change Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 41/70] USB: serial: io_ti: fix array underflow in completion handler Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 42/70] usb: misc: uss720: Fix two sleep-in-atomic-context bugs Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 43/70] USB: yurex: Fix buffer over-read in yurex_write() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 44/70] usb: cdc-wdm: Fix a sleep-in-atomic-context bug in service_outstanding_interrupt() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 45/70] cifs: prevent integer overflow in nxt_dir_entry() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 46/70] CIFS: fix wrapping bugs in num_entries() Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 47/70] binfmt_elf: Respect error return from `regset->active Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 48/70] audit: fix use-after-free in audit_add_watch Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 49/70] mtdchar: fix overflows in adjustment of `count` Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 50/70] MIPS: loongson64: cs5536: Fix PCI_OHCI_INT_REG reads Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 51/70] ARM: hisi: handle of_iomap and fix missing of_node_put Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 52/70] ARM: hisi: fix error handling and " Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 53/70] ARM: hisi: check of_iomap and fix " Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 54/70] drm/nouveau: tegra: Detach from ARM DMA/IOMMU mapping Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 55/70] parport: sunbpp: fix error return code Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 56/70] coresight: Handle errors in finding input/output ports Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 57/70] coresight: tpiu: Fix disabling timeouts Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 58/70] gpiolib: Mark gpio_suffixes array with __maybe_unused Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 59/70] drm/amdkfd: Fix error codes in kfd_get_process Greg Kroah-Hartman
2018-09-24 11:52 ` [PATCH 4.4 60/70] rtc: bq4802: add error handling for devm_ioremap Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 61/70] ALSA: pcm: Fix snd_interval_refine first/last with open min/max Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 62/70] selftest: timers: Tweak raw_skew to SKIP when ADJ_OFFSET/other clock adjustments are in progress Greg Kroah-Hartman
2018-09-24 11:53   ` Greg Kroah-Hartman
2018-09-24 11:53   ` gregkh
2018-09-24 11:53 ` [PATCH 4.4 63/70] drm/panel: type promotion bug in s6e8aa0_read_mtp_id() Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 64/70] IB/nes: Fix a compiler warning Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 65/70] pinctrl: qcom: spmi-gpio: Fix pmic_gpio_config_get() to be compliant Greg Kroah-Hartman
2018-09-24 11:53   ` Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 66/70] USB: serial: ti_usb_3410_5052: fix array underflow in completion handler Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 67/70] mei: bus: type promotion bug in mei_nfc_if_version() Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 68/70] drivers: net: cpsw: fix segfault in case of bad phy-handle Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 69/70] MIPS: VDSO: Match data page cache colouring when D$ aliases Greg Kroah-Hartman
2018-09-24 11:53 ` [PATCH 4.4 70/70] MIPS: VDSO: Drop gic_get_usm_range() usage Greg Kroah-Hartman
2018-09-24 18:06 ` [PATCH 4.4 00/70] 4.4.158-stable review Nathan Chancellor
2018-09-24 21:06 ` Dan Rue
2018-09-24 22:15 ` Shuah Khan
2018-09-25  9:14   ` Greg Kroah-Hartman
2018-09-25  9:08 ` Greg Kroah-Hartman
2018-09-25 20:41 ` Guenter Roeck

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=20180924113058.997615561@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=agruenba@redhat.com \
    --cc=alexander.levin@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpeterso@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.