Skip to contentSkip to conversation

vfs pile 1

GIT PULL New Al Viro 1 participant 2 messages Sep 6, 2015 – Sep 9, 2015 VFS

lore
Share & tools
lore

Al Viro

author maintainer
#0 lore raw

In this one: d_move fixes (Eric), UFS fixes (me; locking is mostly sane
now, a bunch of bugs in error handling ought to be fixed), switch of sb_writers to percpu rwsem (Oleg), superblock scalability (Josef and Dave), swapon(2) race fix (Hugh). Please, pull from the usual place -
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus

Shortlog:
Al Viro (47):
ufs: kill more lock_ufs() calls
ufs: switch ufs_evict_inode() to trimmed-down variant of ufs_truncate()
ufs: free excessive blocks upon ->write_begin() failure/short copy
ufs: move truncate_setsize() down into ufs_truncate()
ufs: move lock_ufs() down into __ufs_truncate_blocks()
ufs: bforget() indirect blocks before freeing them
ufs: don't use lock_ufs() for block pointers tree protection
ufs: kill lock_ufs()
ufs: ufs_trunc_direct() always returns 0
ufs: ufs_trunc_...() has exclusion with everything that might cause allocations
ufs: no retries are needed on truncate
ufs: move truncate code into inode.c
ufs: the offsets ufs_block_to_path() puts into array are not sector_t
ufs: beginning of __ufs_truncate_block() massage ufs_trunc_tindirect(): pass the number of blocks to keep ufs_trunc_indirect(): pass the index of the first pointer to free ufs_trunc_dindirect(): pass the number of blocks to keep __ufs_truncate(); find cutoff distances into branches by offsets[] array ufs_trunc_...indirect(): pass the array of indices instead of offsets ufs_trunc_..indirect(): more massage towards unifying
unify ufs_trunc_..indirect()
__ufs_truncate_blocks(): unify freeing the full branches __ufs_trunc_blocks(): turn the part after switch into a loop ufs_trunc_branch(): never call with offsets != NULL && depth2 == 0 ufs_trunc_branch(): separate the calls with non-NULL offsets
ufs: unify the logics for collecting adjacent data blocks to free split ufs_truncate_branch() into full- and partial-branch variants ufs_trunc_branch(): massage towards killing recursion ufs_trunc_branch(): kill recursion
free_full_branch(): saner calling conventions
move marking inode dirty to the end of __ufs_truncate_blocks() free_full_branch(): don't bother modifying the block we are going to free __ufs_truncate_blocks(): avoid excessive dirtying of indirect blocks ufs_inode_get{frag,block}(): get rid of retries
ufs: move calculation of offsets into ufs_getfrag_block()
ufs: use the branch depth in ufs_getfrag_block() ufs_inode_get{frag,block}(): consolidate success exits ufs_getfrag_block(): get rid of macro jungles ufs_inode_get{frag,block}(): leave sb_getblk() to caller ufs_inode_getblock(): pass index instead of 'fragment' ufs_inode_getblock(): pass indirect block number and full index ufs_inode_getfrag(): split extending the partial blocks off ufs_inode_getfrag(): pass index instead of 'fragment' ufs_getfrag_block(): turn following indirects into a loop ufs_inode_getblock(): failure to read an indirect block is -EIO ufs_getfrag_block(): tidy up a bit
ufs_inode_get{frag,block}(): get rid of 'phys' argument

Dave Chinner (4):
writeback: plug writeback at a high level
inode: convert inode_sb_list_lock to per-sb
sync: serialise per-superblock sync operations
inode: rename i_wb_list to i_io_list

Eric W. Biederman (3):
dcache: Handle escaped paths in prepend_path
dcache: Reduce the scope of i_lock in d_splice_alias
vfs: Test for and handle paths that are unreachable from their mnt_root

Hugh Dickins (1):
mm: fix potential data race in SyS_swapon

Josef Bacik (2):
inode: add hlist_fake to avoid the inode hash lock in evict
inode: don't softlockup when evicting inodes

Oleg Nesterov (8):
introduce __sb_writers_{acquired,release}() helpers
fix the broken lockdep logic in __sb_start_write()
document rwsem_release() in sb_wait_write()
percpu-rwsem: introduce percpu_down_read_trylock()
percpu-rwsem: introduce percpu_rwsem_release() and percpu_rwsem_acquire()
percpu-rwsem: kill CONFIG_PERCPU_RWSEM
shift percpu_counter_destroy() into destroy_super_work() change sb_writers to use percpu_rw_semaphore

Diffstat:

 arch/Kconfig                     |   1 -
 fs/block_dev.c                   |  12 +-
 fs/btrfs/transaction.c           |   8 +-
 fs/dcache.c                      |  14 +-
 fs/drop_caches.c                 |  10 +-
 fs/fs-writeback.c                |  72 +--
 fs/inode.c                       |  50 ++-
 fs/internal.h                    |   3 +-
 fs/namei.c                       |  27 +-
 fs/notify/inode_mark.c           |  20 +-
 fs/quota/dquot.c                 |  16 +-
 fs/super.c                       | 175 ++++----
 fs/ufs/Makefile                  |   2 +-
 fs/ufs/balloc.c                  |   4 +
 fs/ufs/inode.c                   | 948 ++++++++++++++++++++++++++-------------
 fs/ufs/super.c                   |  36 +-
 fs/ufs/truncate.c                | 523 ---------------------
 fs/ufs/ufs.h                     |  13 +-
 fs/xfs/xfs_aops.c                |   6 +-
 include/linux/fs.h               |  33 +-
 include/linux/fsnotify_backend.h |   4 +-
 include/linux/list.h             |   5 +
 include/linux/percpu-rwsem.h     |  20 +
 init/Kconfig                     |   1 -
 kernel/locking/Makefile          |   3 +-
 kernel/locking/percpu-rwsem.c    |  13 +
 lib/Kconfig                      |   3 -
 mm/backing-dev.c                 |   8 +-
 mm/swapfile.c                    |  25 +-
 29 files changed, 936 insertions(+), 1119 deletions(-)
 delete mode 100644 fs/ufs/truncate.c
author maintainer
#1 lore raw

PATCH 1/1 fix ufs write vs. readpage race when writing into a hole

Followup to UFS series - with the way we clear the new blocks (via
buffer cache, possibly on more than a page worth of file) we really should not insert a reference to new block into inode block tree until after we'd cleared it.

---

fs/ufs/balloc.c +2 -2
index fb8b54e..dc5fae6 100644
@@ -417,14 +417,14 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
 	if (oldcount == 0) {
 		result = ufs_alloc_fragments (inode, cgno, goal, count, err);
 		if (result) {
+			ufs_clear_frags(inode, result + oldcount,
+					newcount - oldcount, locked_page != NULL);
 			write_seqlock(&UFS_I(inode)->meta_lock);
 			ufs_cpu_to_data_ptr(sb, p, result);
 			write_sequnlock(&UFS_I(inode)->meta_lock);
 			*err = 0;
 			UFS_I(inode)->i_lastfrag =
 				max(UFS_I(inode)->i_lastfrag, fragment + count);
-			ufs_clear_frags(inode, result + oldcount,
-					newcount - oldcount, locked_page != NULL);
 		}
 		mutex_unlock(&UFS_SB(sb)->s_lock);
 		UFSD("EXIT, result %llu\n", (unsigned long long)result);