Skip to content

Commit 5791577

Browse files
committed
Merge tag 'xfs-4.14-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull XFS updates from Darrick Wong: "Here are the changes for xfs for 4.14. Most of these are cleanups and fixes for bad behavior, as we're mostly focusing on improving reliablity this cycle (read: there's potentially a lot of stuff on the horizon for 4.15 so better to spend a few weeks killing other bugs now). Summary: - Write unmount record for a ro mount to avoid unnecessary log replay - Clean up orphaned inodes when mounting fs readonly - Resubmit inode log items when buffer writeback fails to avoid umount hang - Fix log recovery corruption problems when log headers wrap around the end - Avoid infinite loop searching for free inodes when inode counters are wrong - Evict inodes involved with log redo so that we don't leak them later - Fix a potential race between reclaim and inode cluster freeing - Refactor the inode joining code w.r.t. transaction rolling & deferred ops - Fix a bug where the log doesn't properly deal with dirty buffers that are about to become ordered buffers - Fix the extent swap code to deal with making dirty buffers ordered properly - Consolidate page fault handlers - Refactor the incore extent manipulation functions to use the iext abstractions instead of directly modifying with extent data - Disable crashy chattr +/-x until we fix it - Don't allow us to set S_DAX for v2 inodes - Various cleanups - Clarify some documentation - Fix a problem where fsync and a log commit race to send the disk a flush command, resulting in a small window where power fail data loss could occur - Simplify some rmap operations in the fcollapse code - Fix some use-after-free problems in async writeback" * tag 'xfs-4.14-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (44 commits) xfs: use kmem_free to free return value of kmem_zalloc xfs: open code end_buffer_async_write in xfs_finish_page_writeback xfs: don't set v3 xflags for v2 inodes xfs: fix compiler warnings fsmap: fix documentation of FMR_OF_LAST xfs: simplify the rmap code in xfs_bmse_merge xfs: remove unused flags arg from xfs_file_iomap_begin_delay xfs: fix incorrect log_flushed on fsync xfs: disable per-inode DAX flag xfs: replace xfs_qm_get_rtblks with a direct call to xfs_bmap_count_leaves xfs: rewrite xfs_bmap_count_leaves using xfs_iext_get_extent xfs: use xfs_iext_*_extent helpers in xfs_bmap_split_extent_at xfs: use xfs_iext_*_extent helpers in xfs_bmap_shift_extents xfs: move some code around inside xfs_bmap_shift_extents xfs: use xfs_iext_get_extent in xfs_bmap_first_unused xfs: switch xfs_bmap_local_to_extents to use xfs_iext_insert xfs: add a xfs_iext_update_extent helper xfs: consolidate the various page fault handlers iomap: return VM_FAULT_* codes from iomap_page_mkwrite xfs: relog dirty buffers during swapext bmbt owner change ...
2 parents 77d0ab6 + 6c37059 commit 5791577

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1027
-709
lines changed

fs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ void evict_inodes(struct super_block *sb)
637637

638638
dispose_list(&dispose);
639639
}
640+
EXPORT_SYMBOL_GPL(evict_inodes);
640641

641642
/**
642643
* invalidate_inodes - attempt to free all inodes on a superblock

fs/internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ static inline bool atime_needs_update_rcu(const struct path *path,
132132
extern void inode_io_list_del(struct inode *inode);
133133

134134
extern long get_nr_dirty_inodes(void);
135-
extern void evict_inodes(struct super_block *);
136135
extern int invalidate_inodes(struct super_block *, bool);
137136

138137
/*

fs/iomap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,10 +477,10 @@ int iomap_page_mkwrite(struct vm_fault *vmf, const struct iomap_ops *ops)
477477

478478
set_page_dirty(page);
479479
wait_for_stable_page(page);
480-
return 0;
480+
return VM_FAULT_LOCKED;
481481
out_unlock:
482482
unlock_page(page);
483-
return ret;
483+
return block_page_mkwrite_return(ret);
484484
}
485485
EXPORT_SYMBOL_GPL(iomap_page_mkwrite);
486486

fs/xfs/libxfs/xfs_attr.c

Lines changed: 81 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -328,20 +328,19 @@ xfs_attr_set(
328328
*/
329329
xfs_defer_init(args.dfops, args.firstblock);
330330
error = xfs_attr_shortform_to_leaf(&args);
331-
if (!error)
332-
error = xfs_defer_finish(&args.trans, args.dfops, dp);
333-
if (error) {
334-
args.trans = NULL;
335-
xfs_defer_cancel(&dfops);
336-
goto out;
337-
}
331+
if (error)
332+
goto out_defer_cancel;
333+
xfs_defer_ijoin(args.dfops, dp);
334+
error = xfs_defer_finish(&args.trans, args.dfops);
335+
if (error)
336+
goto out_defer_cancel;
338337

339338
/*
340339
* Commit the leaf transformation. We'll need another (linked)
341340
* transaction to add the new attribute to the leaf.
342341
*/
343342

344-
error = xfs_trans_roll(&args.trans, dp);
343+
error = xfs_trans_roll_inode(&args.trans, dp);
345344
if (error)
346345
goto out;
347346

@@ -373,6 +372,9 @@ xfs_attr_set(
373372

374373
return error;
375374

375+
out_defer_cancel:
376+
xfs_defer_cancel(&dfops);
377+
args.trans = NULL;
376378
out:
377379
if (args.trans)
378380
xfs_trans_cancel(args.trans);
@@ -593,19 +595,18 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
593595
*/
594596
xfs_defer_init(args->dfops, args->firstblock);
595597
error = xfs_attr3_leaf_to_node(args);
596-
if (!error)
597-
error = xfs_defer_finish(&args->trans, args->dfops, dp);
598-
if (error) {
599-
args->trans = NULL;
600-
xfs_defer_cancel(args->dfops);
601-
return error;
602-
}
598+
if (error)
599+
goto out_defer_cancel;
600+
xfs_defer_ijoin(args->dfops, dp);
601+
error = xfs_defer_finish(&args->trans, args->dfops);
602+
if (error)
603+
goto out_defer_cancel;
603604

604605
/*
605606
* Commit the current trans (including the inode) and start
606607
* a new one.
607608
*/
608-
error = xfs_trans_roll(&args->trans, dp);
609+
error = xfs_trans_roll_inode(&args->trans, dp);
609610
if (error)
610611
return error;
611612

@@ -620,7 +621,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
620621
* Commit the transaction that added the attr name so that
621622
* later routines can manage their own transactions.
622623
*/
623-
error = xfs_trans_roll(&args->trans, dp);
624+
error = xfs_trans_roll_inode(&args->trans, dp);
624625
if (error)
625626
return error;
626627

@@ -684,20 +685,18 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
684685
xfs_defer_init(args->dfops, args->firstblock);
685686
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
686687
/* bp is gone due to xfs_da_shrink_inode */
687-
if (!error)
688-
error = xfs_defer_finish(&args->trans,
689-
args->dfops, dp);
690-
if (error) {
691-
args->trans = NULL;
692-
xfs_defer_cancel(args->dfops);
693-
return error;
694-
}
688+
if (error)
689+
goto out_defer_cancel;
690+
xfs_defer_ijoin(args->dfops, dp);
691+
error = xfs_defer_finish(&args->trans, args->dfops);
692+
if (error)
693+
goto out_defer_cancel;
695694
}
696695

697696
/*
698697
* Commit the remove and start the next trans in series.
699698
*/
700-
error = xfs_trans_roll(&args->trans, dp);
699+
error = xfs_trans_roll_inode(&args->trans, dp);
701700

702701
} else if (args->rmtblkno > 0) {
703702
/*
@@ -706,6 +705,10 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
706705
error = xfs_attr3_leaf_clearflag(args);
707706
}
708707
return error;
708+
out_defer_cancel:
709+
xfs_defer_cancel(args->dfops);
710+
args->trans = NULL;
711+
return error;
709712
}
710713

711714
/*
@@ -747,15 +750,18 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
747750
xfs_defer_init(args->dfops, args->firstblock);
748751
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
749752
/* bp is gone due to xfs_da_shrink_inode */
750-
if (!error)
751-
error = xfs_defer_finish(&args->trans, args->dfops, dp);
752-
if (error) {
753-
args->trans = NULL;
754-
xfs_defer_cancel(args->dfops);
755-
return error;
756-
}
753+
if (error)
754+
goto out_defer_cancel;
755+
xfs_defer_ijoin(args->dfops, dp);
756+
error = xfs_defer_finish(&args->trans, args->dfops);
757+
if (error)
758+
goto out_defer_cancel;
757759
}
758760
return 0;
761+
out_defer_cancel:
762+
xfs_defer_cancel(args->dfops);
763+
args->trans = NULL;
764+
return error;
759765
}
760766

761767
/*
@@ -872,20 +878,18 @@ xfs_attr_node_addname(xfs_da_args_t *args)
872878
state = NULL;
873879
xfs_defer_init(args->dfops, args->firstblock);
874880
error = xfs_attr3_leaf_to_node(args);
875-
if (!error)
876-
error = xfs_defer_finish(&args->trans,
877-
args->dfops, dp);
878-
if (error) {
879-
args->trans = NULL;
880-
xfs_defer_cancel(args->dfops);
881-
goto out;
882-
}
881+
if (error)
882+
goto out_defer_cancel;
883+
xfs_defer_ijoin(args->dfops, dp);
884+
error = xfs_defer_finish(&args->trans, args->dfops);
885+
if (error)
886+
goto out_defer_cancel;
883887

884888
/*
885889
* Commit the node conversion and start the next
886890
* trans in the chain.
887891
*/
888-
error = xfs_trans_roll(&args->trans, dp);
892+
error = xfs_trans_roll_inode(&args->trans, dp);
889893
if (error)
890894
goto out;
891895

@@ -900,13 +904,12 @@ xfs_attr_node_addname(xfs_da_args_t *args)
900904
*/
901905
xfs_defer_init(args->dfops, args->firstblock);
902906
error = xfs_da3_split(state);
903-
if (!error)
904-
error = xfs_defer_finish(&args->trans, args->dfops, dp);
905-
if (error) {
906-
args->trans = NULL;
907-
xfs_defer_cancel(args->dfops);
908-
goto out;
909-
}
907+
if (error)
908+
goto out_defer_cancel;
909+
xfs_defer_ijoin(args->dfops, dp);
910+
error = xfs_defer_finish(&args->trans, args->dfops);
911+
if (error)
912+
goto out_defer_cancel;
910913
} else {
911914
/*
912915
* Addition succeeded, update Btree hashvals.
@@ -925,7 +928,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
925928
* Commit the leaf addition or btree split and start the next
926929
* trans in the chain.
927930
*/
928-
error = xfs_trans_roll(&args->trans, dp);
931+
error = xfs_trans_roll_inode(&args->trans, dp);
929932
if (error)
930933
goto out;
931934

@@ -999,20 +1002,18 @@ xfs_attr_node_addname(xfs_da_args_t *args)
9991002
if (retval && (state->path.active > 1)) {
10001003
xfs_defer_init(args->dfops, args->firstblock);
10011004
error = xfs_da3_join(state);
1002-
if (!error)
1003-
error = xfs_defer_finish(&args->trans,
1004-
args->dfops, dp);
1005-
if (error) {
1006-
args->trans = NULL;
1007-
xfs_defer_cancel(args->dfops);
1008-
goto out;
1009-
}
1005+
if (error)
1006+
goto out_defer_cancel;
1007+
xfs_defer_ijoin(args->dfops, dp);
1008+
error = xfs_defer_finish(&args->trans, args->dfops);
1009+
if (error)
1010+
goto out_defer_cancel;
10101011
}
10111012

10121013
/*
10131014
* Commit and start the next trans in the chain.
10141015
*/
1015-
error = xfs_trans_roll(&args->trans, dp);
1016+
error = xfs_trans_roll_inode(&args->trans, dp);
10161017
if (error)
10171018
goto out;
10181019

@@ -1032,6 +1033,10 @@ xfs_attr_node_addname(xfs_da_args_t *args)
10321033
if (error)
10331034
return error;
10341035
return retval;
1036+
out_defer_cancel:
1037+
xfs_defer_cancel(args->dfops);
1038+
args->trans = NULL;
1039+
goto out;
10351040
}
10361041

10371042
/*
@@ -1122,17 +1127,16 @@ xfs_attr_node_removename(xfs_da_args_t *args)
11221127
if (retval && (state->path.active > 1)) {
11231128
xfs_defer_init(args->dfops, args->firstblock);
11241129
error = xfs_da3_join(state);
1125-
if (!error)
1126-
error = xfs_defer_finish(&args->trans, args->dfops, dp);
1127-
if (error) {
1128-
args->trans = NULL;
1129-
xfs_defer_cancel(args->dfops);
1130-
goto out;
1131-
}
1130+
if (error)
1131+
goto out_defer_cancel;
1132+
xfs_defer_ijoin(args->dfops, dp);
1133+
error = xfs_defer_finish(&args->trans, args->dfops);
1134+
if (error)
1135+
goto out_defer_cancel;
11321136
/*
11331137
* Commit the Btree join operation and start a new trans.
11341138
*/
1135-
error = xfs_trans_roll(&args->trans, dp);
1139+
error = xfs_trans_roll_inode(&args->trans, dp);
11361140
if (error)
11371141
goto out;
11381142
}
@@ -1156,14 +1160,12 @@ xfs_attr_node_removename(xfs_da_args_t *args)
11561160
xfs_defer_init(args->dfops, args->firstblock);
11571161
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
11581162
/* bp is gone due to xfs_da_shrink_inode */
1159-
if (!error)
1160-
error = xfs_defer_finish(&args->trans,
1161-
args->dfops, dp);
1162-
if (error) {
1163-
args->trans = NULL;
1164-
xfs_defer_cancel(args->dfops);
1165-
goto out;
1166-
}
1163+
if (error)
1164+
goto out_defer_cancel;
1165+
xfs_defer_ijoin(args->dfops, dp);
1166+
error = xfs_defer_finish(&args->trans, args->dfops);
1167+
if (error)
1168+
goto out_defer_cancel;
11671169
} else
11681170
xfs_trans_brelse(args->trans, bp);
11691171
}
@@ -1172,6 +1174,10 @@ xfs_attr_node_removename(xfs_da_args_t *args)
11721174
out:
11731175
xfs_da_state_free(state);
11741176
return error;
1177+
out_defer_cancel:
1178+
xfs_defer_cancel(args->dfops);
1179+
args->trans = NULL;
1180+
goto out;
11751181
}
11761182

11771183
/*

fs/xfs/libxfs/xfs_attr_leaf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,7 +2608,7 @@ xfs_attr3_leaf_clearflag(
26082608
/*
26092609
* Commit the flag value change and start the next trans in series.
26102610
*/
2611-
return xfs_trans_roll(&args->trans, args->dp);
2611+
return xfs_trans_roll_inode(&args->trans, args->dp);
26122612
}
26132613

26142614
/*
@@ -2659,7 +2659,7 @@ xfs_attr3_leaf_setflag(
26592659
/*
26602660
* Commit the flag value change and start the next trans in series.
26612661
*/
2662-
return xfs_trans_roll(&args->trans, args->dp);
2662+
return xfs_trans_roll_inode(&args->trans, args->dp);
26632663
}
26642664

26652665
/*
@@ -2777,7 +2777,7 @@ xfs_attr3_leaf_flipflags(
27772777
/*
27782778
* Commit the flag value change and start the next trans in series.
27792779
*/
2780-
error = xfs_trans_roll(&args->trans, args->dp);
2780+
error = xfs_trans_roll_inode(&args->trans, args->dp);
27812781

27822782
return error;
27832783
}

0 commit comments

Comments
 (0)