Skip to content

Commit 7fdec82

Browse files
committed
Merge tag 'xfs-for-linus-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs
Pull xfs updates from Dave Chinner: "There's not a lot in this - the main addition is the CRC validation of the entire region of the log that the will be recovered, along with several log recovery fixes. Most of the rest is small bug fixes and cleanups. I have three bug fixes still pending, all that address recently fixed regressions that I will send to next week after they've had some time in for-next. Summary: - extensive CRC validation during log recovery - several log recovery bug fixes - Various DAX support fixes - AGFL size calculation fix - various cleanups in preparation for new functionality - project quota ENOSPC notification via netlink - tracing and debug improvements" * tag 'xfs-for-linus-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs: (26 commits) xfs: handle dquot buffer readahead in log recovery correctly xfs: inode recovery readahead can race with inode buffer creation xfs: eliminate committed arg from xfs_bmap_finish xfs: bmapbt checking on debug kernels too expensive xfs: add tracepoints to readpage calls xfs: debug mode log record crc error injection xfs: detect and trim torn writes during log recovery xfs: fix recursive splice read locking with DAX xfs: Don't use reserved blocks for data blocks with DAX XFS: Use a signed return type for suffix_kstrtoint() libxfs: refactor short btree block verification libxfs: pack the agfl header structure so XFS_AGFL_SIZE is correct libxfs: use a convenience variable instead of open-coding the fork xfs: fix log ticket type printing libxfs: make xfs_alloc_fix_freelist non-static xfs: make xfs_buf_ioend_async() static xfs: send warning of project quota to userspace via netlink xfs: get mp from bma->ip in xfs_bmap code xfs: print name of verifier if it fails libxfs: Optimize the loop for xfs_bitmap_empty ...
2 parents f9a03ae + dde7f55 commit 7fdec82

Some content is hidden

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

45 files changed

+852
-443
lines changed

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ xfs_agfl_write_verify(
535535
}
536536

537537
const struct xfs_buf_ops xfs_agfl_buf_ops = {
538+
.name = "xfs_agfl",
538539
.verify_read = xfs_agfl_read_verify,
539540
.verify_write = xfs_agfl_write_verify,
540541
};
@@ -1926,7 +1927,7 @@ xfs_alloc_space_available(
19261927
* Decide whether to use this allocation group for this allocation.
19271928
* If so, fix up the btree freelist's size.
19281929
*/
1929-
STATIC int /* error */
1930+
int /* error */
19301931
xfs_alloc_fix_freelist(
19311932
struct xfs_alloc_arg *args, /* allocation argument structure */
19321933
int flags) /* XFS_ALLOC_FLAG_... */
@@ -2339,6 +2340,7 @@ xfs_agf_write_verify(
23392340
}
23402341

23412342
const struct xfs_buf_ops xfs_agf_buf_ops = {
2343+
.name = "xfs_agf",
23422344
.verify_read = xfs_agf_read_verify,
23432345
.verify_write = xfs_agf_write_verify,
23442346
};

fs/xfs/libxfs/xfs_alloc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,5 +235,6 @@ xfs_alloc_get_rec(
235235

236236
int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
237237
xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
238+
int xfs_alloc_fix_freelist(struct xfs_alloc_arg *args, int flags);
238239

239240
#endif /* __XFS_ALLOC_H__ */

fs/xfs/libxfs/xfs_alloc_btree.c

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,7 @@ xfs_allocbt_verify(
293293
level = be16_to_cpu(block->bb_level);
294294
switch (block->bb_magic) {
295295
case cpu_to_be32(XFS_ABTB_CRC_MAGIC):
296-
if (!xfs_sb_version_hascrc(&mp->m_sb))
297-
return false;
298-
if (!uuid_equal(&block->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid))
299-
return false;
300-
if (block->bb_u.s.bb_blkno != cpu_to_be64(bp->b_bn))
301-
return false;
302-
if (pag &&
303-
be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)
296+
if (!xfs_btree_sblock_v5hdr_verify(bp))
304297
return false;
305298
/* fall through */
306299
case cpu_to_be32(XFS_ABTB_MAGIC):
@@ -311,14 +304,7 @@ xfs_allocbt_verify(
311304
return false;
312305
break;
313306
case cpu_to_be32(XFS_ABTC_CRC_MAGIC):
314-
if (!xfs_sb_version_hascrc(&mp->m_sb))
315-
return false;
316-
if (!uuid_equal(&block->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid))
317-
return false;
318-
if (block->bb_u.s.bb_blkno != cpu_to_be64(bp->b_bn))
319-
return false;
320-
if (pag &&
321-
be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)
307+
if (!xfs_btree_sblock_v5hdr_verify(bp))
322308
return false;
323309
/* fall through */
324310
case cpu_to_be32(XFS_ABTC_MAGIC):
@@ -332,21 +318,7 @@ xfs_allocbt_verify(
332318
return false;
333319
}
334320

335-
/* numrecs verification */
336-
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[level != 0])
337-
return false;
338-
339-
/* sibling pointer verification */
340-
if (!block->bb_u.s.bb_leftsib ||
341-
(be32_to_cpu(block->bb_u.s.bb_leftsib) >= mp->m_sb.sb_agblocks &&
342-
block->bb_u.s.bb_leftsib != cpu_to_be32(NULLAGBLOCK)))
343-
return false;
344-
if (!block->bb_u.s.bb_rightsib ||
345-
(be32_to_cpu(block->bb_u.s.bb_rightsib) >= mp->m_sb.sb_agblocks &&
346-
block->bb_u.s.bb_rightsib != cpu_to_be32(NULLAGBLOCK)))
347-
return false;
348-
349-
return true;
321+
return xfs_btree_sblock_verify(bp, mp->m_alloc_mxr[level != 0]);
350322
}
351323

352324
static void
@@ -379,6 +351,7 @@ xfs_allocbt_write_verify(
379351
}
380352

381353
const struct xfs_buf_ops xfs_allocbt_buf_ops = {
354+
.name = "xfs_allocbt",
382355
.verify_read = xfs_allocbt_read_verify,
383356
.verify_write = xfs_allocbt_write_verify,
384357
};

fs/xfs/libxfs/xfs_attr.c

Lines changed: 23 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ xfs_attr_set(
207207
struct xfs_trans_res tres;
208208
xfs_fsblock_t firstblock;
209209
int rsvd = (flags & ATTR_ROOT) != 0;
210-
int error, err2, committed, local;
210+
int error, err2, local;
211211

212212
XFS_STATS_INC(mp, xs_attr_set);
213213

@@ -334,24 +334,14 @@ xfs_attr_set(
334334
*/
335335
xfs_bmap_init(args.flist, args.firstblock);
336336
error = xfs_attr_shortform_to_leaf(&args);
337-
if (!error) {
338-
error = xfs_bmap_finish(&args.trans, args.flist,
339-
&committed);
340-
}
337+
if (!error)
338+
error = xfs_bmap_finish(&args.trans, args.flist, dp);
341339
if (error) {
342-
ASSERT(committed);
343340
args.trans = NULL;
344341
xfs_bmap_cancel(&flist);
345342
goto out;
346343
}
347344

348-
/*
349-
* bmap_finish() may have committed the last trans and started
350-
* a new one. We need the inode to be in all transactions.
351-
*/
352-
if (committed)
353-
xfs_trans_ijoin(args.trans, dp, 0);
354-
355345
/*
356346
* Commit the leaf transformation. We'll need another (linked)
357347
* transaction to add the new attribute to the leaf.
@@ -568,7 +558,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
568558
{
569559
xfs_inode_t *dp;
570560
struct xfs_buf *bp;
571-
int retval, error, committed, forkoff;
561+
int retval, error, forkoff;
572562

573563
trace_xfs_attr_leaf_addname(args);
574564

@@ -628,24 +618,14 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
628618
*/
629619
xfs_bmap_init(args->flist, args->firstblock);
630620
error = xfs_attr3_leaf_to_node(args);
631-
if (!error) {
632-
error = xfs_bmap_finish(&args->trans, args->flist,
633-
&committed);
634-
}
621+
if (!error)
622+
error = xfs_bmap_finish(&args->trans, args->flist, dp);
635623
if (error) {
636-
ASSERT(committed);
637624
args->trans = NULL;
638625
xfs_bmap_cancel(args->flist);
639626
return error;
640627
}
641628

642-
/*
643-
* bmap_finish() may have committed the last trans and started
644-
* a new one. We need the inode to be in all transactions.
645-
*/
646-
if (committed)
647-
xfs_trans_ijoin(args->trans, dp, 0);
648-
649629
/*
650630
* Commit the current trans (including the inode) and start
651631
* a new one.
@@ -729,25 +709,14 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
729709
xfs_bmap_init(args->flist, args->firstblock);
730710
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
731711
/* bp is gone due to xfs_da_shrink_inode */
732-
if (!error) {
712+
if (!error)
733713
error = xfs_bmap_finish(&args->trans,
734-
args->flist,
735-
&committed);
736-
}
714+
args->flist, dp);
737715
if (error) {
738-
ASSERT(committed);
739716
args->trans = NULL;
740717
xfs_bmap_cancel(args->flist);
741718
return error;
742719
}
743-
744-
/*
745-
* bmap_finish() may have committed the last trans
746-
* and started a new one. We need the inode to be
747-
* in all transactions.
748-
*/
749-
if (committed)
750-
xfs_trans_ijoin(args->trans, dp, 0);
751720
}
752721

753722
/*
@@ -775,7 +744,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
775744
{
776745
xfs_inode_t *dp;
777746
struct xfs_buf *bp;
778-
int error, committed, forkoff;
747+
int error, forkoff;
779748

780749
trace_xfs_attr_leaf_removename(args);
781750

@@ -803,23 +772,13 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
803772
xfs_bmap_init(args->flist, args->firstblock);
804773
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
805774
/* bp is gone due to xfs_da_shrink_inode */
806-
if (!error) {
807-
error = xfs_bmap_finish(&args->trans, args->flist,
808-
&committed);
809-
}
775+
if (!error)
776+
error = xfs_bmap_finish(&args->trans, args->flist, dp);
810777
if (error) {
811-
ASSERT(committed);
812778
args->trans = NULL;
813779
xfs_bmap_cancel(args->flist);
814780
return error;
815781
}
816-
817-
/*
818-
* bmap_finish() may have committed the last trans and started
819-
* a new one. We need the inode to be in all transactions.
820-
*/
821-
if (committed)
822-
xfs_trans_ijoin(args->trans, dp, 0);
823782
}
824783
return 0;
825784
}
@@ -877,7 +836,7 @@ xfs_attr_node_addname(xfs_da_args_t *args)
877836
xfs_da_state_blk_t *blk;
878837
xfs_inode_t *dp;
879838
xfs_mount_t *mp;
880-
int committed, retval, error;
839+
int retval, error;
881840

882841
trace_xfs_attr_node_addname(args);
883842

@@ -938,26 +897,15 @@ xfs_attr_node_addname(xfs_da_args_t *args)
938897
state = NULL;
939898
xfs_bmap_init(args->flist, args->firstblock);
940899
error = xfs_attr3_leaf_to_node(args);
941-
if (!error) {
900+
if (!error)
942901
error = xfs_bmap_finish(&args->trans,
943-
args->flist,
944-
&committed);
945-
}
902+
args->flist, dp);
946903
if (error) {
947-
ASSERT(committed);
948904
args->trans = NULL;
949905
xfs_bmap_cancel(args->flist);
950906
goto out;
951907
}
952908

953-
/*
954-
* bmap_finish() may have committed the last trans
955-
* and started a new one. We need the inode to be
956-
* in all transactions.
957-
*/
958-
if (committed)
959-
xfs_trans_ijoin(args->trans, dp, 0);
960-
961909
/*
962910
* Commit the node conversion and start the next
963911
* trans in the chain.
@@ -977,23 +925,13 @@ xfs_attr_node_addname(xfs_da_args_t *args)
977925
*/
978926
xfs_bmap_init(args->flist, args->firstblock);
979927
error = xfs_da3_split(state);
980-
if (!error) {
981-
error = xfs_bmap_finish(&args->trans, args->flist,
982-
&committed);
983-
}
928+
if (!error)
929+
error = xfs_bmap_finish(&args->trans, args->flist, dp);
984930
if (error) {
985-
ASSERT(committed);
986931
args->trans = NULL;
987932
xfs_bmap_cancel(args->flist);
988933
goto out;
989934
}
990-
991-
/*
992-
* bmap_finish() may have committed the last trans and started
993-
* a new one. We need the inode to be in all transactions.
994-
*/
995-
if (committed)
996-
xfs_trans_ijoin(args->trans, dp, 0);
997935
} else {
998936
/*
999937
* Addition succeeded, update Btree hashvals.
@@ -1086,25 +1024,14 @@ xfs_attr_node_addname(xfs_da_args_t *args)
10861024
if (retval && (state->path.active > 1)) {
10871025
xfs_bmap_init(args->flist, args->firstblock);
10881026
error = xfs_da3_join(state);
1089-
if (!error) {
1027+
if (!error)
10901028
error = xfs_bmap_finish(&args->trans,
1091-
args->flist,
1092-
&committed);
1093-
}
1029+
args->flist, dp);
10941030
if (error) {
1095-
ASSERT(committed);
10961031
args->trans = NULL;
10971032
xfs_bmap_cancel(args->flist);
10981033
goto out;
10991034
}
1100-
1101-
/*
1102-
* bmap_finish() may have committed the last trans
1103-
* and started a new one. We need the inode to be
1104-
* in all transactions.
1105-
*/
1106-
if (committed)
1107-
xfs_trans_ijoin(args->trans, dp, 0);
11081035
}
11091036

11101037
/*
@@ -1146,7 +1073,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
11461073
xfs_da_state_blk_t *blk;
11471074
xfs_inode_t *dp;
11481075
struct xfs_buf *bp;
1149-
int retval, error, committed, forkoff;
1076+
int retval, error, forkoff;
11501077

11511078
trace_xfs_attr_node_removename(args);
11521079

@@ -1220,24 +1147,13 @@ xfs_attr_node_removename(xfs_da_args_t *args)
12201147
if (retval && (state->path.active > 1)) {
12211148
xfs_bmap_init(args->flist, args->firstblock);
12221149
error = xfs_da3_join(state);
1223-
if (!error) {
1224-
error = xfs_bmap_finish(&args->trans, args->flist,
1225-
&committed);
1226-
}
1150+
if (!error)
1151+
error = xfs_bmap_finish(&args->trans, args->flist, dp);
12271152
if (error) {
1228-
ASSERT(committed);
12291153
args->trans = NULL;
12301154
xfs_bmap_cancel(args->flist);
12311155
goto out;
12321156
}
1233-
1234-
/*
1235-
* bmap_finish() may have committed the last trans and started
1236-
* a new one. We need the inode to be in all transactions.
1237-
*/
1238-
if (committed)
1239-
xfs_trans_ijoin(args->trans, dp, 0);
1240-
12411157
/*
12421158
* Commit the Btree join operation and start a new trans.
12431159
*/
@@ -1265,25 +1181,14 @@ xfs_attr_node_removename(xfs_da_args_t *args)
12651181
xfs_bmap_init(args->flist, args->firstblock);
12661182
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
12671183
/* bp is gone due to xfs_da_shrink_inode */
1268-
if (!error) {
1184+
if (!error)
12691185
error = xfs_bmap_finish(&args->trans,
1270-
args->flist,
1271-
&committed);
1272-
}
1186+
args->flist, dp);
12731187
if (error) {
1274-
ASSERT(committed);
12751188
args->trans = NULL;
12761189
xfs_bmap_cancel(args->flist);
12771190
goto out;
12781191
}
1279-
1280-
/*
1281-
* bmap_finish() may have committed the last trans
1282-
* and started a new one. We need the inode to be
1283-
* in all transactions.
1284-
*/
1285-
if (committed)
1286-
xfs_trans_ijoin(args->trans, dp, 0);
12871192
} else
12881193
xfs_trans_brelse(args->trans, bp);
12891194
}

fs/xfs/libxfs/xfs_attr_leaf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ xfs_attr3_leaf_read_verify(
328328
}
329329

330330
const struct xfs_buf_ops xfs_attr3_leaf_buf_ops = {
331+
.name = "xfs_attr3_leaf",
331332
.verify_read = xfs_attr3_leaf_read_verify,
332333
.verify_write = xfs_attr3_leaf_write_verify,
333334
};

0 commit comments

Comments
 (0)