I look at code, and see that
1)locks wasn't release in the opposite order in which they were taken
2)in jfs_rename we lock new_ip, and in "error path" we didn't unlock it
3)I see strange expression: "! !"
May be this worth to fix?
Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
* Inode is being freed
*/
list_del_init(&jfs_ip->anon_inode_list);
* Inode is being freed
*/
list_del_init(&jfs_ip->anon_inode_list);
- } else if (! !mutex_trylock(&jfs_ip->commit_mutex)) {
+ } else if (mutex_trylock(&jfs_ip->commit_mutex)) {
/*
* inode will be removed from anonymous list
* when it is committed
/*
* inode will be removed from anonymous list
* when it is committed
- mutex_unlock(&JFS_IP(dip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dip)->commit_mutex);
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
- mutex_unlock(&JFS_IP(dip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dip)->commit_mutex);
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
if (rc == -EIO)
txAbort(tid, 1);
txEnd(tid);
if (rc == -EIO)
txAbort(tid, 1);
txEnd(tid);
- mutex_unlock(&JFS_IP(dip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dip)->commit_mutex);
- mutex_unlock(&JFS_IP(dip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dip)->commit_mutex);
/*
* Truncating the directory index table is not guaranteed. It
/*
* Truncating the directory index table is not guaranteed. It
if (rc == -EIO)
txAbort(tid, 1); /* Marks FS Dirty */
txEnd(tid);
if (rc == -EIO)
txAbort(tid, 1); /* Marks FS Dirty */
txEnd(tid);
- mutex_unlock(&JFS_IP(dip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dip)->commit_mutex);
IWRITE_UNLOCK(ip);
goto out1;
}
IWRITE_UNLOCK(ip);
goto out1;
}
if ((new_size = commitZeroLink(tid, ip)) < 0) {
txAbort(tid, 1); /* Marks FS Dirty */
txEnd(tid);
if ((new_size = commitZeroLink(tid, ip)) < 0) {
txAbort(tid, 1); /* Marks FS Dirty */
txEnd(tid);
- mutex_unlock(&JFS_IP(dip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dip)->commit_mutex);
IWRITE_UNLOCK(ip);
rc = new_size;
goto out1;
IWRITE_UNLOCK(ip);
rc = new_size;
goto out1;
- mutex_unlock(&JFS_IP(dip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dip)->commit_mutex);
while (new_size && (rc == 0)) {
tid = txBegin(dip->i_sb, 0);
while (new_size && (rc == 0)) {
tid = txBegin(dip->i_sb, 0);
- mutex_unlock(&JFS_IP(dir)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dir)->commit_mutex);
jfs_info("jfs_link: rc:%d", rc);
return rc;
jfs_info("jfs_link: rc:%d", rc);
return rc;
- mutex_unlock(&JFS_IP(dip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
mutex_unlock(&JFS_IP(ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(dip)->commit_mutex);
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
if (rc) {
free_ea_wmap(ip);
ip->i_nlink = 0;
if (S_ISDIR(new_ip->i_mode)) {
new_ip->i_nlink--;
if (new_ip->i_nlink) {
if (S_ISDIR(new_ip->i_mode)) {
new_ip->i_nlink--;
if (new_ip->i_nlink) {
- mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
- mutex_unlock(&JFS_IP(old_ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
if (old_dir != new_dir)
mutex_unlock(&JFS_IP(old_dir)->commit_mutex);
if (old_dir != new_dir)
mutex_unlock(&JFS_IP(old_dir)->commit_mutex);
+ mutex_unlock(&JFS_IP(old_ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
if (!S_ISDIR(old_ip->i_mode) && new_ip)
IWRITE_UNLOCK(new_ip);
jfs_error(new_ip->i_sb,
if (!S_ISDIR(old_ip->i_mode) && new_ip)
IWRITE_UNLOCK(new_ip);
jfs_error(new_ip->i_sb,
-
- mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
- mutex_unlock(&JFS_IP(old_ip)->commit_mutex);
- if (old_dir != new_dir)
- mutex_unlock(&JFS_IP(old_dir)->commit_mutex);
if (new_ip)
mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
if (new_ip)
mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
+ if (old_dir != new_dir)
+ mutex_unlock(&JFS_IP(old_dir)->commit_mutex);
+ mutex_unlock(&JFS_IP(old_ip)->commit_mutex);
+ mutex_unlock(&JFS_IP(new_dir)->commit_mutex);
while (new_size && (rc == 0)) {
tid = txBegin(new_ip->i_sb, 0);
while (new_size && (rc == 0)) {
tid = txBegin(new_ip->i_sb, 0);