Skip to contentSkip to conversation

fs/btrfs/delayed-inode.c:1013:1-11: second lock on line 1013

PATCH In review Fengguang Wu 2 participants 3 messages Aug 3, 2012 – Aug 4, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 9/11 fs/btrfs/delayed-inode.c:1013:1-11: second lock on line 1013

Hi Josef,

There are (old) coccinelle warnings in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git master
head:   233564d3f5bde271885f5b784b63cfe627bba0a5
commit: ec93ee7ac77b2e95934253823918c3c684c1a36c [9/11] Btrfs: barrier before waitqueue_active

All coccinelle warnings:

+ fs/btrfs/delayed-inode.c:1013:1-11: second lock on line 1013 --
+ fs/btrfs/volumes.c:2888:1-3: WARNING: PTR_RET can be used (patch attached)

vim +1013 fs/btrfs/delayed-inode.c
1010 int ret = 0;
1011
1012 do_again:

Quoted 1 line

1013 mutex_lock(&node->mutex);

1014 curr = __btrfs_first_delayed_deletion_item(node);
1015 if (!curr)
1016 goto delete_fail;
...
1031 if (curr)

Quoted 1 line

1032 goto do_again;

1033 else
1034 goto delete_fail;

---
0-DAY kernel build testing backend Open Source Technology Centre
Fengguang Wu <[email protected]> Intel Corporation

Generated by: api/ptr_ret.cocci

Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR

fs/btrfs/volumes.c +1 -4
@@ -2885,10 +2885,7 @@ int btrfs_resume_balance_async(struct bt
 	}
 
 	tsk = kthread_run(balance_kthread, fs_info, "btrfs-balance");
-	if (IS_ERR(tsk))
-		return PTR_ERR(tsk);
-
-	return 0;
+	return PTR_RET(tsk);
 }
 
 int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
#1 lore raw
Quoted 19 lines · Fengguang Wu

Hi Josef,

There are (old) coccinelle warnings in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git master
head:   233564d3f5bde271885f5b784b63cfe627bba0a5
commit: ec93ee7ac77b2e95934253823918c3c684c1a36c [9/11] Btrfs: barrier before waitqueue_active

All coccinelle warnings:

+ fs/btrfs/delayed-inode.c:1013:1-11: second lock on line 1013 --
+ fs/btrfs/volumes.c:2888:1-3: WARNING: PTR_RET can be used (patch attached)

vim +1013 fs/btrfs/delayed-inode.c
1010 int ret = 0;
1011
1012 do_again:

Quoted 1 line

1013 mutex_lock(&node->mutex);

Quoted 9 lines

1014 curr = __btrfs_first_delayed_deletion_item(node);
1015 if (!curr)
1016 goto delete_fail;
...
1031 if (curr)

Quoted 1 line

1032 goto do_again;

1033 else
1034 goto delete_fail;

Ok that wasn't related to my patch so I'm not going to fold it in, do you want to send me a real patch with a Signed-off-by that I can apply? Thanks,

Josef

#2 lore raw
In reply to Fengguang Wu
Quoted 25 lines · Josef Bacik
Quoted 24 lines · Fengguang Wu

Hi Josef,

There are (old) coccinelle warnings in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git master
head:   233564d3f5bde271885f5b784b63cfe627bba0a5
commit: ec93ee7ac77b2e95934253823918c3c684c1a36c [9/11] Btrfs: barrier before waitqueue_active

All coccinelle warnings:

+ fs/btrfs/delayed-inode.c:1013:1-11: second lock on line 1013 --
+ fs/btrfs/volumes.c:2888:1-3: WARNING: PTR_RET can be used (patch attached)

vim +1013 fs/btrfs/delayed-inode.c
1010 int ret = 0;
1011
1012 do_again:

Quoted 1 line

1013 mutex_lock(&node->mutex);

1014 curr = __btrfs_first_delayed_deletion_item(node);
1015 if (!curr)
1016 goto delete_fail;
...
1031 if (curr)

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

1032 goto do_again;

1033 else
1034 goto delete_fail;

Ok that wasn't related to my patch so I'm not going to fold it in, do you want to send me a real patch with a Signed-off-by that I can apply? Thanks,

Sure. I'll send one bug fix and another code cleanup for each of the warnings.

Thanks,
Fengguang