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
e83a5d51
Commit
e83a5d51
authored
Jul 07, 2004
by
Dave Kleikamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JFS: Protect active_ag with a spinlock
Signed-off-by:
Dave Kleikamp
<
shaggy@austin.ibm.com
>
parent
5f32f3d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
0 deletions
+11
-0
fs/jfs/file.c
fs/jfs/file.c
+4
-0
fs/jfs/jfs_extent.c
fs/jfs/jfs_extent.c
+2
-0
fs/jfs/jfs_incore.h
fs/jfs/jfs_incore.h
+1
-0
fs/jfs/super.c
fs/jfs/super.c
+4
-0
No files found.
fs/jfs/file.c
View file @
e83a5d51
...
@@ -65,11 +65,13 @@ static int jfs_open(struct inode *inode, struct file *file)
...
@@ -65,11 +65,13 @@ static int jfs_open(struct inode *inode, struct file *file)
if
(
S_ISREG
(
inode
->
i_mode
)
&&
file
->
f_mode
&
FMODE_WRITE
&&
if
(
S_ISREG
(
inode
->
i_mode
)
&&
file
->
f_mode
&
FMODE_WRITE
&&
(
inode
->
i_size
==
0
))
{
(
inode
->
i_size
==
0
))
{
struct
jfs_inode_info
*
ji
=
JFS_IP
(
inode
);
struct
jfs_inode_info
*
ji
=
JFS_IP
(
inode
);
spin_lock_irq
(
&
ji
->
ag_lock
);
if
(
ji
->
active_ag
==
-
1
)
{
if
(
ji
->
active_ag
==
-
1
)
{
ji
->
active_ag
=
ji
->
agno
;
ji
->
active_ag
=
ji
->
agno
;
atomic_inc
(
atomic_inc
(
&
JFS_SBI
(
inode
->
i_sb
)
->
bmap
->
db_active
[
ji
->
agno
]);
&
JFS_SBI
(
inode
->
i_sb
)
->
bmap
->
db_active
[
ji
->
agno
]);
}
}
spin_unlock_irq
(
&
ji
->
ag_lock
);
}
}
return
0
;
return
0
;
...
@@ -78,11 +80,13 @@ static int jfs_release(struct inode *inode, struct file *file)
...
@@ -78,11 +80,13 @@ static int jfs_release(struct inode *inode, struct file *file)
{
{
struct
jfs_inode_info
*
ji
=
JFS_IP
(
inode
);
struct
jfs_inode_info
*
ji
=
JFS_IP
(
inode
);
spin_lock_irq
(
&
ji
->
ag_lock
);
if
(
ji
->
active_ag
!=
-
1
)
{
if
(
ji
->
active_ag
!=
-
1
)
{
struct
bmap
*
bmap
=
JFS_SBI
(
inode
->
i_sb
)
->
bmap
;
struct
bmap
*
bmap
=
JFS_SBI
(
inode
->
i_sb
)
->
bmap
;
atomic_dec
(
&
bmap
->
db_active
[
ji
->
active_ag
]);
atomic_dec
(
&
bmap
->
db_active
[
ji
->
active_ag
]);
ji
->
active_ag
=
-
1
;
ji
->
active_ag
=
-
1
;
}
}
spin_unlock_irq
(
&
ji
->
ag_lock
);
return
0
;
return
0
;
}
}
...
...
fs/jfs/jfs_extent.c
View file @
e83a5d51
...
@@ -553,6 +553,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
...
@@ -553,6 +553,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
if
(
S_ISREG
(
ip
->
i_mode
)
&&
(
ji
->
fileset
==
FILESYSTEM_I
))
{
if
(
S_ISREG
(
ip
->
i_mode
)
&&
(
ji
->
fileset
==
FILESYSTEM_I
))
{
ag
=
BLKTOAG
(
daddr
,
sbi
);
ag
=
BLKTOAG
(
daddr
,
sbi
);
spin_lock_irq
(
&
ji
->
ag_lock
);
if
(
ji
->
active_ag
==
-
1
)
{
if
(
ji
->
active_ag
==
-
1
)
{
atomic_inc
(
&
bmp
->
db_active
[
ag
]);
atomic_inc
(
&
bmp
->
db_active
[
ag
]);
ji
->
active_ag
=
ag
;
ji
->
active_ag
=
ag
;
...
@@ -561,6 +562,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
...
@@ -561,6 +562,7 @@ extBalloc(struct inode *ip, s64 hint, s64 * nblocks, s64 * blkno)
atomic_inc
(
&
bmp
->
db_active
[
ag
]);
atomic_inc
(
&
bmp
->
db_active
[
ag
]);
ji
->
active_ag
=
ag
;
ji
->
active_ag
=
ag
;
}
}
spin_unlock_irq
(
&
ji
->
ag_lock
);
}
}
return
(
0
);
return
(
0
);
...
...
fs/jfs/jfs_incore.h
View file @
e83a5d51
...
@@ -53,6 +53,7 @@ struct jfs_inode_info {
...
@@ -53,6 +53,7 @@ struct jfs_inode_info {
lid_t
blid
;
/* lid of pseudo buffer? */
lid_t
blid
;
/* lid of pseudo buffer? */
lid_t
atlhead
;
/* anonymous tlock list head */
lid_t
atlhead
;
/* anonymous tlock list head */
lid_t
atltail
;
/* anonymous tlock list tail */
lid_t
atltail
;
/* anonymous tlock list tail */
spinlock_t
ag_lock
;
/* protects active_ag */
struct
list_head
anon_inode_list
;
/* inodes having anonymous txns */
struct
list_head
anon_inode_list
;
/* inodes having anonymous txns */
/*
/*
* rdwrlock serializes xtree between reads & writes and synchronizes
* rdwrlock serializes xtree between reads & writes and synchronizes
...
...
fs/jfs/super.c
View file @
e83a5d51
...
@@ -141,10 +141,13 @@ static void jfs_destroy_inode(struct inode *inode)
...
@@ -141,10 +141,13 @@ static void jfs_destroy_inode(struct inode *inode)
{
{
struct
jfs_inode_info
*
ji
=
JFS_IP
(
inode
);
struct
jfs_inode_info
*
ji
=
JFS_IP
(
inode
);
spin_lock_irq
(
&
ji
->
ag_lock
);
if
(
ji
->
active_ag
!=
-
1
)
{
if
(
ji
->
active_ag
!=
-
1
)
{
struct
bmap
*
bmap
=
JFS_SBI
(
inode
->
i_sb
)
->
bmap
;
struct
bmap
*
bmap
=
JFS_SBI
(
inode
->
i_sb
)
->
bmap
;
atomic_dec
(
&
bmap
->
db_active
[
ji
->
active_ag
]);
atomic_dec
(
&
bmap
->
db_active
[
ji
->
active_ag
]);
ji
->
active_ag
=
-
1
;
}
}
spin_unlock_irq
(
&
ji
->
ag_lock
);
#ifdef CONFIG_JFS_POSIX_ACL
#ifdef CONFIG_JFS_POSIX_ACL
if
(
ji
->
i_acl
!=
JFS_ACL_NOT_CACHED
)
{
if
(
ji
->
i_acl
!=
JFS_ACL_NOT_CACHED
)
{
...
@@ -559,6 +562,7 @@ static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
...
@@ -559,6 +562,7 @@ static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags)
init_rwsem
(
&
jfs_ip
->
rdwrlock
);
init_rwsem
(
&
jfs_ip
->
rdwrlock
);
init_MUTEX
(
&
jfs_ip
->
commit_sem
);
init_MUTEX
(
&
jfs_ip
->
commit_sem
);
init_rwsem
(
&
jfs_ip
->
xattr_sem
);
init_rwsem
(
&
jfs_ip
->
xattr_sem
);
spin_lock_init
(
&
jfs_ip
->
ag_lock
);
jfs_ip
->
active_ag
=
-
1
;
jfs_ip
->
active_ag
=
-
1
;
#ifdef CONFIG_JFS_POSIX_ACL
#ifdef CONFIG_JFS_POSIX_ACL
jfs_ip
->
i_acl
=
JFS_ACL_NOT_CACHED
;
jfs_ip
->
i_acl
=
JFS_ACL_NOT_CACHED
;
...
...
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