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
nexedi
linux
Commits
5b92ee72
Commit
5b92ee72
authored
Jan 03, 2008
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Fix lock ordering of the snapshot semaphore against the page lock
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
bd09835d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
fs/btrfs/file.c
fs/btrfs/file.c
+4
-2
No files found.
fs/btrfs/file.c
View file @
5b92ee72
...
...
@@ -251,7 +251,6 @@ static int noinline dirty_and_release_pages(struct btrfs_trans_handle *trans,
num_bytes
=
(
write_bytes
+
pos
-
start_pos
+
root
->
sectorsize
-
1
)
&
~
((
u64
)
root
->
sectorsize
-
1
);
down_read
(
&
BTRFS_I
(
inode
)
->
root
->
snap_sem
);
end_of_last_block
=
start_pos
+
num_bytes
-
1
;
lock_extent
(
em_tree
,
start_pos
,
end_of_last_block
,
GFP_NOFS
);
...
...
@@ -356,7 +355,6 @@ static int noinline dirty_and_release_pages(struct btrfs_trans_handle *trans,
mutex_unlock
(
&
root
->
fs_info
->
fs_mutex
);
unlock_extent
(
em_tree
,
start_pos
,
end_of_last_block
,
GFP_NOFS
);
free_extent_map
(
em
);
up_read
(
&
BTRFS_I
(
inode
)
->
root
->
snap_sem
);
return
err
;
}
...
...
@@ -726,6 +724,8 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
pages
=
kmalloc
(
nrptrs
*
sizeof
(
struct
page
*
),
GFP_KERNEL
);
down_read
(
&
BTRFS_I
(
inode
)
->
root
->
snap_sem
);
mutex_lock
(
&
inode
->
i_mutex
);
first_index
=
pos
>>
PAGE_CACHE_SHIFT
;
last_index
=
(
pos
+
count
)
>>
PAGE_CACHE_SHIFT
;
...
...
@@ -804,6 +804,8 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
}
out:
mutex_unlock
(
&
inode
->
i_mutex
);
up_read
(
&
BTRFS_I
(
inode
)
->
root
->
snap_sem
);
out_nolock:
kfree
(
pages
);
if
(
pinned
[
0
])
...
...
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