Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
a9bbe1cf
Commit
a9bbe1cf
authored
Apr 22, 2004
by
Russell Cattelan
Committed by
Christoph Hellwig
Apr 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFS] Fix for the xfs dir2 rebalance bug.
SGI Modid: xfs-linux:xfs-kern:170221a
parent
829eb1cc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
fs/xfs/xfs_dir2_node.c
fs/xfs/xfs_dir2_node.c
+23
-2
No files found.
fs/xfs/xfs_dir2_node.c
View file @
a9bbe1cf
/*
/*
* Copyright (c) 2000-200
2
Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-200
4
Silicon Graphics, Inc. All Rights Reserved.
*
*
* This program is free software; you can redistribute it and/or modify it
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* under the terms of version 2 of the GNU General Public License as
...
@@ -224,12 +224,21 @@ xfs_dir2_leafn_add(
...
@@ -224,12 +224,21 @@ xfs_dir2_leafn_add(
mp
=
dp
->
i_mount
;
mp
=
dp
->
i_mount
;
tp
=
args
->
trans
;
tp
=
args
->
trans
;
leaf
=
bp
->
data
;
leaf
=
bp
->
data
;
/*
* Quick check just to make sure we are not going to index
* into other peoples memory
*/
if
(
index
<
0
)
return
XFS_ERROR
(
EFSCORRUPTED
);
/*
/*
* If there are already the maximum number of leaf entries in
* If there are already the maximum number of leaf entries in
* the block, if there are no stale entries it won't fit.
* the block, if there are no stale entries it won't fit.
* Caller will do a split. If there are stale entries we'll do
* Caller will do a split. If there are stale entries we'll do
* a compact.
* a compact.
*/
*/
if
(
INT_GET
(
leaf
->
hdr
.
count
,
ARCH_CONVERT
)
==
XFS_DIR2_MAX_LEAF_ENTS
(
mp
))
{
if
(
INT_GET
(
leaf
->
hdr
.
count
,
ARCH_CONVERT
)
==
XFS_DIR2_MAX_LEAF_ENTS
(
mp
))
{
if
(
INT_ISZERO
(
leaf
->
hdr
.
stale
,
ARCH_CONVERT
))
if
(
INT_ISZERO
(
leaf
->
hdr
.
stale
,
ARCH_CONVERT
))
return
XFS_ERROR
(
ENOSPC
);
return
XFS_ERROR
(
ENOSPC
);
...
@@ -828,12 +837,24 @@ xfs_dir2_leafn_rebalance(
...
@@ -828,12 +837,24 @@ xfs_dir2_leafn_rebalance(
state
->
inleaf
=
!
swap
;
state
->
inleaf
=
!
swap
;
else
else
state
->
inleaf
=
state
->
inleaf
=
swap
^
(
args
->
hashval
<
INT_GET
(
leaf2
->
ents
[
0
].
hashval
,
ARCH_CONVERT
));
swap
^
(
blk1
->
index
<=
INT_GET
(
leaf1
->
hdr
.
count
,
ARCH_CONVERT
));
/*
/*
* Adjust the expected index for insertion.
* Adjust the expected index for insertion.
*/
*/
if
(
!
state
->
inleaf
)
if
(
!
state
->
inleaf
)
blk2
->
index
=
blk1
->
index
-
INT_GET
(
leaf1
->
hdr
.
count
,
ARCH_CONVERT
);
blk2
->
index
=
blk1
->
index
-
INT_GET
(
leaf1
->
hdr
.
count
,
ARCH_CONVERT
);
/*
* Finally sanity check just to make sure we are not returning a negative index
*/
if
(
blk2
->
index
<
0
)
{
state
->
inleaf
=
1
;
blk2
->
index
=
0
;
cmn_err
(
CE_ALERT
,
"xfs_dir2_leafn_rebalance: picked the wrong leaf? reverting orignal leaf: "
"blk1->index %d
\n
"
,
blk1
->
index
);
}
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment