linux-stable/fs/gfs2
Bob Peterson f6753df35c GFS2: rgrp free blocks used incorrectly
Before this patch, several functions in rgrp.c checked the value of
rgd->rd_free_clone. That does not take into account blocks that were
reserved by a multi-block reservation. This causes a problem when
space gets tight in the file system. For example, when function
gfs2_inplace_reserve checks to see if a rgrp has enough blocks to
satisfy the request, it can accept a rgrp that it should reject
because, although there are enough blocks to satisfy the request
_now_, those blocks may be reserved for another running process.

A second problem with this occurs when we've reserved the remaining
blocks in an rgrp: function rg_mblk_search() can reject an rgrp
improperly because it calculates:

   u32 free_blocks = rgd->rd_free_clone - rgd->rd_reserved;

But rd_reserved includes blocks that the current process just
reserved in its own call to inplace_reserve. For example, it can
reserve the last 128 blocks of an rgrp, then reject that same rgrp
because the above calculates out to free_blocks = 0;

Consequences include, but are not limited to, (1) leaving holes,
and thus increasing file system fragmentation, and (2) reporting
file system is full long before it actually is.

This patch introduces a new function, rgd_free, which returns the
number of clone-free blocks (blocks that are truly free as opposed
to blocks that are still being used because an unlinked file is
still open) minus the number of blocks reserved by processes, but
not counting the blocks we ourselves reserved (because obviously
we need to allocate them).

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
2018-07-25 00:09:09 +02:00
..
acl.c gfs2: using posix_acl_xattr_size instead of posix_acl_to_xattr 2018-07-24 20:02:11 +02:00
acl.h
aops.c gfs2: use iomap_readpage for blocksize == PAGE_SIZE 2018-07-25 00:08:49 +02:00
aops.h gfs2: iomap buffered write support 2018-07-02 16:27:17 +01:00
bmap.c Merge branch 'iomap-4.19-merge' into linux-gfs2/for-next 2018-07-25 00:08:20 +02:00
bmap.h gfs2: Iomap cleanups and improvements 2018-06-04 07:56:51 -05:00
dentry.c gfs2: Lock holder cleanup 2016-06-27 09:47:09 -05:00
dir.c gfs2: remove redundant variable 'moved' 2018-07-25 00:08:59 +02:00
dir.h
export.c gfs2: Get rid of gfs2_ilookup 2016-06-27 09:47:08 -05:00
file.c gfs2: Use iomap for stuffed direct I/O reads 2018-07-25 00:08:40 +02:00
gfs2.h
glock.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
glock.h gfs2: gfs2_evict_inode: Put glocks asynchronously 2017-08-10 10:45:21 -05:00
glops.c vfs: change inode times to use struct timespec64 2018-06-05 16:57:31 -07:00
glops.h
incore.h gfs2: Eliminate redundant ip->i_rgd 2018-07-05 17:47:16 +02:00
inode.c gfs2: Iomap cleanups and improvements 2018-06-04 07:56:51 -05:00
inode.h gfs2: Implement SEEK_HOLE / SEEK_DATA via iomap 2017-10-31 14:26:35 +01:00
Kconfig gfs2: Fix the crc32c dependency 2018-02-01 11:25:31 -07:00
lock_dlm.c GFS2: Fix recovery issues for spectators 2018-07-25 00:06:24 +02:00
log.c gfs2: call ktime_get_coarse_real_ts64() directly 2018-06-21 07:40:23 -05:00
log.h gfs2: Remove ordered write mode handling from gfs2_trans_add_data 2018-06-04 07:50:16 -05:00
lops.c gfs2: Don't withdraw under a spin lock 2018-06-21 07:39:44 -05:00
lops.h GFS2: Introduce new gfs2_log_header_v2 2018-01-23 07:38:53 -07:00
main.c gfs2: Fix wrong error handling in init_gfs2_fs() 2017-11-27 10:47:22 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
meta_io.c gfs2: Don't withdraw under a spin lock 2018-06-21 07:39:44 -05:00
meta_io.h
ops_fstype.c gfs2: Remove sdp->sd_jheightsize 2018-04-16 09:25:21 -07:00
quota.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
quota.h gfs2: Fix fallocate chunk size 2018-03-08 09:26:20 -07:00
recovery.c GFS2: Fix recovery issues for spectators 2018-07-25 00:06:24 +02:00
recovery.h GFS2: Fix gfs2_replay_incr_blk for multiple journal sizes 2016-07-21 13:02:44 -05:00
rgrp.c GFS2: rgrp free blocks used incorrectly 2018-07-25 00:09:09 +02:00
rgrp.h GFS2: Non-recursive delete 2017-04-19 08:25:43 -04:00
super.c Merge branch 'iomap-write' into linux-gfs2/for-next 2018-07-24 20:02:40 +02:00
super.h
sys.c GFS2: Fix recovery issues for spectators 2018-07-25 00:06:24 +02:00
sys.h
trace_gfs2.h gfs2: eliminate rs_inum and reduce the size of gfs2 inodes 2018-06-21 07:39:31 -05:00
trans.c gfs2: Remove ordered write mode handling from gfs2_trans_add_data 2018-06-04 07:50:16 -05:00
trans.h gfs2: Eliminate redundant ip->i_rgd 2018-07-05 17:47:16 +02:00
util.c gfs2: Don't withdraw under a spin lock 2018-06-21 07:39:44 -05:00
util.h gfs2: Don't withdraw under a spin lock 2018-06-21 07:39:44 -05:00
xattr.c gfs2: fix bogus __mark_inode_dirty(I_DIRTY_SYNC | I_DIRTY_DATASYNC) calls 2018-03-28 01:39:01 -04:00
xattr.h